--- a/ByteArray.st Wed Jan 07 13:50:35 2004 +0100
+++ b/ByteArray.st Wed Jan 07 13:50:57 2004 +0100
@@ -3063,61 +3063,7 @@
"Modified: 12.9.1997 / 22:11:33 / cg"
! !
-!ByteArray methodsFor:'searching'!
-
-indexOf:aByte startingAt:start
- "return the index of the first occurrence of the argument, aByte
- in the receiver starting at start, anInteger; return 0 if not found.
- - reimplemented here for speed"
-
-%{ /* NOCONTEXT */
-
- REGISTER unsigned char *cp;
- REGISTER int index, byteValue;
- REGISTER int len;
- 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 ( __MKSMALLINT(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 ( __MKSMALLINT(index) );
- }
- index++;
- cp++;
- }
- RETURN ( __MKSMALLINT(0) );
- }
- }
-%}.
- ^ super indexOf:aByte startingAt:start
-
- "
- #[1 2 3 4 5 6 7 8 9 0 1 2 3 4 5] indexOf:0
- "
-! !
-
-!ByteArray methodsFor:'special queries'!
+!ByteArray methodsFor:'queries'!
max
"return the maximum value in the receiver -
@@ -3283,6 +3229,60 @@
"
! !
+!ByteArray methodsFor:'searching'!
+
+indexOf:aByte startingAt:start
+ "return the index of the first occurrence of the argument, aByte
+ in the receiver starting at start, anInteger; return 0 if not found.
+ - reimplemented here for speed"
+
+%{ /* NOCONTEXT */
+
+ REGISTER unsigned char *cp;
+ REGISTER int index, byteValue;
+ REGISTER int len;
+ 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 ( __MKSMALLINT(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 ( __MKSMALLINT(index) );
+ }
+ index++;
+ cp++;
+ }
+ RETURN ( __MKSMALLINT(0) );
+ }
+ }
+%}.
+ ^ super indexOf:aByte startingAt:start
+
+ "
+ #[1 2 3 4 5 6 7 8 9 0 1 2 3 4 5] indexOf:0
+ "
+! !
+
!ByteArray methodsFor:'testing'!
isByteArray
@@ -3310,5 +3310,5 @@
!ByteArray class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.159 2003-10-23 15:43:55 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.160 2004-01-07 12:50:57 cg Exp $'
! !