[m-rev.] for review: define <<u and >>u

Zoltan Somogyi zoltan.somogyi at runbox.com
Tue Dec 6 18:55:10 AEDT 2022



On Tue, 6 Dec 2022 17:44:28 +1100, Peter Wang <novalazy at gmail.com> wrote:

> On Tue, 06 Dec 2022 16:53:33 +1100 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> > 
> > As for const_prop, I have just done the required updates.
> > I found the existing code strange, in that uint_emu.m reduces
> > the unchecked shift ops to the checked ones,
> > which I think is the right thing to do, while int_emu.m does not.
> > And unchecked_{left,right}_shift in int_enu.m check their arguments
> > using code that is (a) different from the checks in {left,right}_shift
> > in int_emu.m, but (b) similar to the checks in {left,right}_shift in
> > uint_emu.m.
> > 
> > Peter, you wrote the original int_emu.m. Do you remember the
> > reason for (a)?
> 
> The additional checks in int_emu.unchecked_{left,right}_shift
> are to ensure that they only succeed when the behaviour of
> int.unchecked_{left,right}_shift is defined.

I didn't mean to imply that the checks in unchecked_{left,right}_shift
should be changed. I think they are fine as they are, but those same
checks should also be done by their checked versions. This is what is done
in uint_emu.m.

And if the implementations of the emulations of checked and unchecked
shifts are the same, then one can be deleted, and calls to the deleted
predicate redirected to the other, which should then be renamed
to avoid giving a misleading impression of specificity.

Zoltan.





More information about the reviews mailing list