--- a/ByteArray.st Thu Dec 20 11:48:59 2012 +0000
+++ b/ByteArray.st Sat Jan 19 01:30:00 2013 +0000
@@ -11,7 +11,7 @@
"
"{ Package: 'stx:libbasic' }"
-UninterpretedBytes subclass:#ByteArray
+UninterpretedBytes variableByteSubclass:#ByteArray
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
@@ -161,6 +161,7 @@
^ self basicNew:anInteger
! !
+
!ByteArray class methodsFor:'queries'!
elementByteSize
@@ -920,6 +921,7 @@
"
! !
+
!ByteArray methodsFor:'comparing'!
= aByteArray
@@ -1041,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
"
!
@@ -1054,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
"
!
@@ -2537,6 +2539,7 @@
"
! !
+
!ByteArray methodsFor:'printing & storing'!
displayOn:aGCOrStream
@@ -2745,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
@@ -2966,7 +2969,7 @@
^ 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
"
! !
@@ -2997,13 +3000,9 @@
!ByteArray class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.208 2012/10/10 17:00:30 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.208 2012-10-10 17:00:30 cg Exp $'
!
version_CVS
- ^ '§Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.208 2012/10/10 17:00:30 cg Exp §'
-!
-
-version_SVN
- ^ '$Id: ByteArray.st 10858 2012-10-29 22:07:56Z vranyj1 $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.208 2012-10-10 17:00:30 cg Exp $'
! !