diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-07 16:49:01 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-07 16:49:01 +0000 |
commit | 555035a349bb9d7659317dc65dc68ce6e2e6aaa7 (patch) | |
tree | d79f453904c3b2da3f277db2f6c34027e3410166 /insns.def | |
parent | b6f0a306a693d3b55b94db2a6035d1f4db80e465 (diff) |
merge revision(s) 40208: [Backport #8380]
* internal.h (MUL_OVERFLOW_SIGNED_INTEGER_P): New macro.
(MUL_OVERFLOW_FIXNUM_P): Ditto.
(MUL_OVERFLOW_LONG_P): Ditto.
* array.c (rb_ary_product): Don't overflow on signed integer
multiplication.
* numeric.c (fix_mul): Ditto.
(int_pow): Ditto.
* rational.c (f_imul): Ditto.
* insns.def (opt_mult): Ditto.
* thread.c (sleep_timeval): Don't overflow on signed integer addition.
* bignum.c (rb_int2big): Don't overflow on signed integer negation.
(rb_big2ulong): Ditto.
(rb_big2long): Ditto.
(rb_big2ull): Ditto.
(rb_big2ll): Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@40602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'insns.def')
-rw-r--r-- | insns.def | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -1418,16 +1418,13 @@ opt_mult val = recv; } else { - volatile long c; b = FIX2LONG(obj); - c = a * b; - - if (FIXABLE(c) && c / a == b) { - val = LONG2FIX(c); - } - else { + if (MUL_OVERFLOW_FIXNUM_P(a, b)) { val = rb_big_mul(rb_int2big(a), rb_int2big(b)); - } + } + else { + val = LONG2FIX(a * b); + } } } else if (FLONUM_2_P(recv, obj) && |