aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-20 11:10:43 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-20 11:10:43 +0000
commit148f1b9d57d06923796fff5200db140a69af6d20 (patch)
treeb1eb4a99925f0af72c38f2d35546a9597f0d51f2 /numeric.c
parent57638377cc22ed7b677f9826f79988ffb9451e5a (diff)
downloadruby-148f1b9d57d06923796fff5200db140a69af6d20.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.c27
1 files changed, 1 insertions, 26 deletions
diff --git a/numeric.c b/numeric.c
index 4293374a64..f95e93c179 100644
--- a/numeric.c
+++ b/numeric.c
@@ -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);