[m-rev.] for review: complete switches on 8- and 16-bit fixed size integers

Julien Fischer jfischer at opturion.com
Thu Apr 5 16:21:46 AEST 2018


On Thu, 5 Apr 2018, Zoltan Somogyi wrote:

> On Thu, 5 Apr 2018 14:51:33 +1000 (AEST), Julien Fischer <jfischer at opturion.com> wrote:
>> For review by anyone.
>
> That looks fine.
>
> Do you have expectation that you, or anyone else, will try to do
> a complete switch on a 16 bit integer?

I'd be a bit surprised if anyone did (other than for the sake of
curiosity).  However, I cannot think of a good reason not to allow it
and it's (just) within what's feasible for the compiler.

> Even for an 8 bit integer, I would think the only feasible way would
> be automatically generated code.

Several such automatically generated tables were just added to the uint8
module in order to implement num_leading_zeros/1 etc.  These tables are
currently implemented in C or C# (the Java library already provides
the operations); the issue addressed by this change is one of the
reasons I didn't add a Mercury implementation of the new operations.
(The other being that smart indexing on fixed sized integers is
currently NYI.)

Julien.


More information about the reviews mailing list