1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2015-01-13 03:47:41 +00:00
parent 3e818c614d
commit 225e3b011f

View file

@ -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; \