summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-10-23 05:38:24 (GMT)
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-11-10 02:14:15 (GMT)
commitb958e2add835d62c0a62edaf9a23ecbbd70a3635 (patch)
tree13a6f53e0fd2b6aae77d4ee7e206c2d8bc346f30 /enum.c
parent8b3653b484a1130987c6b774c71e69a4a64a4f27 (diff)
Removed canonicalization for mathn
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3691
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/enum.c b/enum.c
index 8a791cc..d21becd 100644
--- a/enum.c
+++ b/enum.c
@@ -3854,10 +3854,7 @@ sum_iter_normalize_memo(struct enum_sum_memo *memo)
memo->v = rb_fix_plus(LONG2FIX(memo->n), memo->v);
memo->n = 0;
- /* r can be an Integer when mathn is loaded */
switch (TYPE(memo->r)) {
- case T_FIXNUM: memo->v = rb_fix_plus(memo->r, memo->v); break;
- case T_BIGNUM: memo->v = rb_big_plus(memo->r, memo->v); break;
case T_RATIONAL: memo->v = rb_rational_plus(memo->r, memo->v); break;
case T_UNDEF: break;
default: UNREACHABLE; /* or ...? */
@@ -4107,13 +4104,7 @@ enum_sum(int argc, VALUE* argv, VALUE obj)
if (memo.n != 0)
memo.v = rb_fix_plus(LONG2FIX(memo.n), memo.v);
if (memo.r != Qundef) {
- /* r can be an Integer when mathn is loaded */
- if (FIXNUM_P(memo.r))
- memo.v = rb_fix_plus(memo.r, memo.v);
- else if (RB_TYPE_P(memo.r, T_BIGNUM))
- memo.v = rb_big_plus(memo.r, memo.v);
- else
- memo.v = rb_rational_plus(memo.r, memo.v);
+ memo.v = rb_rational_plus(memo.r, memo.v);
}
return memo.v;
}