--- a/SmallInteger.st Sun Feb 01 03:01:58 2009 +0100
+++ b/SmallInteger.st Sun Feb 01 03:03:52 2009 +0100
@@ -812,27 +812,27 @@
!
bitAt:anIntegerIndex
- "return the value of the index's bit (index starts at 1).
+ "return the value of the index's bit (index starts at 1) as 0 or 1.
Notice: the result of bitAt: on negative receivers is not
- defined in the language standard (since the implementation
- is free to choose any internal representation for integers)"
+ defined in the language standard (since the implementation
+ is free to choose any internal representation for integers)"
%{ /* NOCONTEXT */
if (__isSmallInteger(anIntegerIndex)) {
- INT idx = __smallIntegerVal(anIntegerIndex);
- if (idx > 0) {
- if (idx > N_INT_BITS) {
- RETURN(__mkSmallInteger(0));
- }
- RETURN((__smallIntegerVal(self) & (1 << (idx-1))) ? __mkSmallInteger(1) : __mkSmallInteger(0));
- }
+ INT idx = __smallIntegerVal(anIntegerIndex);
+ if (idx > 0) {
+ if (idx > N_INT_BITS) {
+ RETURN(__mkSmallInteger(0));
+ }
+ RETURN((__smallIntegerVal(self) & (1 << (idx-1))) ? __mkSmallInteger(1) : __mkSmallInteger(0));
+ }
}
%}.
^ SubscriptOutOfBoundsSignal
- raiseRequestWith:anIntegerIndex
- errorString:'index out of bounds'
+ raiseRequestWith:anIntegerIndex
+ errorString:'index out of bounds'
"
16r00000001 bitAt:0
@@ -852,9 +852,9 @@
|mask|
anIntegerIndex <= 0 ifTrue:[
- ^ SubscriptOutOfBoundsSignal
- raiseRequestWith:anIntegerIndex
- errorString:'index out of bounds'
+ ^ SubscriptOutOfBoundsSignal
+ raiseRequestWith:anIntegerIndex
+ errorString:'index out of bounds'
].
(anIntegerIndex > SmallInteger maxBits) ifTrue:[^ 0].
mask := 1 bitShift:(anIntegerIndex - 1).
@@ -3798,5 +3798,5 @@
!SmallInteger class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.172 2009-01-24 20:40:24 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.173 2009-02-01 02:03:52 cg Exp $'
! !