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

ruby-changes:32832

From: akr <ko1@a...>
Date: Wed, 12 Feb 2014 03:00:57 +0900 (JST)
Subject: [ruby-changes:32832] akr:r44912 (trunk): * ext/bigdecimal/bigdecimal.c (BigMath_s_log): Use rb_big_cmp instead of

akr	2014-02-11 23:55:37 +0900 (Tue, 11 Feb 2014)

  New Revision: 44912

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

  Log:
    * ext/bigdecimal/bigdecimal.c (BigMath_s_log): Use rb_big_cmp instead of
      RBIGNUM_NEGATIVE_P.

  Modified files:
    trunk/ChangeLog
    trunk/ext/bigdecimal/bigdecimal.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44911)
+++ ChangeLog	(revision 44912)
@@ -1,9 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Tue Feb 11 23:42:27 2014  Tanaka Akira  <akr@f...>
+Tue Feb 11 23:54:40 2014  Tanaka Akira  <akr@f...>
 
 	* bignum.c (rb_big_cmp): Specialize a comparison to zero.
 
 	* ext/bigdecimal/bigdecimal.c (is_negative): Use rb_big_cmp instead of
 	  RBIGNUM_NEGATIVE_P.
+	  (BigMath_s_log): Ditto.
 
 Tue Feb 11 22:59:10 2014  Tanaka Akira  <akr@f...>
 
Index: ext/bigdecimal/bigdecimal.c
===================================================================
--- ext/bigdecimal/bigdecimal.c	(revision 44911)
+++ ext/bigdecimal/bigdecimal.c	(revision 44912)
@@ -2874,8 +2874,9 @@ BigMath_s_log(VALUE klass, VALUE x, VALU https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2874
 	goto get_vp_value;
 
       case T_BIGNUM:
-	zero = RBIGNUM_ZERO_P(x);
-	negative = RBIGNUM_NEGATIVE_P(x);
+        i = FIX2INT(rb_big_cmp(x, INT2FIX(0)));
+	zero = i == 0;
+	negative = i < 0;
 get_vp_value:
 	if (zero || negative) break;
 	vx = GetVpValue(x, 0);

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

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