--- a/ByteArray.st Sun Feb 01 03:08:32 2009 +0100
+++ b/ByteArray.st Sun Feb 01 03:08:43 2009 +0100
@@ -161,6 +161,7 @@
^ self basicNew:anInteger
! !
+
!ByteArray class methodsFor:'queries'!
isBuiltInClass
@@ -257,7 +258,7 @@
!
bitAt:index
- "return the bit at index (1 based index)"
+ "return the bit at index (1 based index) as 0 or 1"
|byteIndex bitIndex0 byte|
@@ -270,20 +271,20 @@
REGISTER OBJ cls;
if (__isSmallInteger(index)) {
- indx = __intVal(index) - 1;
- slf = self;
-
- byte = indx / 8;
- indx = indx % 8;
-
- if ((cls = __qClass(slf)) != @global(ByteArray)) {
- if (indx < 0) goto badIndex;
- byte += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
- }
- nIndex = __byteArraySize(slf);
- if ((unsigned)byte < (unsigned)nIndex) {
- RETURN ( __mkSmallInteger(((__ByteArrayInstPtr(slf)->ba_element[byte] & (1 << indx)) != 0)) );
- }
+ indx = __intVal(index) - 1;
+ slf = self;
+
+ byte = indx / 8;
+ indx = indx % 8;
+
+ if ((cls = __qClass(slf)) != @global(ByteArray)) {
+ if (indx < 0) goto badIndex;
+ byte += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+ }
+ nIndex = __byteArraySize(slf);
+ if ((unsigned)byte < (unsigned)nIndex) {
+ RETURN ( __mkSmallInteger(((__ByteArrayInstPtr(slf)->ba_element[byte] & (1 << indx)) != 0)) );
+ }
}
badIndex: ;
%}.
@@ -293,13 +294,10 @@
^ byte bitTest:(1 bitShift:bitIndex0).
"
- #[ 1 1 1 1 ] bitAt:9
+ #[ 1 1 1 1 ] bitAt:9
#[ 1 1 1 1 ] bitAt:11
#[ 2 2 2 2 ] bitAt:10
"
-
-
-
!
bitClearAt:index
@@ -908,6 +906,7 @@
"
! !
+
!ByteArray methodsFor:'comparing'!
= aByteArray
@@ -3196,5 +3195,5 @@
!ByteArray class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.186 2008-10-22 06:42:16 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.187 2009-02-01 02:08:43 cg Exp $'
! !