summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-16 04:58:06 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-16 04:58:06 +0000
commitea4ddd4b181061a543d04083f4b62226dc56ab92 (patch)
tree5697504410fd101ac6a88e558bfd0fa78be6758c /bignum.c
parent72628d92ee9d9c45e1ccc1d679cc9a7605e3f49d (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@13061 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 38717e4257..e49a18b118 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1577,8 +1577,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(x, n)
VALUE x;
@@ -1986,11 +1986,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;
@@ -2016,10 +2017,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;
@@ -2052,12 +2053,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;
@@ -2085,11 +2086,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;