bit shifting

Leandro Caniglia caniglia at mate.dm.uba.ar
Thu Apr 16 12:33:49 UTC 1998



Ian Piumarta wrote:

>How about this instead:
>
> <primitive: 17>
> self < 0 ifTrue: [^0 - (self negated bitShift: arg)].
> ^ super bitShift: arg
>
>which seems to produce the right answers across a range of values.
>

This "solution", which is OK from a mathematical point of view, has an
undesired side efect in Squeak:

1. Change the method as above
2. Evaluate: (2 raisedToInteger: 31) // 1047

then an error message says: 'Improper store into indexable object'
:-(

Saludos,
Leandro





More information about the Squeak-dev mailing list