summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
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 91c275e605..7f47cf6efb 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1258,10 +1258,10 @@ rb_big2ull(VALUE x)
unsigned LONG_LONG num = big2ull(x, "unsigned long long");
if (!RBIGNUM_SIGN(x)) {
- VALUE v = (VALUE)(-(SIGNED_VALUE)num);
+ LONG_LONG v = -num;
/* FIXNUM_MIN-1 .. LLONG_MIN mapped into 0xbfffffffffffffff .. LONG_MAX+1 */
- if (v <= LLONG_MAX)
+ if ((unsigned LONG_LONG)v <= LLONG_MAX)
rb_raise(rb_eRangeError, "bignum out of range of unsigned long long");
return v;
}