From: Taylor R Campbell Date: Fri, 2 Mar 2012 19:34:50 +0000 (+0000) Subject: Fix fencepost typo in integer_shift_left. X-Git-Tag: release-9.2.0~278^2 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=af5ae2357fd3d729dc873edc66edd84b13923d88;p=mit-scheme.git Fix fencepost typo in integer_shift_left. Now (fixnum? (expt 2 24)) returns #t as it should. --- diff --git a/src/microcode/artutl.c b/src/microcode/artutl.c index b6efff0e5..091f6b50d 100644 --- a/src/microcode/artutl.c +++ b/src/microcode/artutl.c @@ -675,7 +675,7 @@ integer_shift_left (SCHEME_OBJECT n, unsigned long m) long n1 = (FIXNUM_TO_LONG (n)); if (n1 < 0) { - if ((m + (ulong_length_in_bits (~n1))) < FIXNUM_LENGTH) + if ((m + (ulong_length_in_bits (~n1))) <= FIXNUM_LENGTH) /* The behaviour of shifting a negative integer is undefined in C. */ return (LONG_TO_FIXNUM (- ((-n1) << m))); @@ -685,7 +685,7 @@ integer_shift_left (SCHEME_OBJECT n, unsigned long m) } else if (0 < n1) { - if ((m + (ulong_length_in_bits (n1))) < FIXNUM_LENGTH) + if ((m + (ulong_length_in_bits (n1))) <= FIXNUM_LENGTH) return (LONG_TO_FIXNUM (n1 << m)); else return (unsigned_long_to_shifted_bignum (n1, m, 0));