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

ruby-changes:27939

From: akr <ko1@a...>
Date: Fri, 29 Mar 2013 06:50:16 +0900 (JST)
Subject: [ruby-changes:27939] akr:r39991 (trunk): * numeric.c (rb_num2ull): Cast double to unsigned LONG_LONG via

akr	2013-03-29 06:49:55 +0900 (Fri, 29 Mar 2013)

  New Revision: 39991

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

  Log:
    * numeric.c (rb_num2ull): Cast double to unsigned LONG_LONG via
      LONG_LONG instead of double to unsigned LONG_LONG directly.
      This is a challenge to fix a test_num2ull(TestNum2int)
      failure (NUM2ULL(-1.0) should be "18446744073709551615" but was "0")
      on Mac OS X with 32bit clang.
      http://a.mrkn.jp/~mrkn/chkbuild/mountain_lion/ruby-trunk-m32-o0/log/20130328T191100Z.diff.html.gz

  Modified files:
    trunk/ChangeLog
    trunk/numeric.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39990)
+++ ChangeLog	(revision 39991)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Mar 29 06:39:42 2013  Tanaka Akira  <akr@f...>
+
+	* numeric.c (rb_num2ull): Cast double to unsigned LONG_LONG via
+	  LONG_LONG instead of double to unsigned LONG_LONG directly.
+	  This is a challenge to fix a test_num2ull(TestNum2int)
+	  failure (NUM2ULL(-1.0) should be "18446744073709551615" but was "0")
+	  on Mac OS X with 32bit clang.
+	  http://a.mrkn.jp/~mrkn/chkbuild/mountain_lion/ruby-trunk-m32-o0/log/20130328T191100Z.diff.html.gz
+
 Fri Mar 29 00:54:54 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/mkmf.rb (MAIN_DOES_NOTHING): ensure symbols for tests to be
Index: numeric.c
===================================================================
--- numeric.c	(revision 39990)
+++ numeric.c	(revision 39991)
@@ -2258,7 +2258,7 @@ rb_num2ull(VALUE val) https://github.com/ruby/ruby/blob/trunk/numeric.c#L2258
       case T_FLOAT:
 	if (RFLOAT_VALUE(val) < ULLONG_MAX_PLUS_ONE
             && LLONG_MIN_MINUS_ONE_IS_LESS_THAN(RFLOAT_VALUE(val))) {
-	    return (unsigned LONG_LONG)(RFLOAT_VALUE(val));
+	    return (unsigned LONG_LONG)(LONG_LONG)(RFLOAT_VALUE(val));
 	}
 	else {
 	    char buf[24];

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

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