Add bit-wise fixnum operations.
authorGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Mon, 25 Jun 1990 18:18:34 +0000 (18:18 +0000)
committerGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Mon, 25 Jun 1990 18:18:34 +0000 (18:18 +0000)
v7/src/microcode/fixnum.c
v7/src/microcode/version.h
v8/src/microcode/version.h

index 15e5be2610bf863a7fe485fa9cf43e4dfd22cd00..57ece4cecffd65d9f3d823107b649439de6c1ffa 100644 (file)
@@ -1,8 +1,8 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/fixnum.c,v 9.29 1989/09/28 21:18:59 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/fixnum.c,v 9.30 1990/06/25 18:18:20 jinx Exp $
 
-Copyright (c) 1987, 1988, 1989 Massachusetts Institute of Technology
+Copyright (c) 1987, 1988, 1989, 1990 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -247,3 +247,56 @@ DEFINE_PRIMITIVE ("GCD-FIXNUM", Prim_gcd_fixnum, 2, 2, 0)
     }
   PRIMITIVE_RETURN (LONG_TO_FIXNUM (x));
 }
+\f
+/* Bitwise operations */
+
+#define FIXNUM_BOOLEAN_BODY(operation)                                 \
+do                                                                     \
+{                                                                      \
+  fast unsigned long x, y, z;                                          \
+                                                                       \
+  PRIMITIVE_HEADER (2);                                                        \
+                                                                       \
+  x = (arg_fixnum (1));                                                        \
+  y = (arg_fixnum (2));                                                        \
+                                                                       \
+  z = (x operation y);                                                 \
+  return (LONG_TO_FIXNUM (z));                                         \
+} while (0)
+
+
+DEFINE_PRIMITIVE ("FIXNUM-ANDC", Prim_fixnum_andc, 2, 2, 0)
+{
+  FIXNUM_BOOLEAN_BODY(& ~);
+}
+
+
+DEFINE_PRIMITIVE ("FIXNUM-AND", Prim_fixnum_and, 2, 2, 0)
+{
+  FIXNUM_BOOLEAN_BODY(&);
+}
+
+
+DEFINE_PRIMITIVE ("FIXNUM-OR", Prim_fixnum_or, 2, 2, 0)
+{
+  FIXNUM_BOOLEAN_BODY(|);
+}
+
+
+DEFINE_PRIMITIVE ("FIXNUM-XOR", Prim_fixnum_xor, 2, 2, 0)
+{
+  FIXNUM_BOOLEAN_BODY(^);
+}
+
+
+DEFINE_PRIMITIVE ("FIXNUM-NOT", Prim_fixnum_not, 1, 1, 0)
+{
+  fast unsigned long x, z;
+
+  PRIMITIVE_HEADER (1);
+
+  x = (arg_fixnum (1));
+
+  z = (~ (x));
+  return (LONG_TO_FIXNUM (z));
+}
index fdfffc05dc8aab26b435dc90a32bb60e4a0b8bfa..d6452e7e414fd69fdbf658e867c44e0f257182ea 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.34 1990/06/21 20:02:06 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.35 1990/06/25 18:18:34 jinx Exp $
 
 Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology
 
@@ -46,7 +46,7 @@ MIT in each case. */
 #define VERSION                11
 #endif
 #ifndef SUBVERSION
-#define SUBVERSION     34
+#define SUBVERSION     35
 #endif
 
 #ifndef UCODE_TABLES_FILENAME
index 1a35c590543a9bda12adf364c664ff80ad561a81..056cd6d55670e230f731e57c343f2e76eed7c00f 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.34 1990/06/21 20:02:06 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.35 1990/06/25 18:18:34 jinx Exp $
 
 Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology
 
@@ -46,7 +46,7 @@ MIT in each case. */
 #define VERSION                11
 #endif
 #ifndef SUBVERSION
-#define SUBVERSION     34
+#define SUBVERSION     35
 #endif
 
 #ifndef UCODE_TABLES_FILENAME