diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-07 04:53:13 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-07 04:53:13 +0000 |
commit | c7a84b8c11792d6d71ff4ece5cc9df43fbddafcd (patch) | |
tree | 41f7560ad18fa121926b63346112338da8661014 /bignum.c | |
parent | 69a3a92be9d8143e8102c1ec3e87c01193712524 (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_5@13355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r-- | bignum.c | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -1509,8 +1509,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; @@ -1847,11 +1847,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; @@ -1877,10 +1878,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; @@ -1913,12 +1914,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; @@ -1946,11 +1947,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; |