[Pkg] The Trunk: Kernel-ul.607.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jul 18 18:25:00 UTC 2011


Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.607.mcz

==================== Summary ====================

Name: Kernel-ul.607
Author: ul
Time: 18 July 2011, 5:30:16.971 pm
UUID: 364aaf4f-24eb-4648-9612-2ba439cc26cd
Ancestors: Kernel-ul.606

- Behavior >> #allLocalCallsOn: was moved to the System package.
- use LowBitPerByteTable from #lowBit implementations
- enhanced Integer >> #lowBit

=============== Diff against Kernel-ul.606 ===============

Item was removed:
- ----- Method: Behavior>>allLocalCallsOn: (in category 'user interface') -----
- allLocalCallsOn: aSymbol
- 	"Answer a SortedCollection of all the methods that call on aSymbol, anywhere in my class hierarchy."
- 
- 	| aSet special byte cls |
- 	aSet := Set new.
- 	cls := self theNonMetaClass.
- 	special := Smalltalk hasSpecialSelector: aSymbol
- 					ifTrueSetByte: [:b | byte := b ].
- 	cls withAllSuperAndSubclassesDoGently: [ :class |
- 		(class whichSelectorsReferTo: aSymbol special: special byte: byte)
- 			do: [:sel |
- 				sel isDoIt ifFalse: [aSet add: class name , ' ', sel]]].
- 	cls class withAllSuperAndSubclassesDoGently: [ :class |
- 		(class whichSelectorsReferTo: aSymbol special: special byte: byte)
- 			do: [:sel |
- 				sel isDoIt ifFalse: [aSet add: class name , ' ', sel]]].
- 	^aSet!

Item was changed:
  ----- Method: Integer>>lowBit (in category 'bit manipulation') -----
  lowBit
  	"Answer the index of the low order bit of this number."
+ 	
+ 	| index digit |
+ 	index := 0.
+ 	[ (digit := self digitAt: (index := index + 1)) = 0 ] whileTrue.
+ 	^(LowBitPerByteTable at: digit) + (index - 1 * 8)!
- 	| index |
- 	self = 0 ifTrue: [ ^ 0 ].
- 	index := 1.
- 	[ (self digitAt: index) = 0 ]
- 		whileTrue:
- 			[ index := index + 1 ].
- 	^ (self digitAt: index) lowBit + (8 * (index - 1))!

Item was changed:
  ----- Method: SmallInteger>>lowBit (in category 'bit manipulation') -----
  lowBit
  	" Answer the index of the low order one bit.
  		2r00101000 lowBit       (Answers: 4)
  		2r-00101000 lowBit      (Answers: 4)
  	  First we skip bits in groups of 8, then do a lookup in a table.
  	  While not optimal, this is a good tradeoff; long
  	  integer #lowBit always invokes us with bytes."
+ 
  	| n result lastByte |
  	n := self.
  	n = 0 ifTrue: [ ^ 0 ].
  	result := 0.
  	[(lastByte := n bitAnd: 16rFF) = 0]
  		whileTrue: [
  			result := result + 8.
  			n := n bitShift: -8 ].
+ 	^result + (LowBitPerByteTable at: lastByte)!
- 
- 	"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."
- 	^result + ( #[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] at: lastByte)!



More information about the Packages mailing list