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

ruby-changes:21724

From: usa <ko1@a...>
Date: Wed, 16 Nov 2011 13:54:05 +0900 (JST)
Subject: [ruby-changes:21724] usa:r33773 (trunk): * bignum.c (rb_big2ulong): need to calc in unsigned long, because

usa	2011-11-16 13:53:51 +0900 (Wed, 16 Nov 2011)

  New Revision: 33773

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

  Log:
    * bignum.c (rb_big2ulong): need to calc in unsigned long, because
      the range of VALUE is larger than it on LLP64 platform, such as Win64.
      this change fixes the failures of test/-ext-/num2int.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 33772)
+++ ChangeLog	(revision 33773)
@@ -1,3 +1,9 @@
+Wed Nov 16 13:51:40 2011  NAKAMURA Usaku  <usa@r...>
+
+	* bignum.c (rb_big2ulong): need to calc in unsigned long, because
+	  the range of VALUE is larger than it on LLP64 platform, such as Win64.
+	  this change fixes the failures of test/-ext-/num2int.
+
 Wed Nov 16 12:02:47 2011  NAKAMURA Usaku  <usa@r...>
 
 	* test/webrick/test_cgi.rb (TestWEBrickCGI#start_cgi_server): there are
Index: bignum.c
===================================================================
--- bignum.c	(revision 33772)
+++ bignum.c	(revision 33773)
@@ -1210,11 +1210,11 @@
     VALUE num = big2ulong(x, "unsigned long", TRUE);
 
     if (!RBIGNUM_SIGN(x)) {
-	VALUE v = (VALUE)(-(SIGNED_VALUE)num);
+	unsigned long v = (unsigned long)(-(long)num);
 
 	if (v <= LONG_MAX)
 	    rb_raise(rb_eRangeError, "bignum out of range of unsigned long");
-	return v;
+	return (VALUE)v;
     }
     return num;
 }

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

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