summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-16 04:53:51 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-16 04:53:51 +0000
commit4a997526e02554b48cf002a8dc20df8c4560f69a (patch)
treee276072bffdecf7fa1fccdc17b6810be65fd600d /bignum.c
parent2a445945081d71aec08ec0a9d67e4384821e0b3a (diff)
* bignum.c (rb_big2ulong): need to calc in unsigned long, because
the range of VALUE is larger than it on LLP64 platform, such as Win64. this change fixes the failures of test/-ext-/num2int. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bignum.c b/bignum.c
index a1c4ac78a0..2d61bb37c0 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1210,11 +1210,11 @@ rb_big2ulong(VALUE x)
VALUE num = big2ulong(x, "unsigned long", TRUE);
if (!RBIGNUM_SIGN(x)) {
- VALUE v = (VALUE)(-(SIGNED_VALUE)num);
+ unsigned long v = (unsigned long)(-(long)num);
if (v <= LONG_MAX)
rb_raise(rb_eRangeError, "bignum out of range of unsigned long");
- return v;
+ return (VALUE)v;
}
return num;
}