summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-16 04:09:02 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-16 04:09:02 +0000
commit02c581be74aba5d5d509717c78e89b60b49421bf (patch)
treeacc30757c245aa38b943489cbab46c0213de0572 /bignum.c
parente7e1b3a2d69abe7a85ecd82491f271f5ddfe73f6 (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/trunk@13059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c21
1 files changed, 11 insertions, 10 deletions
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;