From: Guillermo J. Rozas Date: Sat, 16 Feb 1991 07:55:09 +0000 (+0000) Subject: Fix bug in fixnum-lsh. It was behaving like an arithmetic shift X-Git-Tag: 20090517-FFI~10921 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=5387773b1dcaf607e90a8df2dfe20555f5147de5;p=mit-scheme.git Fix bug in fixnum-lsh. It was behaving like an arithmetic shift rather than a logical shift. --- diff --git a/v7/src/microcode/fixnum.c b/v7/src/microcode/fixnum.c index 0a718316e..c83dcbda5 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.32 1990/07/19 19:11:32 jinx Rel $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/fixnum.c,v 9.33 1991/02/16 07:54:26 jinx Exp $ Copyright (c) 1987, 1988, 1989, 1990 Massachusetts Institute of Technology @@ -49,6 +49,16 @@ arg_fixnum (n) error_wrong_type_arg (n); return (FIXNUM_TO_LONG (argument)); } + +static long +arg_unsigned_fixnum (n) + int n; +{ + fast SCHEME_OBJECT argument = (ARG_REF (n)); + if (! (FIXNUM_P (argument))) + error_wrong_type_arg (n); + return (UNSIGNED_FIXNUM_TO_LONG (argument)); +} /* Predicates */ @@ -257,8 +267,8 @@ do \ \ PRIMITIVE_HEADER (2); \ \ - x = (arg_fixnum (1)); \ - y = (arg_fixnum (2)); \ + x = (arg_unsigned_fixnum (1)); \ + y = (arg_unsigned_fixnum (2)); \ \ z = (x operation y); \ return (LONG_TO_FIXNUM (z)); \ @@ -295,7 +305,7 @@ DEFINE_PRIMITIVE ("FIXNUM-NOT", Prim_fixnum_not, 1, 1, 0) PRIMITIVE_HEADER (1); - x = (arg_fixnum (1)); + x = (arg_unsigned_fixnum (1)); z = (~ (x)); return (LONG_TO_FIXNUM (z)); @@ -308,7 +318,7 @@ DEFINE_PRIMITIVE ("FIXNUM-LSH", Prim_fixnum_lsh, 2, 2, 0) PRIMITIVE_HEADER (2); - x = (arg_fixnum (1)); + x = (arg_unsigned_fixnum (1)); y = (arg_fixnum (2)); if (y < 0) diff --git a/v7/src/microcode/version.h b/v7/src/microcode/version.h index 62cb769b3..3d7ef117a 100644 --- a/v7/src/microcode/version.h +++ b/v7/src/microcode/version.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.61 1991/01/24 11:26:20 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.62 1991/02/16 07:55:09 jinx Exp $ Copyright (c) 1988-91 Massachusetts Institute of Technology @@ -46,5 +46,5 @@ MIT in each case. */ #define VERSION 11 #endif #ifndef SUBVERSION -#define SUBVERSION 61 +#define SUBVERSION 62 #endif diff --git a/v8/src/microcode/version.h b/v8/src/microcode/version.h index b022a2d07..c049ce8b4 100644 --- a/v8/src/microcode/version.h +++ b/v8/src/microcode/version.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.61 1991/01/24 11:26:20 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.62 1991/02/16 07:55:09 jinx Exp $ Copyright (c) 1988-91 Massachusetts Institute of Technology @@ -46,5 +46,5 @@ MIT in each case. */ #define VERSION 11 #endif #ifndef SUBVERSION -#define SUBVERSION 61 +#define SUBVERSION 62 #endif