[squeak-dev] Integer>>bitAt: (was [ANN] Kernel methods license
audit)
nicolas cellier
ncellier at ifrance.com
Fri Mar 21 00:17:50 UTC 2008
nicolas cellier a écrit :
>
> However, looking at the source, apart accessors, some methods will
> hardly ever change, like:
> Integer>>bitInvert
> ^-1-self
>
> There is no added value in such method but very obvious algorithm:
> two complement: bitinvert the digits, and add 1
> => bitInvert: take two complement, and subtract 1
>
> The trick is not here, it is in pretending LargeNegativeInteger are
> stored in two complements, what they are not...
> So the trick is in all the bitOr:, bitAnd:, bitXor:, bitShift:
> implementations, as a whole.
>
By the way, why do we lack a Integer>>bitAt: ?
http://bugs.squeak.org/view.php?id=6985
Nicolas
More information about the Squeak-dev
mailing list
|