From 02c581be74aba5d5d509717c78e89b60b49421bf Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 16 Aug 2007 04:09:02 +0000 Subject: [PATCH] * bignum.c (big_lshift): make shift offset long type. (big_rshift): ditto. (rb_big_lshift): ditto. (big_rshift): ditto. [ruby-dev:31434] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ bignum.c | 21 +++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index e7b5aa608d..b5183cd4fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Aug 16 13:06:08 2007 Tanaka Akira + + * bignum.c (big_lshift): make shift offset long type. + (big_rshift): ditto. + (rb_big_lshift): ditto. + (big_rshift): ditto. + [ruby-dev:31434] + Thu Aug 16 06:29:08 2007 Nobuyoshi Nakada * io.c (argf_readpartial): argf_forward needs argc and argv. diff --git a/bignum.c b/bignum.c index c33bbaba70..fc7329b5e5 100644 --- a/bignum.c +++ b/bignum.c @@ -1730,8 +1730,8 @@ bdigbitsize(BDIGIT x) return size; } -static VALUE big_lshift(VALUE, unsigned int); -static VALUE big_rshift(VALUE, unsigned int); +static VALUE big_lshift(VALUE, unsigned long); +static VALUE big_rshift(VALUE, unsigned long); static VALUE big_shift(VALUE x, int n) { @@ -2103,11 +2103,12 @@ check_shiftdown(VALUE y, VALUE x) VALUE rb_big_lshift(VALUE x, VALUE y) { - int shift, neg = 0; + long shift; + int neg = 0; for (;;) { if (FIXNUM_P(y)) { - shift = FIX2INT(y); + shift = FIX2LONG(y); if (shift < 0) { neg = 1; shift = -shift; @@ -2131,10 +2132,10 @@ rb_big_lshift(VALUE x, VALUE y) } static VALUE -big_lshift(VALUE x, unsigned int shift) +big_lshift(VALUE x, unsigned long shift) { BDIGIT *xds, *zds; - int s1 = shift/BITSPERDIG; + long s1 = shift/BITSPERDIG; int s2 = shift%BITSPERDIG; VALUE z; BDIGIT_DBL num = 0; @@ -2166,12 +2167,12 @@ big_lshift(VALUE x, unsigned int shift) VALUE rb_big_rshift(VALUE x, VALUE y) { - int shift; + long shift; int neg = 0; for (;;) { if (FIXNUM_P(y)) { - shift = FIX2INT(y); + shift = FIX2LONG(y); if (shift < 0) { neg = 1; shift = -shift; @@ -2197,11 +2198,11 @@ rb_big_rshift(VALUE x, VALUE y) } static VALUE -big_rshift(VALUE x, unsigned int shift) +big_rshift(VALUE x, unsigned long shift) { BDIGIT *xds, *zds; long s1 = shift/BITSPERDIG; - long s2 = shift%BITSPERDIG; + int s2 = shift%BITSPERDIG; VALUE z; BDIGIT_DBL num = 0; long i, j;