diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-16 04:09:02 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-16 04:09:02 +0000 |
| commit | 5d9430495cafdadd15ca6560e4df22836fbd7c21 (patch) | |
| tree | acc30757c245aa38b943489cbab46c0213de0572 | |
| parent | c71f4b5ca40130c64f9f3bd33be8aba0da0c92ef (diff) | |
| download | ruby-5d9430495cafdadd15ca6560e4df22836fbd7c21.tar.gz ruby-5d9430495cafdadd15ca6560e4df22836fbd7c21.tar.xz ruby-5d9430495cafdadd15ca6560e4df22836fbd7c21.zip | |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@13059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 8 | ||||
| -rw-r--r-- | bignum.c | 21 |
2 files changed, 19 insertions, 10 deletions
@@ -1,3 +1,11 @@ +Thu Aug 16 13:06:08 2007 Tanaka Akira <akr@fsij.org> + + * 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 <nobu@ruby-lang.org> * io.c (argf_readpartial): argf_forward needs argc and argv. @@ -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; |
