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

ruby-changes:30717

From: akr <ko1@a...>
Date: Tue, 3 Sep 2013 12:36:26 +0900 (JST)
Subject: [ruby-changes:30717] akr:r42796 (trunk): Reduce NUM2INT invocations.

akr	2013-09-03 12:36:18 +0900 (Tue, 03 Sep 2013)

  New Revision: 42796

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

  Log:
    Reduce NUM2INT invocations.

  Modified files:
    trunk/ext/-test-/bignum/big2str.c
Index: ext/-test-/bignum/big2str.c
===================================================================
--- ext/-test-/bignum/big2str.c	(revision 42795)
+++ ext/-test-/bignum/big2str.c	(revision 42796)
@@ -18,7 +18,7 @@ big2str_generic(VALUE x, VALUE vbase) https://github.com/ruby/ruby/blob/trunk/ext/-test-/bignum/big2str.c#L18
     int base = NUM2INT(vbase);
     if (base < 2 || 36 < base)
         rb_raise(rb_eArgError, "invalid radix %d", base);
-    return rb_big2str_generic(big(x), NUM2INT(vbase));
+    return rb_big2str_generic(big(x), base);
 }
 
 #define POW2_P(x) (((x)&((x)-1))==0)
@@ -29,7 +29,7 @@ big2str_poweroftwo(VALUE x, VALUE vbase) https://github.com/ruby/ruby/blob/trunk/ext/-test-/bignum/big2str.c#L29
     int base = NUM2INT(vbase);
     if (base < 2 || 36 < base || !POW2_P(base))
         rb_raise(rb_eArgError, "invalid radix %d", base);
-    return rb_big2str_poweroftwo(big(x), NUM2INT(vbase));
+    return rb_big2str_poweroftwo(big(x), base);
 }
 
 #if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
@@ -39,7 +39,7 @@ big2str_gmp(VALUE x, VALUE vbase) https://github.com/ruby/ruby/blob/trunk/ext/-test-/bignum/big2str.c#L39
     int base = NUM2INT(vbase);
     if (base < 2 || 36 < base)
         rb_raise(rb_eArgError, "invalid radix %d", base);
-    return rb_big2str_gmp(big(x), NUM2INT(vbase));
+    return rb_big2str_gmp(big(x), base);
 }
 #else
 #define big2str_gmp rb_f_notimplement

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

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