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
This commit is contained in:
yugui 2009-04-19 13:34:40 +00:00
parent 66ffd658fd
commit 33f7764bbf
2 changed files with 10 additions and 1 deletions

View file

@ -1,3 +1,7 @@
Fri Mar 27 01:19:50 2009 Tanaka Akira <akr@fsij.org>
* bignum.c (rb_cmpint): FIX2INT may fail on LP64 platforms.
Fri Mar 13 21:11:51 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
* ext/sdbm/_sdbm.c: should include "ruby/defines.h" as well for

View file

@ -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;