From: Stephen Adams Date: Wed, 26 Jul 1995 23:59:44 +0000 (+0000) Subject: Fixed to work with split fixnums: they are signed and have an X-Git-Tag: 20090517-FFI~6137 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=aa7a0213a6ec73470f0c283b785e65fb610b6558;p=mit-scheme.git Fixed to work with split fixnums: they are signed and have an effective odd word length. --- diff --git a/v8/src/microcode/mul.c b/v8/src/microcode/mul.c index adbf4a7d5..a3c20ffea 100644 --- a/v8/src/microcode/mul.c +++ b/v8/src/microcode/mul.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: mul.c,v 9.33 1993/02/15 03:39:48 gjr Exp $ +$Id: mul.c,v 9.34 1995/07/26 23:59:44 adams Exp $ Copyright (c) 1987-1993 Massachusetts Institute of Technology @@ -208,8 +208,7 @@ static long Fixnum_Range[2] = {SMALLEST_FIXNUM , BIGGEST_FIXNUM}; #define HALF_WORD_SIZE (((sizeof (long)) * CHAR_BIT) / 2) #define HALF_WORD_MASK ((ONE << HALF_WORD_SIZE) - 1) -#define MAX_MIDDLE (ONE << ((DATUM_LENGTH - 1) - HALF_WORD_SIZE)) -#define MAX_FIXNUM (ONE << DATUM_LENGTH) +#define MAX_MIDDLE ((BIGGEST_FIXNUM + 1) >> HALF_WORD_SIZE) #define ABS(x) (((x) < 0) ? -(x) : (x)) SCHEME_OBJECT @@ -236,6 +235,7 @@ DEFUN (Mul, (Arg1, Arg2), if (Lo_C >= FIXNUM_SIGN_BIT) return (SHARP_F); Middle_C = (Lo_A * Hi_B) + (Hi_A * Lo_B); + if (Middle_C >= MAX_MIDDLE) return (SHARP_F); C = Lo_C + (Middle_C << HALF_WORD_SIZE); @@ -244,7 +244,7 @@ DEFUN (Mul, (Arg1, Arg2), if (Sign || (C == 0)) return (LONG_TO_UNSIGNED_FIXNUM(C)); else - return (LONG_TO_UNSIGNED_FIXNUM(MAX_FIXNUM - C)); + return (LONG_TO_FIXNUM(-C)); } return (SHARP_F); }