Integer
In addition to supporting the basic protocol, the class Integer supports the following messages.
Manipulating bits
allMask:, anyMask:, bitAnd:, bitAt:, bitInvert, bitOr:, bitShift:, bitXor:, clearBit:, highBit, isBitSet:, noMask:, setBit:
Note:
The CLDT messages clearBit:, isBitSet:, and setBit: are not in the Blue Book but have been added to make bit-level manipulation easier.
Porting tip:
Objectworks/Smalltalk does not support clearBit:, isBitSet:, or setBit. It supports its own methods named anyBitto:, maskClear:, and maskSet:, which are not in the Blue Book. Smalltalk/V does not support allMask:, anyMask:, clearBit:, isBitSet:, highBit, noMask:, or setBit:.
Enumerating
timesRepeat:
Testing
even, odd
Porting tip:
Smalltalk/V and Objectworks\Smalltalk define even and odd for all numbers, not just Integer. This leads to surprising and inconsistent results due to round-off error and other problems.
Printing
printOn:base:, printOn:base:showRadix:, printStringRadix:, printStringRadix:padTo:, printStringRadix:showRadix:, printStringRadix:showRadix:padTo:
Porting tip:
All Smalltalk dialects support the message printOn:base:. Objectworks\Smalltalk also supports printStringRadix:, which is specified in the IBM Red Book. The additional CLDT integer printing messages are specific to VA Smalltalk. In some cases the other vendors supply functionally equivalent messages.
Integer math functions
factorial, gcd:, lcm:
Converting
asCharacter:, asScaledDecimal
Last modified date: 04/20/2020