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:
parent
3e818c614d
commit
225e3b011f
3
range.c
3
range.c
@ -587,8 +587,9 @@ range_bsearch(VALUE range)
|
|||||||
* (-1...0.0).bsearch to yield -0.0.
|
* (-1...0.0).bsearch to yield -0.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define BSEARCH_CHECK(val) \
|
#define BSEARCH_CHECK(expr) \
|
||||||
do { \
|
do { \
|
||||||
|
VALUE val = (expr); \
|
||||||
VALUE v = rb_yield(val); \
|
VALUE v = rb_yield(val); \
|
||||||
if (FIXNUM_P(v)) { \
|
if (FIXNUM_P(v)) { \
|
||||||
if (FIX2INT(v) == 0) return val; \
|
if (FIX2INT(v) == 0) return val; \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user