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

ruby-changes:37146

From: nobu <ko1@a...>
Date: Tue, 13 Jan 2015 12:47:56 +0900 (JST)
Subject: [ruby-changes:37146] nobu:r49227 (trunk): range.c: reduce argument evaluations

nobu	2015-01-13 12:47:41 +0900 (Tue, 13 Jan 2015)

  New Revision: 49227

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

  Log:
    range.c: reduce argument evaluations
    
    * range.c (BSEARCH_CHECK): get rid of conversion of the argument
      multiple times.

  Modified files:
    trunk/range.c
Index: range.c
===================================================================
--- range.c	(revision 49226)
+++ range.c	(revision 49227)
@@ -587,8 +587,9 @@ range_bsearch(VALUE range) https://github.com/ruby/ruby/blob/trunk/range.c#L587
      * (-1...0.0).bsearch to yield -0.0.
      */
 
-#define BSEARCH_CHECK(val) \
+#define BSEARCH_CHECK(expr) \
     do { \
+	VALUE val = (expr); \
 	VALUE v = rb_yield(val); \
 	if (FIXNUM_P(v)) { \
 	    if (FIX2INT(v) == 0) return val; \

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

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