--- a/Integer.st Sun Feb 01 03:09:04 2009 +0100
+++ b/Integer.st Sun Feb 01 10:53:30 2009 +0100
@@ -1369,6 +1369,32 @@
"
!
+bitIndicesOfOneBitsDo:aBlock
+ "evaluate aBlock for all inices of a 1-bit, starting with an index of 1 for the least
+ significant bit."
+
+ 1 to:self digitLength do:[:i8 |
+ |byte|
+
+ byte := self digitAt:i8.
+ byte ~~ 0 ifTrue:[
+ 1 to:8 do:[:i |
+ (byte bitAt:i) == 1 ifTrue:[
+ aBlock value:(((i8-1)*8) + i).
+ ].
+ ].
+ ]
+ ].
+
+ "
+ 1 bitIndicesOfOneBitsDo:[:i | Transcript showCR:i].
+ 2 bitIndicesOfOneBitsDo:[:i | Transcript showCR:i]
+ 4 bitIndicesOfOneBitsDo:[:i | Transcript showCR:i]
+ 12 bitIndicesOfOneBitsDo:[:i | Transcript showCR:i]
+ 127 bitIndicesOfOneBitsDo:[:i | Transcript showCR:i]
+ "
+!
+
bitInvert
"return a new integer, where all bits are complemented.
This does not really make sense for negative largeIntegers,
@@ -3852,7 +3878,7 @@
!Integer class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.211 2009-02-01 02:01:58 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.212 2009-02-01 09:53:30 cg Exp $'
! !
Integer initialize!