--- a/ByteArray.st Mon May 14 13:14:52 2012 +0200
+++ b/ByteArray.st Mon May 14 13:16:10 2012 +0200
@@ -162,9 +162,6 @@
! !
-
-
-
!ByteArray class methodsFor:'queries'!
elementByteSize
@@ -182,7 +179,6 @@
"Modified: 23.4.1996 / 15:56:25 / cg"
! !
-
!ByteArray methodsFor:'Compatibility-Squeak'!
bitXor:aByteArray
@@ -1047,12 +1043,12 @@
"convert myself to an integer - the first byte is most significant.
This is also in Squeak."
- ^ (LargeInteger digitBytes:self MSB:true) normalize
+ ^ (LargeInteger digitBytes:self MSB:true) compressed
"
- #[ 2 ] asInteger hexPrintString
- #[ 16r1 16r2 ] asInteger hexPrintString
- #[4 0 0 0 0 0 0 0] asInteger hexPrintString
+ #[ 2 ] asInteger hexPrintString
+ #[ 16r1 16r2 ] asInteger hexPrintString
+ #[4 0 0 0 0 0 0 0] asInteger hexPrintString
"
!
@@ -1060,13 +1056,13 @@
"convert myself to an integer - the first byte is most significant.
This is also in Squeak."
- ^ (LargeInteger digitBytes:self MSB:isMSBFirst) normalize
+ ^ (LargeInteger digitBytes:self MSB:isMSBFirst) compressed
"
- (#[ 2 ] asIntegerMSB:true) hexPrintString
- (#[ 16r1 16r2 ] asIntegerMSB:true) hexPrintString
- (#[ 16r1 16r2 ] asIntegerMSB:false) hexPrintString
- (#[4 0 0 0 0 0 0 0] asIntegerMSB:true) hexPrintString
+ (#[ 2 ] asIntegerMSB:true) hexPrintString
+ (#[ 16r1 16r2 ] asIntegerMSB:true) hexPrintString
+ (#[ 16r1 16r2 ] asIntegerMSB:false) hexPrintString
+ (#[4 0 0 0 0 0 0 0] asIntegerMSB:true) hexPrintString
"
!
@@ -2752,23 +2748,23 @@
REGISTER int index, max;
int len;
- if (__qClass(self) == @global(ByteArray)) {
- max = 0;
- index = 0;
- len = __qSize(self) - OHDR_SIZE;
- cp = &(__ByteArrayInstPtr(self)->ba_element[0]);
-
- while (++index <= len) {
- unsigned int byte;
-
- byte = *cp;
- cp++;
- if (byte > max) {
- max = byte;
- if (byte == 255) break;
- }
- }
- RETURN ( __mkSmallInteger(max) );
+ if (__isByteArrayLike(self)) {
+ max = 0;
+ index = 0;
+ len = __qSize(self) - OHDR_SIZE;
+ cp = &(__ByteArrayInstPtr(self)->ba_element[0]);
+
+ while (++index <= len) {
+ unsigned int byte;
+
+ byte = *cp;
+ cp++;
+ if (byte > max) {
+ max = byte;
+ if (byte == 255) break;
+ }
+ }
+ RETURN ( __mkSmallInteger(max) );
}
%}.
^ super max
@@ -2928,42 +2924,42 @@
OBJ cls;
if (__isSmallInteger(aByte) &&__isBytes(self)) {
- byteValue = __intVal(aByte);
-
- if (byteValue & ~0xFF /* i.e. (byteValue < 0) || (byteValue > 255) */) {
- /*
- * searching for something which cannot be found
- */
- RETURN ( __mkSmallInteger(0) );
- }
-
- if (__isSmallInteger(start)) {
- index = __intVal(start);
- len = __byteArraySize(self);
- cp = __ByteArrayInstPtr(self)->ba_element;
- if ((cls = __qClass(self)) != @global(ByteArray)) {
- int nInst;
-
- nInst = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
- cp += nInst;
- len -= nInst;
- }
- cp += index - 1;
- while (index <= len) {
- if (*cp == byteValue) {
- RETURN ( __mkSmallInteger(index) );
- }
- index++;
- cp++;
- }
- RETURN ( __mkSmallInteger(0) );
- }
+ byteValue = __intVal(aByte);
+
+ if (byteValue & ~0xFF /* i.e. (byteValue < 0) || (byteValue > 255) */) {
+ /*
+ * searching for something which cannot be found
+ */
+ RETURN ( __mkSmallInteger(0) );
+ }
+
+ if (__isSmallInteger(start)) {
+ index = __intVal(start);
+ len = __byteArraySize(self);
+ cp = __ByteArrayInstPtr(self)->ba_element;
+ if ((cls = __qClass(self)) != @global(ByteArray)) {
+ int nInst;
+
+ nInst = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+ cp += nInst;
+ len -= nInst;
+ }
+ cp += index - 1;
+ while (index <= len) {
+ if (*cp == byteValue) {
+ RETURN ( __mkSmallInteger(index) );
+ }
+ index++;
+ cp++;
+ }
+ RETURN ( __mkSmallInteger(0) );
+ }
}
%}.
^ super indexOf:aByte startingAt:start
"
- #[1 2 3 4 5 6 7 8 9 0 1 2 3 4 5] indexOf:0
+ #[1 2 3 4 5 6 7 8 9 0 1 2 3 4 5] indexOf:0 startingAt:1
"
! !
@@ -2994,9 +2990,9 @@
!ByteArray class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.206 2011-09-15 13:11:51 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.207 2012-05-14 11:16:10 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.206 2011-09-15 13:11:51 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.207 2012-05-14 11:16:10 stefan Exp $'
! !