diff options
author | Jeremy Evans <[email protected]> | 2021-12-01 13:00:11 -0800 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2021-12-01 16:21:50 -0800 |
commit | fe1725236c8a4d6cb780874c470f7f443185ed38 (patch) | |
tree | 8e44e56fb8523753835e94c559d480ce24c27369 /numeric.c | |
parent | e387458da9b16ddfb57ab9e80d307727aefc2f56 (diff) |
Don't call + and < in Integer.times for !FIXNUM
The methods aren't called for FIXNUM, and it's best to have
consistent behavior.
Fixes [Bug #18377]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5199
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -5697,9 +5697,9 @@ int_dotimes(VALUE num) VALUE i = INT2FIX(0); for (;;) { - if (!RTEST(rb_funcall(i, '<', 1, num))) break; + if (!RTEST(int_le(i, num))) break; rb_yield(i); - i = rb_funcall(i, '+', 1, INT2FIX(1)); + i = rb_int_plus(i, INT2FIX(1)); } } return num; |