summaryrefslogtreecommitdiff
path: root/range.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-13 03:47:41 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-13 03:47:41 (GMT)
commit225e3b011fca20bf679b10ab310a1435fc270c4e (patch)
tree919ab5697c2e7ffa9c42a8b55b4bff728e42863d /range.c
parent3e818c614d8ab6eef4f53c57148d09c1844efcf4 (diff)
range.c: reduce argument evaluations
* range.c (BSEARCH_CHECK): get rid of conversion of the argument multiple times. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'range.c')
-rw-r--r--range.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/range.c b/range.c
index f4ab7e1..ae16ae4 100644
--- a/range.c
+++ b/range.c
@@ -587,8 +587,9 @@ range_bsearch(VALUE range)
* (-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; \