From ae54c2f1ffa1606b1b757f40d5ff93f1afc06e01 Mon Sep 17 00:00:00 2001 From: "Guillermo J. Rozas" Date: Thu, 19 Jul 1990 19:11:32 +0000 Subject: [PATCH] Take word size into account. Shifts past fixnum size always return 0. --- v7/src/microcode/fixnum.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/v7/src/microcode/fixnum.c b/v7/src/microcode/fixnum.c index 9f43f5f6d..0a718316e 100644 --- a/v7/src/microcode/fixnum.c +++ b/v7/src/microcode/fixnum.c @@ -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)); } -- 2.25.1