#FEATURE by stefan
authorStefan Vogel <sv@exept.de>
Wed, 29 Jan 2020 14:16:29 +0100
changeset 25210 672a4cdd0524
parent 25209 8293e76f3a08
child 25211 755d30f833cb
#FEATURE by stefan class: ByteArray changed: #bitBlitBytesFrom:to:with:startingAt:rule: #bitBlitBytesFrom:to:withConstant:rule: support also strings as source bytes (for Crypt/Cipher operations).
ByteArray.st
--- a/ByteArray.st	Wed Jan 29 13:30:17 2020 +0100
+++ b/ByteArray.st	Wed Jan 29 14:16:29 2020 +0100
@@ -164,57 +164,9 @@
     ^ self basicNew:anInteger
 ! !
 
-!ByteArray class methodsFor:'accessing'!
-
-javaName
-
-    ^'[B'.
-
-    "Modified: / 25-02-2011 / 19:02:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!ByteArray class methodsFor:'accessing-java'!
-
-javaArrayClass
-
-    ^JavaArray javaArrayClassFor: self
-
-    "Created: / 11-06-2011 / 23:42:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-javaComponentClass
-
-    ^JavaByte
-
-    "Created: / 20-12-2010 / 22:05:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!ByteArray class methodsFor:'binary storage'!
-
-binaryDefinitionFrom: stream manager: manager
-    "get a ByteArray from the binary stream.
-     ByteArrays are stored as a 4-byte int containing the size, 
-     followed by the actual bytes.
-     This is only invoked for long bytearrays.
-     Short ones are stored in a dense format with a 1 byte length."
-
-    |len|
-
-    "take care of subclasses ..."
-    self == ByteArray ifTrue:[
-        len := stream nextUnsignedInt32MSB:true.
-        ^ stream nextBytes:len.
-    ].
-    ^ super binaryDefinitionFrom:stream manager:manager
-
-    "Modified: / 2.11.1997 / 16:19:49 / cg"
-! !
-
-!ByteArray class methodsFor:'odbc queries'!
-
-odbcTypeSymbol
-    ^ #'SQL_BINARY'
-! !
+
+
+
 
 !ByteArray class methodsFor:'queries'!
 
@@ -236,21 +188,6 @@
     "Modified: 23.4.1996 / 15:56:25 / cg"
 !
 
-isJavaArrayClass
-
-    ^true
-
-    "Created: / 05-02-2011 / 22:45:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-isJavaReferenceType
-
-    "Java arrays are reference types"
-    ^true
-
-    "Created: / 20-12-2010 / 22:30:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
 maxVal
     "the minimum value which can be stored in instances of me.
      For ByteArrays, this is 255"
@@ -265,19 +202,7 @@
     ^ 0
 ! !
 
-!ByteArray class methodsFor:'spray'!
-
-sprayTypeName
-	#swAdded.
-	^SOAP::XePName xsd: 'base64Binary'
-! !
-
-!ByteArray class methodsFor:'testing'!
-
-isInterface
-
-    ^false
-! !
+
 
 !ByteArray methodsFor:'Compatibility-Squeak'!
 
@@ -1046,42 +971,6 @@
     "
 ! !
 
-!ByteArray methodsFor:'binary storage'!
-
-storeBinaryDefinitionOn:stream manager:manager
-    "append a binary representation of the receiver onto stream.
-     Redefined since short ByteArrays can be stored with a special type code
-     in a more compact way.
-     This is an internal interface for the binary storage mechanism."
-
-    |myClass myBasicSize|
-
-    "not, if I have named instance variables"
-    (myClass := self class) instSize ~~ 0 ifTrue:[
-        ^ super storeBinaryDefinitionOn:stream manager:manager
-    ].
-
-    myBasicSize := self basicSize.
-
-    "/ can use a more compact representation;
-    "/ but not for subclasses ...
-
-    ((myClass == ByteArray)
-    and:[myBasicSize <= 255]) ifTrue:[
-        "/ special encoding: <codeForByteArray> <len> <bytes> ...
-        stream nextPut:(manager codeForByteArray); nextPut:myBasicSize.
-    ] ifFalse:[
-        manager putIdOfClass:myClass on:stream.
-        stream nextNumber:4 put:myBasicSize MSB:true.
-    ].
-    self storeBinaryElementsOn:stream.
-
-    "Modified: / 2.11.1997 / 15:28:45 / cg"
-!
-
-storeBinaryElementsOn:aStream
-    aStream nextPutBytes:self basicSize from:self startingAt:1.
-! !
 
 !ByteArray methodsFor:'comparing'!
 
@@ -1193,12 +1082,6 @@
     "
 !
 
-asHGChangesetId
-    ^ HGChangesetId fromBytes:self.
-
-    "Created: / 16-11-2012 / 21:33:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
 asImmutableByteArray
     "return a write-protected copy of myself"
 
@@ -1777,159 +1660,168 @@
     "perform a special case of an aligned bitBlit operation.
      Bytes in the receiver from dstStart to dstEnd are destructively replaced by the result
      of some logical operation, as specified by the ruleSymbol.
-     SourceBytes are fetched starting at sourceOffset.
+     SourceBytes /that may also be s String) are fetched starting at sourceOffset.
      Valid rule symbols are:
-	#copy    - trivial;  same as replaceBytesFrom:to:with:startingAt:
-	#bitXor: - xoring;   byte[dI] = byte[dI] bitXor:(srcByte[sI])
-	#bitAnd: - anding;   byte[dI] = byte[dI] bitAnd:(srcByte[sI])
-	#bitOr:  - oring;    byte[dI] = byte[dI] bitOr:(srcByte[sI])
-	#+       - adding;   byte[dI] = (byte[dI] + (srcByte[sI])) mod: 256
-	#-       - subtract; byte[dI] = (byte[dI] - (srcByte[sI])) mod: 256
+        #copy    - trivial;  same as replaceBytesFrom:to:with:startingAt:
+        #bitXor: - xoring;   byte[dI] = byte[dI] bitXor:(srcByte[sI])
+        #bitAnd: - anding;   byte[dI] = byte[dI] bitAnd:(srcByte[sI])
+        #bitOr:  - oring;    byte[dI] = byte[dI] bitOr:(srcByte[sI])
+        #+       - adding;   byte[dI] = (byte[dI] + (srcByte[sI])) mod: 256
+        #-       - subtract; byte[dI] = (byte[dI] - (srcByte[sI])) mod: 256
      Warning: this is a destructive operation - elements in the receiver are overwritten.
     "
 
     |srcIdx|
 
 %{
-    if ((__isByteArrayLike(sourceBytes))
-     && (__qClass(self) == ByteArray)
-     && __isSmallInteger(dstStart)
-     && __isSmallInteger(dstEnd)
+    if (__qClass(self) == ByteArray
+     && __bothSmallInteger(dstStart, dstEnd)
      && __isSmallInteger(sourceStart)) {
-	unsigned char *srcP = __ByteArrayInstPtr(sourceBytes)->ba_element;
-	unsigned char *dstP = __ByteArrayInstPtr(self)->ba_element;
-	int srcLen = __byteArraySize(sourceBytes);
-	int dstLen = __byteArraySize(self);
-	int __srcStart = __intVal(sourceStart);
-	int __dstStart = __intVal(dstStart);
-	int count = __intVal(dstEnd) - __dstStart + 1;
-
-	if ((__dstStart >= 1)
-	 && (__srcStart >= 1)
-	 && ((__dstStart + count - 1) <= dstLen)
-	 && ((__srcStart + count - 1) <= srcLen)) {
-	    srcP += __srcStart - 1;
-	    dstP += __dstStart - 1;
+        unsigned char *dstP = __byteArrayVal(self);
+        int dstLen = __byteArraySize(self);
+        int __srcStart = __intVal(sourceStart);
+        int __dstStart = __intVal(dstStart);
+        int count = __intVal(dstEnd) - __dstStart + 1;
+        unsigned char *srcP;
+        int srcLen;
+
+        if (__isByteArrayLike(sourceBytes)) {
+            srcP = __byteArrayVal(sourceBytes);
+            srcLen = __byteArraySize(sourceBytes);
+        } else if (__isStringLike(sourceBytes)) {
+            srcP = _stringVal(sourceBytes);
+            srcLen = __stringSize(sourceBytes);
+        } else
+            goto out;
+
+        if ((__dstStart >= 1)
+         && (__srcStart >= 1)
+         && ((__dstStart + count - 1) <= dstLen)
+         && ((__srcStart + count - 1) <= srcLen)) {
+            srcP += __srcStart - 1;
+            dstP += __dstStart - 1;
 
 #define OP_LOOP_BYTES(OP) \
     while (count >= 4) {                                             \
-	(dstP[0]) OP (srcP[0]);                                      \
-	(dstP[1]) OP (srcP[1]);                                      \
-	(dstP[2]) OP (srcP[2]);                                      \
-	(dstP[3]) OP (srcP[3]);                                      \
-	srcP += 4;                                                   \
-	dstP += 4;                                                   \
-	count -= 4;                                                  \
+        (dstP[0]) OP (srcP[0]);                                      \
+        (dstP[1]) OP (srcP[1]);                                      \
+        (dstP[2]) OP (srcP[2]);                                      \
+        (dstP[3]) OP (srcP[3]);                                      \
+        srcP += 4;                                                   \
+        dstP += 4;                                                   \
+        count -= 4;                                                  \
     }                                                                \
     while (count > 0) {                                              \
-	*dstP OP (*srcP);                                            \
-	srcP++;                                                      \
-	dstP++;                                                      \
-	count--;                                                     \
+        *dstP OP (*srcP);                                            \
+        srcP++;                                                      \
+        dstP++;                                                      \
+        count--;                                                     \
     }
 
 #define OP_LOOP(OP) \
     while (count >= 16) {                                            \
-	((unsigned int *)dstP)[0] OP (((unsigned int *)srcP)[0]);    \
-	((unsigned int *)dstP)[1] OP (((unsigned int *)srcP)[1]);    \
-	((unsigned int *)dstP)[2] OP (((unsigned int *)srcP)[2]);    \
-	((unsigned int *)dstP)[3] OP (((unsigned int *)srcP)[3]);    \
-	srcP += 16;                                                  \
-	dstP += 16;                                                  \
-	count -= 16;                                                 \
+        ((unsigned int *)dstP)[0] OP (((unsigned int *)srcP)[0]);    \
+        ((unsigned int *)dstP)[1] OP (((unsigned int *)srcP)[1]);    \
+        ((unsigned int *)dstP)[2] OP (((unsigned int *)srcP)[2]);    \
+        ((unsigned int *)dstP)[3] OP (((unsigned int *)srcP)[3]);    \
+        srcP += 16;                                                  \
+        dstP += 16;                                                  \
+        count -= 16;                                                 \
     }                                                                \
     while (count >= 4) {                                             \
-	((unsigned int *)dstP)[0] OP (((unsigned int *)srcP)[0]);    \
-	srcP += 4;                                                   \
-	dstP += 4;                                                   \
-	count -= 4;                                                  \
+        ((unsigned int *)dstP)[0] OP (((unsigned int *)srcP)[0]);    \
+        srcP += 4;                                                   \
+        dstP += 4;                                                   \
+        count -= 4;                                                  \
     }                                                                \
     while (count > 0) {                                              \
-	*dstP OP (*srcP);                                            \
-	srcP++;                                                      \
-	dstP++;                                                      \
-	count--;                                                     \
+        *dstP OP (*srcP);                                            \
+        srcP++;                                                      \
+        dstP++;                                                      \
+        count--;                                                     \
     }
 
 
-	    if (ruleSymbol == @symbol(bitXor:)) {
-		OP_LOOP( ^= )
-		RETURN (self);
-	    }
-	    if (ruleSymbol == @symbol(bitXorNot:)) {
-		OP_LOOP( ^=~ )
-		RETURN (self);
-	    }
-	    if (ruleSymbol == @symbol(bitAnd:)) {
-		OP_LOOP( &= )
-		RETURN (self);
-	    }
-	    if (ruleSymbol == @symbol(bitAndNot:)) {
-		OP_LOOP( &=~ )
-		RETURN (self);
-	    }
-	    if (ruleSymbol == @symbol(bitOr:)) {
-		OP_LOOP( |= )
-		RETURN (self);
-	    }
-	    if (ruleSymbol == @symbol(bitOrNot:)) {
-		OP_LOOP( |=~ )
-		RETURN (self);
-	    }
-	    if (ruleSymbol == @symbol(copy)) {
-		OP_LOOP( = )
-		RETURN (self);
-	    }
-	    if (ruleSymbol == @symbol(copyNot)) {
-		OP_LOOP( =~ )
-		RETURN (self);
-	    }
-	    if (ruleSymbol == @symbol(+)) {
-		OP_LOOP_BYTES( += )
-		RETURN (self);
-	    }
-	    if (ruleSymbol == @symbol(-)) {
-		OP_LOOP_BYTES( -= )
-		RETURN (self);
-	    }
-	}
+            if (ruleSymbol == @symbol(bitXor:)) {
+                OP_LOOP( ^= )
+                RETURN (self);
+            }
+            if (ruleSymbol == @symbol(bitXorNot:)) {
+                OP_LOOP( ^=~ )
+                RETURN (self);
+            }
+            if (ruleSymbol == @symbol(bitAnd:)) {
+                OP_LOOP( &= )
+                RETURN (self);
+            }
+            if (ruleSymbol == @symbol(bitAndNot:)) {
+                OP_LOOP( &=~ )
+                RETURN (self);
+            }
+            if (ruleSymbol == @symbol(bitOr:)) {
+                OP_LOOP( |= )
+                RETURN (self);
+            }
+            if (ruleSymbol == @symbol(bitOrNot:)) {
+                OP_LOOP( |=~ )
+                RETURN (self);
+            }
+            if (ruleSymbol == @symbol(copy)) {
+                OP_LOOP( = )
+                RETURN (self);
+            }
+            if (ruleSymbol == @symbol(copyNot)) {
+                OP_LOOP( =~ )
+                RETURN (self);
+            }
+            if (ruleSymbol == @symbol(+)) {
+                OP_LOOP_BYTES( += )
+                RETURN (self);
+            }
+            if (ruleSymbol == @symbol(-)) {
+                OP_LOOP_BYTES( -= )
+                RETURN (self);
+            }
+        }
     }
 #undef OP_LOOP_BYTES
 #undef OP_LOOP
-
+out:;
 %}.
     ruleSymbol == #copy ifTrue:[
-	self replaceFrom:dstStart to:dstEnd with:sourceBytes startingAt:sourceStart.
-	^ self
+        self replaceFrom:dstStart to:dstEnd with:sourceBytes startingAt:sourceStart.
+        ^ self
     ].
 
     srcIdx := sourceStart.
     dstStart to:dstEnd do:[:dstIdx |
-	self at:dstIdx put:((self at:dstIdx) perform:ruleSymbol with:(sourceBytes at:srcIdx)).
-	srcIdx := srcIdx + 1.
+        self at:dstIdx put:((self at:dstIdx) perform:ruleSymbol with:(sourceBytes at:srcIdx)).
+        srcIdx := srcIdx + 1.
     ].
 
     "
      #[1 2 3 4 5 6 7 8]
-	bitBlitBytesFrom:1 to:3 with:#[1 2 3 4 5 6 7 8] startingAt:1 rule:#bitXor:
+        bitBlitBytesFrom:1 to:3 with:#[1 2 3 4 5 6 7 8] startingAt:1 rule:#bitXor:
      #[1 2 3 4 5 6 7 8]
-	bitBlitBytesFrom:1 to:8 with:#[1 2 3 4 5 6 7 8] startingAt:1 rule:#bitXor:
+        bitBlitBytesFrom:1 to:8 with:#[1 2 3 4 5 6 7 8] startingAt:1 rule:#bitXor:
      #[1 2 3 4 5 6 7 8]
-	bitBlitBytesFrom:1 to:8 with:#[1 1 1 1 1 1 1 1] startingAt:1 rule:#bitAnd:
+        bitBlitBytesFrom:1 to:8 with:#[1 1 1 1 1 1 1 1] startingAt:1 rule:#bitAnd:
      #[1 2 3 4 5 6 7 8]
-	bitBlitBytesFrom:1 to:8 with:#[1 2 3 4 5 6 7 8] startingAt:1 rule:#+
+        bitBlitBytesFrom:1 to:8 with:#[1 2 3 4 5 6 7 8] startingAt:1 rule:#+
      #[255 0 0 0 0 0 0 0]
-	bitBlitBytesFrom:1 to:8 with:#[1 2 3 4 5 6 7 8] startingAt:1 rule:#+
+        bitBlitBytesFrom:1 to:8 with:#[1 2 3 4 5 6 7 8] startingAt:1 rule:#+
      #[1 2 3 4 5 6 7 8]
-	bitBlitBytesFrom:1 to:4 with:#[1 1 1 1 1 1 1 1] startingAt:1 rule:#+
+        bitBlitBytesFrom:1 to:4 with:#[1 1 1 1 1 1 1 1] startingAt:1 rule:#+
      #[1 2 3 4 5 6 7 8]
-	bitBlitBytesFrom:1 to:4 with:#[1 1 1 1 2 2 2 2] startingAt:5 rule:#+
+        bitBlitBytesFrom:1 to:4 with:#[1 1 1 1 2 2 2 2] startingAt:5 rule:#+
      #[1 2 3 4 5 6 7 8]
-	bitBlitBytesFrom:1 to:4 with:#[1 1 1 1 2 2 2 2] startingAt:5 rule:#copyNot
+        bitBlitBytesFrom:1 to:4 with:#[1 1 1 1 2 2 2 2] startingAt:5 rule:#copyNot
 
      #[1 2 3 4 5 6 7 8]
-	bitBlitBytesFrom:1 to:8 with:(1 to:8) startingAt:1 rule:#+
+        bitBlitBytesFrom:1 to:8 with:(1 to:8) startingAt:1 rule:#+
     "
+
+    "Modified: / 29-01-2020 / 14:11:05 / Stefan Vogel"
 !
 
 bitBlitBytesFrom:dstStart to:dstEnd withConstant:sourceByte rule:ruleSymbol
@@ -1937,149 +1829,148 @@
      Bytes in the receiver from dstStart to dstEnd are destructively replaced by the result
      of some logical operation, as specified by the ruleSymbol.
      Valid rule symbols are:
-	#copy    - trivial;  same as from:to:put:
-	#bitXor: - xoring;   byte[dI] = byte[dI] bitXor:sourceConst
-	#bitAnd: - anding;   byte[dI] = byte[dI] bitAnd:sourceConst
-	#bitOr:  - oring;    byte[dI] = byte[dI] bitOr:sourceConst
-	#+       - adding;   byte[dI] = (byte[dI] + sourceConst) mod: 256
-	#-       - subtract; byte[dI] = (byte[dI] - sourceConst) mod: 256
+        #copy    - trivial;  same as from:to:put:
+        #bitXor: - xoring;   byte[dI] = byte[dI] bitXor:sourceConst
+        #bitAnd: - anding;   byte[dI] = byte[dI] bitAnd:sourceConst
+        #bitOr:  - oring;    byte[dI] = byte[dI] bitOr:sourceConst
+        #+       - adding;   byte[dI] = (byte[dI] + sourceConst) mod: 256
+        #-       - subtract; byte[dI] = (byte[dI] - sourceConst) mod: 256
      Warning: this is a destructive operation - elements in the receiver are overwritten.
     "
 
-    |srcIdx|
-
 %{
     if ((__qClass(self) == ByteArray)
-     && __isSmallInteger(dstStart)
-     && __isSmallInteger(dstEnd)
+     && __bothSmallInteger(dstStart, dstEnd)
      && __isSmallInteger(sourceByte)) {
-	unsigned char srcByte = __intVal(sourceByte);
-	unsigned srcWord;
-	unsigned char *dstP = __ByteArrayInstPtr(self)->ba_element;
-	int dstLen = __byteArraySize(self);
-	int __dstStart = __intVal(dstStart);
-	int count = __intVal(dstEnd) - __dstStart + 1;
-
-	srcWord = (srcByte << 8) | srcByte;
-	srcWord = (srcWord << 16) | srcWord;
-	if ((__dstStart >= 1)
-	 && ((__dstStart + count - 1) <= dstLen)) {
-	    dstP += __dstStart - 1;
+        unsigned char srcByte = __intVal(sourceByte);
+        unsigned srcWord;
+        unsigned char *dstP = __ByteArrayInstPtr(self)->ba_element;
+        int dstLen = __byteArraySize(self);
+        int __dstStart = __intVal(dstStart);
+        int count = __intVal(dstEnd) - __dstStart + 1;
+
+        srcWord = (srcByte << 8) | srcByte;
+        srcWord = (srcWord << 16) | srcWord;
+        if ((__dstStart >= 1)
+         && ((__dstStart + count - 1) <= dstLen)) {
+            dstP += __dstStart - 1;
 
 #define OP_LOOP_BYTES(OP) \
     while (count >= 4) {                         \
-	dstP[0] OP srcByte;                      \
-	dstP[1] OP srcByte;                      \
-	dstP[2] OP srcByte;                      \
-	dstP[3] OP srcByte;                      \
-	dstP += 4;                               \
-	count -= 4;                              \
+        dstP[0] OP srcByte;                      \
+        dstP[1] OP srcByte;                      \
+        dstP[2] OP srcByte;                      \
+        dstP[3] OP srcByte;                      \
+        dstP += 4;                               \
+        count -= 4;                              \
     }                                            \
     while (count > 0) {                          \
-	*dstP OP srcByte;                        \
-	dstP++;                                  \
-	count--;                                 \
+        *dstP OP srcByte;                        \
+        dstP++;                                  \
+        count--;                                 \
     }
 
 #define OP_LOOP_INT32(OP) \
     while (count >= 16) {                        \
-	((unsigned int *)dstP)[0] OP srcWord;    \
-	((unsigned int *)dstP)[1] OP srcWord;    \
-	((unsigned int *)dstP)[2] OP srcWord;    \
-	((unsigned int *)dstP)[3] OP srcWord;    \
-	dstP += 16;                              \
-	count -= 16;                             \
+        ((unsigned int *)dstP)[0] OP srcWord;    \
+        ((unsigned int *)dstP)[1] OP srcWord;    \
+        ((unsigned int *)dstP)[2] OP srcWord;    \
+        ((unsigned int *)dstP)[3] OP srcWord;    \
+        dstP += 16;                              \
+        count -= 16;                             \
     }                                            \
 
 #define OP_LOOP(OP) \
     OP_LOOP_INT32(OP)                            \
     while (count >= 4) {                         \
-	((unsigned int *)dstP)[0] OP srcWord;    \
-	dstP += 4;                               \
-	count -= 4;                              \
+        ((unsigned int *)dstP)[0] OP srcWord;    \
+        dstP += 4;                               \
+        count -= 4;                              \
     }                                            \
     while (count > 0) {                          \
-	*dstP OP srcByte;                        \
-	dstP++;                                  \
-	count--;                                 \
+        *dstP OP srcByte;                        \
+        dstP++;                                  \
+        count--;                                 \
     }
 
 
-	    if (ruleSymbol == @symbol(bitXor:)) {
-		OP_LOOP( ^= )
-		RETURN (self);
-	    }
-	    if (ruleSymbol == @symbol(bitXorNot:)) {
-		OP_LOOP( ^=~ )
-		RETURN (self);
-	    }
-	    if (ruleSymbol == @symbol(bitAnd:)) {
-		OP_LOOP( &= )
-		RETURN (self);
-	    }
-	    if (ruleSymbol == @symbol(bitAndNot:)) {
-		OP_LOOP( &=~ )
-		RETURN (self);
-	    }
-	    if (ruleSymbol == @symbol(bitOr:)) {
-		OP_LOOP( |= )
-		RETURN (self);
-	    }
-	    if (ruleSymbol == @symbol(bitOrNot:)) {
-		OP_LOOP( |=~ )
-		RETURN (self);
-	    }
-	    if (ruleSymbol == @symbol(copy)) {
-		OP_LOOP( = )
-		RETURN (self);
-	    }
-	    if (ruleSymbol == @symbol(copyNot)) {
-		OP_LOOP( =~ )
-		RETURN (self);
-	    }
-	    if (ruleSymbol == @symbol(+)) {
-		OP_LOOP_BYTES( += )
-		RETURN (self);
-	    }
-	    if (ruleSymbol == @symbol(-)) {
-		OP_LOOP_BYTES( -= )
-		RETURN (self);
-	    }
-	}
+            if (ruleSymbol == @symbol(bitXor:)) {
+                OP_LOOP( ^= )
+                RETURN (self);
+            }
+            if (ruleSymbol == @symbol(bitXorNot:)) {
+                OP_LOOP( ^=~ )
+                RETURN (self);
+            }
+            if (ruleSymbol == @symbol(bitAnd:)) {
+                OP_LOOP( &= )
+                RETURN (self);
+            }
+            if (ruleSymbol == @symbol(bitAndNot:)) {
+                OP_LOOP( &=~ )
+                RETURN (self);
+            }
+            if (ruleSymbol == @symbol(bitOr:)) {
+                OP_LOOP( |= )
+                RETURN (self);
+            }
+            if (ruleSymbol == @symbol(bitOrNot:)) {
+                OP_LOOP( |=~ )
+                RETURN (self);
+            }
+            if (ruleSymbol == @symbol(copy)) {
+                OP_LOOP( = )
+                RETURN (self);
+            }
+            if (ruleSymbol == @symbol(copyNot)) {
+                OP_LOOP( =~ )
+                RETURN (self);
+            }
+            if (ruleSymbol == @symbol(+)) {
+                OP_LOOP_BYTES( += )
+                RETURN (self);
+            }
+            if (ruleSymbol == @symbol(-)) {
+                OP_LOOP_BYTES( -= )
+                RETURN (self);
+            }
+        }
     }
 #undef OP_LOOP_BYTES
 #undef OP_LOOP
 %}.
     ruleSymbol == #copy ifTrue:[
-	self from:dstStart to:dstEnd put:sourceByte.
-	^ self
+        self from:dstStart to:dstEnd put:sourceByte.
+        ^ self
     ].
 
     dstStart to:dstEnd do:[:dstIdx |
-	self at:dstIdx put:((self at:dstIdx) perform:ruleSymbol with:sourceByte).
+        self at:dstIdx put:((self at:dstIdx) perform:ruleSymbol with:sourceByte).
     ].
 
     "
      #[1 2 3 4 5 6 7 8]
-	bitBlitBytesFrom:1 to:3 withConstant:1 rule:#bitXor:
+        bitBlitBytesFrom:1 to:3 withConstant:1 rule:#bitXor:
      #[1 2 3 4 5 6 7 8]
-	bitBlitBytesFrom:1 to:8 withConstant:1 rule:#bitXor:
+        bitBlitBytesFrom:1 to:8 withConstant:1 rule:#bitXor:
      #[1 2 3 4 5 6 7 8]
-	bitBlitBytesFrom:1 to:8 withConstant:1 rule:#bitAnd:
+        bitBlitBytesFrom:1 to:8 withConstant:1 rule:#bitAnd:
      #[1 2 3 4 5 6 7 8]
-	bitBlitBytesFrom:1 to:8 withConstant:1 rule:#+
+        bitBlitBytesFrom:1 to:8 withConstant:1 rule:#+
      #[255 0 0 0 0 0 0 0]
-	bitBlitBytesFrom:1 to:8 withConstant:1 rule:#+
+        bitBlitBytesFrom:1 to:8 withConstant:1 rule:#+
      #[1 2 3 4 5 6 7 8]
-	bitBlitBytesFrom:1 to:4 withConstant:1 rule:#+
+        bitBlitBytesFrom:1 to:4 withConstant:1 rule:#+
      #[1 2 3 4 5 6 7 8]
-	bitBlitBytesFrom:1 to:4 withConstant:1 rule:#-
+        bitBlitBytesFrom:1 to:4 withConstant:1 rule:#-
      #[1 2 3 4 5 6 7 8]
-	bitBlitBytesFrom:1 to:4 withConstant:1 rule:#copyNot
+        bitBlitBytesFrom:1 to:4 withConstant:1 rule:#copyNot
 
      #[1 2 3 4 5 6 7 8]
-	bitBlitBytesFrom:1 to:8 withConstant:1 rule:#+
+        bitBlitBytesFrom:1 to:8 withConstant:1 rule:#+
     "
+
+    "Modified (format): / 29-01-2020 / 14:12:06 / Stefan Vogel"
 !
 
 bitOrBytesFrom:dstStart to:dstEnd with:sourceBytes startingAt:sourceStart
@@ -2838,54 +2729,6 @@
     "
 ! !
 
-!ByteArray methodsFor:'inspecting'!
-
-inspectorExtraAttributes
-    "extra (pseudo instvar) entries to be shown in an inspector."
-
-    |basePrinter|
-
-    basePrinter := 
-        [:arr :b |
-            String
-                streamContents:[:s |
-                    arr class isWords ifTrue:[
-                        arr asWordArray printOn:s base:b showRadix:true
-                    ] ifFalse:[
-                        arr class isLongs ifTrue:[
-                            arr asLongIntegerArray printOn:s base:b showRadix:true
-                        ] ifFalse:[
-                            arr asByteArray printOn:s base:b showRadix:true
-                        ]
-                    ]
-                ]
-        ].
-
-    ^ super inspectorExtraAttributes
-        add:'-hexstring'   -> [ self hexPrintString "WithSeparator:Character space" ];
-        add:'-hexadecimal' -> [ basePrinter value:self value:16 ];
-        add:'-binary'      -> [ basePrinter value:self value:2 ];
-        add:'-base64'      -> [ self base64Encoded ];
-        add:'-asciiString' -> [ self asString ];
-        add:'-cString'     -> [ '{',(String streamContents:[:s | self do:[:b | s printf:'0x%02x' with:b ] separatedBy:[s nextPutAll:', ']]), '}' ];
-        yourself
-
-    "Modified (format): / 18-07-2017 / 19:56:54 / cg"
-    "Modified: / 19-09-2018 / 12:08:42 / Claus Gittinger"
-!
-
-inspectorValueStringInListFor:anInspector
-    "returns a string to be shown in the inspector's list"
-
-    |sz|
-
-    (sz := self size) <= 5 ifTrue:[
-        ^ self printString
-    ].
-    ^ (super inspectorValueStringInListFor:anInspector)
-
-    "Created: / 05-09-2017 / 10:55:27 / cg"
-! !
 
 !ByteArray methodsFor:'printing & storing'!
 
@@ -3377,11 +3220,6 @@
     "
 ! !
 
-!ByteArray methodsFor:'queries - asn1'!
-
-asn1Type
-    ^ OSI::ASN1_OCTETSTRING primitiveType
-! !
 
 !ByteArray methodsFor:'searching'!
 
@@ -3448,25 +3286,6 @@
     "
 ! !
 
-!ByteArray methodsFor:'spray'!
-
-printSchemaHexString
-        | stream |
-        #swAdded.
-
-        stream := WriteStream on:(String new:self size * 2).
-        self do:[:eachByte |
-            |s|
-
-            stream nextPut:('0123456789ABCDEF' at:((eachByte bitShift:-4) bitAnd:16rF)+1).
-            stream nextPut:('0123456789ABCDEF' at:(eachByte bitAnd:16rF)+1).
-        ].
-        ^stream contents
-
-        "
-         #[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 254 255] printSchemaHexString 
-        "
-! !
 
 !ByteArray methodsFor:'testing'!
 
@@ -3501,25 +3320,6 @@
     "Modified: 22.4.1996 / 12:55:30 / cg"
 ! !
 
-!ByteArray methodsFor:'vm support'!
-
-_ARRAYLENGTH: cls
-    ^self basicSize
-
-    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-_CHECKCAST: cls
-    ^cls == ByteArray ifTrue:[self] ifFalse:[JavaVM throwClassCastException]
-
-    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-_INSTANCEOF: cls
-    ^ByteArray == cls ifTrue:[1] ifFalse:[0]
-
-    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
 
 !ByteArray class methodsFor:'documentation'!