summaryrefslogtreecommitdiff
path: root/enumerator.c
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-21 00:03:39 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-21 00:03:39 +0000
commit09b3d38c724f8e12efe69ea5ee0942335b100764 (patch)
tree2e90bae85522063c406827b2c6791c6c18943e83 /enumerator.c
parentccdba542d3f765895a23f32fd2905add935b7a19 (diff)
enumerator.c: Fix airth_seq_each for Rational
Fix the wrong uses of rb_int_ge in arith_seq_each. [ruby-core:90648] [Bug #15444] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enumerator.c')
-rw-r--r--enumerator.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/enumerator.c b/enumerator.c
index d2d3b29369..338a9e7584 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -3030,6 +3030,8 @@ arith_seq_hash(VALUE self)
return LONG2FIX(hash);
}
+#define NUM_GE(x, y) RTEST(rb_num_coerce_relop((x), (y), idGE))
+
struct arith_seq_gen {
VALUE current;
VALUE end;
@@ -3083,13 +3085,13 @@ arith_seq_each(VALUE self)
}
if (rb_num_negative_int_p(s)) {
- while (RTEST(rb_int_ge(c, last))) {
+ while (NUM_GE(c, last)) {
rb_yield(c);
c = rb_int_plus(c, s);
}
}
else {
- while (RTEST(rb_int_ge(last, c))) {
+ while (NUM_GE(last, c)) {
rb_yield(c);
c = rb_int_plus(c, s);
}