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:
parent
3e818c614d
commit
225e3b011f
1 changed files with 2 additions and 1 deletions
3
range.c
3
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; \
|
||||
|
|
Loading…
Reference in a new issue