Bit shifting limitations

John Meacham john at
Sun Jul 13 20:13:15 UTC 2014

On Sun, Jul 13, 2014 at 12:42 PM, Henning Thielemann
<schlepptop at> wrote:
> What kind of data do you have in mind, where both signed and unsigned shifts
> make sense?

It almost always matters and is independent of the type. For instance,
pretty much every one of these requires one or the other and it
doesn't necessarily coorespond to the signedness of the arguments
relying on C casts.

Generally, except for the very basic case of replacing a multiply with
a shift, you will want one behavior or the other.

Plus, it is exactly the distinction made in CPUs, they have
independent arithmetic and logical shift operations.


John Meacham -

More information about the Libraries mailing list