summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-19 13:34:40 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-19 13:34:40 +0000
commit33f7764bbfcad692bbfb9ca0edf4594f58a9be5a (patch)
treeb271de3b964a9247a24624bb25cbea79e09e1350 /bignum.c
parent66ffd658fd1173de7ce24798b473d75407f83d2a (diff)
merges r23073 from trunk into ruby_1_9_1.
-- * bignum.c (rb_cmpint): FIX2INT may fail on LP64 platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@23226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/bignum.c b/bignum.c
index 35db091454..5a608774e7 100644
--- a/bignum.c
+++ b/bignum.c
@@ -56,7 +56,12 @@ rb_cmpint(VALUE val, VALUE a, VALUE b)
if (NIL_P(val)) {
rb_cmperr(a, b);
}
- if (FIXNUM_P(val)) return FIX2INT(val);
+ if (FIXNUM_P(val)) {
+ long l = FIX2LONG(val);
+ if (l > 0) return 1;
+ if (l < 0) return -1;
+ return 0;
+ }
if (TYPE(val) == T_BIGNUM) {
if (BIGZEROP(val)) return 0;
if (RBIGNUM_SIGN(val)) return 1;