diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-07 06:34:29 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-07 06:34:29 +0000 |
commit | 30953338df004dba1b6ff5f532a359c881c74eff (patch) | |
tree | 2be7dc9a635b9ce09c722ffd8b3e69b81cafdeac /bignum.c | |
parent | cb0bb993f245a39fd91a5bb358b7cbb6a56099ea (diff) |
* 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/branches/ruby_1_8_6@13379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r-- | bignum.c | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -1544,8 +1544,8 @@ rb_big_remainder(x, y) return bignorm(z); } -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(x, n) VALUE x; @@ -1884,11 +1884,12 @@ VALUE rb_big_lshift(x, y) VALUE x, 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; @@ -1914,10 +1915,10 @@ rb_big_lshift(x, y) static VALUE big_lshift(x, shift) VALUE x; - unsigned int shift; + unsigned long shift; { BDIGIT *xds, *zds; - int s1 = shift/BITSPERDIG; + long s1 = shift/BITSPERDIG; int s2 = shift%BITSPERDIG; VALUE z; BDIGIT_DBL num = 0; @@ -1950,12 +1951,12 @@ VALUE rb_big_rshift(x, y) VALUE x, 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; @@ -1983,11 +1984,11 @@ rb_big_rshift(x, y) static VALUE big_rshift(x, shift) VALUE x; - unsigned int shift; + 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; |