Numeric problem?

sqrmax at cvtci.com.ar sqrmax at cvtci.com.ar
Thu May 21 02:40:01 UTC 1998


Hi.

>!LargePositiveInteger methodsFor: 'bit manipulation' stamp: 'di 5/19/1998 
20:23'!
>highBit
>	"Answer the index of the high order bit of the receiver, or zero if the 
receiver is zero. This method is allowed (and needed) for 
LargeNegativeIntegers as well, since Squeak's LargeIntegers are sign/magnitude."
>	| realLength lastDigit |
>	realLength _ self digitLength.
>	[(lastDigit _ self digitAt: realLength) = 0]
>		whileTrue:
>		[(realLength _ realLength - 1) = 0 ifTrue: [^ 0]].
>	^ lastDigit highBit + (8 * (realLength - 1))! !

Aren't LargeIntegers supposed to be normalized, since normalize is a 
private method?

Andres.





More information about the Squeak-dev mailing list