summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-11 05:00:02 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-11 05:00:02 +0000
commit4bacdc1e46ab788f9285ccd8eccd2776260f9528 (patch)
treea603c9435fcf3c432ecc1389be508a3aaa7cd4ca /bignum.c
parentfd66442a1d8cec73a14601f8056b9fad238f92be (diff)
* bignum.c (bignorm): sizeof(long) may be smaller than
sizeof(VALUE). [ruby-dev:29013] * ruby.h (FIXNUM_MAX): fixnum may be bigger than long. * ruby.h (SIGNED_VALUE): signed integer of size of VALUE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/bignum.c b/bignum.c
index f1e4bf9..c51f161 100644
--- a/bignum.c
+++ b/bignum.c
@@ -103,7 +103,7 @@ bignorm(VALUE x)
RBIGNUM(x)->len = ++len;
if (len*SIZEOF_BDIGITS <= sizeof(VALUE)) {
- long num = 0;
+ SIGNED_VALUE num = 0;
while (len--) {
num = BIGUP(num) + ds[len];
}
@@ -125,7 +125,7 @@ rb_big_norm(VALUE x)
}
VALUE
-rb_uint2big(unsigned long n)
+rb_uint2big(VALUE n)
{
BDIGIT_DBL num = n;
long i = 0;
@@ -146,7 +146,7 @@ rb_uint2big(unsigned long n)
}
VALUE
-rb_int2big(long n)
+rb_int2big(SIGNED_VALUE n)
{
long neg = 0;
VALUE big;
@@ -163,14 +163,14 @@ rb_int2big(long n)
}
VALUE
-rb_uint2inum(unsigned long n)
+rb_uint2inum(VALUE n)
{
if (POSFIXABLE(n)) return LONG2FIX(n);
return rb_uint2big(n);
}
VALUE
-rb_int2inum(long n)
+rb_int2inum(SIGNED_VALUE n)
{
if (FIXABLE(n)) return LONG2FIX(n);
return rb_int2big(n);
@@ -1236,7 +1236,7 @@ bigdivrem(VALUE x, VALUE y, VALUE *divp, VALUE *modp)
}
RBIGNUM(z)->sign = RBIGNUM(x)->sign==RBIGNUM(y)->sign;
if (modp) {
- *modp = rb_uint2big((unsigned long)t2);
+ *modp = rb_uint2big((VALUE)t2);
RBIGNUM(*modp)->sign = RBIGNUM(x)->sign;
}
if (divp) *divp = z;