Take word size into account. Shifts past fixnum size always return
authorGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Thu, 19 Jul 1990 19:11:32 +0000 (19:11 +0000)
committerGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Thu, 19 Jul 1990 19:11:32 +0000 (19:11 +0000)
0.

v7/src/microcode/fixnum.c

index 9f43f5f6dcb618f9925d90d36bed517f58888558..0a718316eab50c0162f9102c2c6d45ff8c590873 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/fixnum.c,v 9.31 1990/07/15 22:49:32 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/fixnum.c,v 9.32 1990/07/19 19:11:32 jinx Rel $
 
 Copyright (c) 1987, 1988, 1989, 1990 Massachusetts Institute of Technology
 
@@ -313,11 +313,11 @@ DEFINE_PRIMITIVE ("FIXNUM-LSH", Prim_fixnum_lsh, 2, 2, 0)
 
   if (y < 0)
   {
-    z = (x >> (- y));
+    z = ((y < (- FIXNUM_LENGTH)) ? 0 : (x >> (- y)));
   }
   else
   {
-    z = (x << y);
+    z = ((y > FIXNUM_LENGTH) ? 0 : (x << y));
   }
   return (LONG_TO_FIXNUM (z));
 }