aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2021-12-01 13:00:11 -0800
committerJeremy Evans <code@jeremyevans.net>2021-12-01 16:21:50 -0800
commitfe1725236c8a4d6cb780874c470f7f443185ed38 (patch)
tree8e44e56fb8523753835e94c559d480ce24c27369 /numeric.c
parente387458da9b16ddfb57ab9e80d307727aefc2f56 (diff)
downloadruby-fe1725236c8a4d6cb780874c470f7f443185ed38.tar.gz
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]
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/numeric.c b/numeric.c
index 4492af5bb3..d126e16d29 100644
--- a/numeric.c
+++ b/numeric.c
@@ -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;