added #bitClear:
authorClaus Gittinger <cg@exept.de>
Mon, 12 Jan 1998 14:15:14 +0100
changeset 3156 3d63afe752e5
parent 3155 35befc38f4f1
child 3157 b8dd7d5fedd2
added #bitClear:
SmallInt.st
SmallInteger.st
--- a/SmallInt.st	Mon Jan 12 14:14:31 1998 +0100
+++ b/SmallInt.st	Mon Jan 12 14:15:14 1998 +0100
@@ -686,6 +686,24 @@
     "(2r001010100 bitAnd:2r00001111) radixPrintStringRadix:2"
 !
 
+bitClear:anInteger
+    "return the bitwise-and of the receiver and the complement of the argument, anInteger,
+     returning the receiver with bits of the argument cleared."
+
+%{  /* NOCONTEXT */
+
+    /* anding the tags doesn't change it */
+    if (__isSmallInteger(anInteger)) {
+        RETURN ( ((OBJ) (((INT)self & ~(INT)anInteger) | TAG_INT)) );
+    }
+%}.
+    ^ self retry:#bitClear: coercing:anInteger
+
+    "
+     (2r001010100 bitClear:2r00001111) radixPrintStringRadix:2
+    "
+!
+
 bitAt:index
     "return the value of the index's bit (index starts at 1).
      Notice: the result of bitAt: on negative receivers is not 
@@ -2626,5 +2644,5 @@
 !SmallInteger class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/SmallInt.st,v 1.91 1997-12-19 08:38:23 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/SmallInt.st,v 1.92 1998-01-12 13:15:14 cg Exp $'
 ! !
--- a/SmallInteger.st	Mon Jan 12 14:14:31 1998 +0100
+++ b/SmallInteger.st	Mon Jan 12 14:15:14 1998 +0100
@@ -686,6 +686,24 @@
     "(2r001010100 bitAnd:2r00001111) radixPrintStringRadix:2"
 !
 
+bitClear:anInteger
+    "return the bitwise-and of the receiver and the complement of the argument, anInteger,
+     returning the receiver with bits of the argument cleared."
+
+%{  /* NOCONTEXT */
+
+    /* anding the tags doesn't change it */
+    if (__isSmallInteger(anInteger)) {
+        RETURN ( ((OBJ) (((INT)self & ~(INT)anInteger) | TAG_INT)) );
+    }
+%}.
+    ^ self retry:#bitClear: coercing:anInteger
+
+    "
+     (2r001010100 bitClear:2r00001111) radixPrintStringRadix:2
+    "
+!
+
 bitAt:index
     "return the value of the index's bit (index starts at 1).
      Notice: the result of bitAt: on negative receivers is not 
@@ -2626,5 +2644,5 @@
 !SmallInteger class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.91 1997-12-19 08:38:23 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.92 1998-01-12 13:15:14 cg Exp $'
 ! !