--- a/ByteArray.st Mon Jul 17 12:24:17 2017 +0200
+++ b/ByteArray.st Mon Jul 17 12:29:26 2017 +0200
@@ -164,6 +164,9 @@
! !
+
+
+
!ByteArray class methodsFor:'queries'!
elementByteSize
@@ -198,6 +201,8 @@
^ 0
! !
+
+
!ByteArray methodsFor:'Compatibility-Squeak'!
bitXor:aByteArray
@@ -2520,6 +2525,37 @@
"Modified (comment): / 01-05-2017 / 12:56:13 / cg"
!
+swap:i1 with:i2
+ "spap the bytes at i1 and i2"
+
+%{ /* NOCONTEXT */
+
+ REGISTER unsigned char *p;
+ unsigned int __i1, __i2;
+ int sz;
+ unsigned int t;
+
+ if (__qClass(self) == @global(ByteArray) && __bothSmallInteger(i1, i2)) {
+ __i1 = __intVal(i1) - 1;
+ __i2 = __intVal(i2) - 1;
+ sz = __byteArraySize(self);
+ p = __ByteArrayInstPtr(self)->ba_element;
+ if ((__i1 < sz) && (__i2 < sz)) {
+ t = p[__i1];
+ p[__i1] = p[__i2];
+ p[__i2] = t;
+ RETURN ( self );
+ }
+ }
+%}.
+ ^ super swap:i1 with:i2
+
+ "
+ #[1 2 3 4 5 6 7 8 9 10] copy swapIndex:1 and:10
+ #[1 2 3 4 5 6 7 8 9 10 11] copy swapIndex:5 and:6
+ "
+!
+
swapBytes
"swap bytes (of int16s) inplace -
Expects that the receiver has an even number of bytes;
@@ -2570,37 +2606,6 @@
"
!
-swapIndex:i1 and:i2
- "spap the bytes with i1 and i2"
-
-%{ /* NOCONTEXT */
-
- REGISTER unsigned char *p;
- unsigned int __i1, __i2;
- int sz;
- unsigned int t;
-
- if (__qClass(self) == @global(ByteArray) && __bothSmallInteger(i1, i2)) {
- __i1 = __intVal(i1) - 1;
- __i2 = __intVal(i2) - 1;
- sz = __byteArraySize(self);
- p = __ByteArrayInstPtr(self)->ba_element;
- if (__i1 < sz && __i2 < sz) {
- t = p[__i1];
- p[__i1] = p[__i2];
- p[__i2] = t;
- }
- RETURN ( self );
- }
-%}.
- ^ super swapIndex:i1 and:i2 "/ rubbish - there is no one currently
-
- "
- #[1 2 3 4 5 6 7 8 9 10] copy swapIndex:1 and:10
- #[1 2 3 4 5 6 7 8 9 10 11] copy swapIndex:5 and:6
- "
-!
-
swapLongs
"swap long bytes inplace
- any partial longs at the end are not swapped."
@@ -3139,6 +3144,7 @@
"
! !
+
!ByteArray methodsFor:'searching'!
indexOf:aByte startingAt:start
@@ -3204,6 +3210,7 @@
"
! !
+
!ByteArray methodsFor:'testing'!
isByteArray
@@ -3260,6 +3267,7 @@
"Created: / 16-02-2017 / 15:02:36 / stefan"
! !
+
!ByteArray class methodsFor:'documentation'!
version