bit shifting

Hans-Martin Mosner hm.mosner at cww.de
Sat Apr 11 19:50:07 UTC 1998


Hi,
has anybody else discovered that bit shifting of negative numbers is
broken? Although the comment in Integer>>bitShift: says that it shifts
the two's complement, it's actually doing one's complement shifting,
i.e.
	(-1 bitShift: 1) = -2
which is plain wrong. Unfortunately, if I correct the
SmallInteger>>bitShift: method, LargeInteger division breaks. And I
don't want to mess with Integer>>digitDiv:neg: !

Hans-Martin





More information about the Squeak-dev mailing list