Levente Uzonyi uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ul.606.mcz
==================== Summary ====================
Name: Kernel-ul.606 Author: ul Time: 18 July 2011, 5:26:44.832 pm UUID: 765d93ce-2226-a942-abee-bd2f45d192f6 Ancestors: Kernel-nice.605
Copy the lowBit per byte table from SmallInteger >> #lowBit to a class variable in Integer, so it can also be used from other methods without duplication.
=============== Diff against Kernel-nice.605 ===============
Item was changed: Number subclass: #Integer instanceVariableNames: '' + classVariableNames: 'LowBitPerByteTable' - classVariableNames: '' poolDictionaries: '' category: 'Kernel-Numbers'!
!Integer commentStamp: '<historical>' prior: 0! I am a common abstract superclass for all Integer implementations. My implementation subclasses are SmallInteger, LargePositiveInteger, and LargeNegativeInteger. Integer division consists of: / exact division, answers a fraction if result is not a whole integer // answers an Integer, rounded towards negative infinity \ is modulo rounded towards negative infinity quo: truncated division, rounded towards zero!
Item was changed: ----- Method: Integer class>>initialize (in category 'class initialization') ----- initialize "Integer initialize" "Ensure we have the right compact class index"
"LPI has been a compact class forever - just ensure basic correctness" (LargePositiveInteger indexIfCompact = 5) ifFalse:[ (Smalltalk compactClassesArray at: 5) ifNil:[LargePositiveInteger becomeCompactSimplyAt: 5] ifNotNil:[self error: 'Unexpected compact class setup']].
"Cog requires LNI to be compact at 4 (replacing PseudoContext)" (LargeNegativeInteger indexIfCompact = 4) ifFalse:[ "PseudoContext will likely get removed at some point so write this test without introducing a hard dependency" (Smalltalk compactClassesArray at: 4) name == #PseudoContext ifTrue:[Smalltalk compactClassesArray at: 4 put: nil]. (Smalltalk compactClassesArray at: 4) ifNil:[LargeNegativeInteger becomeCompactSimplyAt: 4] ifNotNil:[self error: 'Unexpected compact class setup']]. + + self initializeLowBitPerByteTable !
Item was added: + ----- Method: Integer class>>initializeLowBitPerByteTable (in category 'class initialization') ----- + initializeLowBitPerByteTable + "Initialize LowBitPerByteTable which is a ByteArray that contains the index of the lowest set bit of the integers between 1 and 255. It's defined as a class variable because it's used from the instance side and subclasses." + "The low bits table can be obtained with: + ((1 to: 8) inject: #[1] into: [:lowBits :rank | (lowBits copy at: 1 put: lowBits first + 1; yourself) , lowBits]) allButFirst + or with it's symmetric pair: + ((1 to: 8) inject: #[1] into: [:lowBits :rank | lowBits, (lowBits copy atLast: 1 put: lowBits last + 1; yourself)]) allButLast." + + LowBitPerByteTable := #[1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 6 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 7 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 6 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 8 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 6 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 7 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 6 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1]!
packages@lists.squeakfoundation.org