diff options
Diffstat (limited to 'insns.def')
-rw-r--r-- | insns.def | 25 |
1 files changed, 17 insertions, 8 deletions
@@ -1430,20 +1430,29 @@ opt_mult { if (FIXNUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_MULT, FIXNUM_REDEFINED_OP_FLAG)) { - long a, b; - - a = FIX2LONG(recv); + long a = FIX2LONG(recv); if (a == 0) { val = recv; } else { - b = FIX2LONG(obj); - if (MUL_OVERFLOW_FIXNUM_P(a, b)) { +#ifdef HAVE_INT128_T + VALUE rb_int128t2big(int128_t n); + int128_t r = (int128_t)a * FIX2LONG(obj); + if (RB_FIXABLE(r)) { + val = LONG2FIX((long)r); + } + else { + val = rb_int128t2big(r); + } +#else + long b = FIX2LONG(obj); + if (MUL_OVERFLOW_FIXNUM_P(a, b)) { val = rb_big_mul(rb_int2big(a), rb_int2big(b)); - } - else { + } + else { val = LONG2FIX(a * b); - } + } +#endif } } else if (FLONUM_2_P(recv, obj) && |