diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-20 11:10:43 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-20 11:10:43 +0000 |
commit | ad462024f7bca60770cd6a35c3b43302b3ffaead (patch) | |
tree | b1eb4a99925f0af72c38f2d35546a9597f0d51f2 /numeric.c | |
parent | 584a9e6fdee330789293ea2bb0438fc90c3a62ed (diff) | |
download | ruby-ad462024f7bca60770cd6a35c3b43302b3ffaead.tar.gz |
* internal.h (DLONG): defined if long is 32bit (and LONG_LONG is 64bit;
but LONG_LONG is always defined as 64bit), or there's int128_t.
* internal.h (DL2NUM): defined if DLONG is defined.
* internal.h (rb_fix_mul_fix): defined for `Fixnum * Fixnum`.
* insns.def (opt_mul): use rb_fix_mul_fix().
* numeric.c (fix_mul): ditto.
* time.c (mul): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 27 |
1 files changed, 1 insertions, 26 deletions
@@ -3085,32 +3085,7 @@ static VALUE fix_mul(VALUE x, VALUE y) { if (FIXNUM_P(y)) { -#ifdef __HP_cc -/* avoids an optimization bug of HP aC++/ANSI C B3910B A.06.05 [Jul 25 2005] */ - volatile -#endif - long a, b; -#if SIZEOF_LONG * 2 <= SIZEOF_LONG_LONG - LONG_LONG d; -#else - VALUE r; -#endif - - a = FIX2LONG(x); - b = FIX2LONG(y); - -#if SIZEOF_LONG * 2 <= SIZEOF_LONG_LONG - d = (LONG_LONG)a * b; - if (FIXABLE(d)) return LONG2FIX(d); - return rb_ll2inum(d); -#else - if (a == 0) return x; - if (MUL_OVERFLOW_FIXNUM_P(a, b)) - r = rb_big_mul(rb_int2big(a), rb_int2big(b)); - else - r = LONG2FIX(a * b); - return r; -#endif + return rb_fix_mul_fix(x, y); } else if (RB_TYPE_P(y, T_BIGNUM)) { return rb_big_mul(y, x); |