--- a/ByteArray.st Wed Apr 23 17:14:38 1997 +0200
+++ b/ByteArray.st Thu Apr 24 16:23:20 1997 +0200
@@ -1915,7 +1915,7 @@
!
reverse
- "reverse order of elements inplace -
+ "reverse the order of my elements inplace -
written as a primitive for speed on image manipulations (mirror)"
%{ /* NOCONTEXT */
@@ -1926,19 +1926,23 @@
OBJ cls;
if (__qClass(self) == @global(ByteArray)) {
- cnt = __byteArraySize(self);
- p1 = __ByteArrayInstPtr(self)->ba_element;
- p2 = p1 + cnt - 1;
- while (cnt > 0) {
- t = *p1;
- *p1++ = *p2;
- *p2-- = t;
- cnt-=2;
- }
- RETURN ( self );
+ cnt = __byteArraySize(self);
+ p1 = __ByteArrayInstPtr(self)->ba_element;
+ p2 = p1 + cnt - 1;
+ while (p1 < p2) {
+ t = *p1;
+ *p1++ = *p2;
+ *p2-- = t;
+ }
+ RETURN ( self );
}
%}.
^ super reverse
+
+ "
+ #[1 2 3 4 5] reverse
+ #[1 2 3 4] reverse
+ "
!
swapBytes
@@ -2306,5 +2310,5 @@
!ByteArray class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.78 1997-04-22 18:59:18 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ByteArray.st,v 1.79 1997-04-24 14:23:20 cg Exp $'
! !