diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-26 16:20:58 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-26 16:20:58 +0000 |
commit | 5f64ea6c6011ef3c37cb9d36e1958d0008969c30 (patch) | |
tree | 851d070ee43222d2fd810026bcebaebc05032cc2 /bignum.c | |
parent | 598684944857eac0113fb2ae8e33d3be66931b65 (diff) | |
download | ruby-5f64ea6c6011ef3c37cb9d36e1958d0008969c30.tar.gz |
* bignum.c (rb_cmpint): FIX2INT may fail on LP64 platforms.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r-- | bignum.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -57,7 +57,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; |