[前][次][番号順一覧][スレッド一覧]

ruby-changes:11448

From: akr <ko1@a...>
Date: Fri, 27 Mar 2009 01:21:08 +0900 (JST)
Subject: [ruby-changes:11448] Ruby:r23073 (trunk): * bignum.c (rb_cmpint): FIX2INT may fail on LP64 platforms.

akr	2009-03-27 01:20:58 +0900 (Fri, 27 Mar 2009)

  New Revision: 23073

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23073

  Log:
    * bignum.c (rb_cmpint): FIX2INT may fail on LP64 platforms.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23072)
+++ ChangeLog	(revision 23073)
@@ -1,3 +1,7 @@
+Fri Mar 27 01:19:50 2009  Tanaka Akira  <akr@f...>
+
+	* bignum.c (rb_cmpint): FIX2INT may fail on LP64 platforms.
+
 Thu Mar 26 12:22:06 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/yaml/rubytypes.rb (String#is_binary_data?): TAB would be
Index: bignum.c
===================================================================
--- bignum.c	(revision 23072)
+++ bignum.c	(revision 23073)
@@ -57,7 +57,12 @@
     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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]