summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-27 22:14:23 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-27 22:14:23 +0000
commit075cbd2ad6657b367ddb0919848fab4ce731ec20 (patch)
treee073a94638d9932e08a5dbf270367f3f20b4b473 /time.c
parentd5c005fd3611070f57b77f30bfeb4404e9550ea6 (diff)
* time.c (mul): condition refined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/time.c b/time.c
index 96f995b329..c96756da0f 100644
--- a/time.c
+++ b/time.c
@@ -252,18 +252,22 @@ mul(VALUE x, VALUE y)
if (FIXNUM_P(x) && FIXNUM_P(y)) {
#if HAVE_LONG_LONG && SIZEOF_LONG * 2 <= SIZEOF_LONG_LONG
LONG_LONG ll = (LONG_LONG)FIX2LONG(x) * FIX2LONG(y);
- if (FIXABLE(ll)) return LONG2FIX(ll);
+ if (FIXABLE(ll))
+ return LONG2FIX(ll);
return LL2NUM(ll);
#else
long a, b, c;
a = FIX2LONG(x);
- if (a == 0) return x;
+ if (a == 0)
+ return x;
b = FIX2LONG(y);
c = a * b;
- if (c / a == b && FIXABLE(c)) return LONG2FIX(c);
+ if (c / a == b)
+ return LONG2NUM(c);
#endif
}
- if (TYPE(x) == T_BIGNUM) return rb_big_mul(x, y);
+ if (TYPE(x) == T_BIGNUM)
+ return rb_big_mul(x, y);
return rb_funcall(x, '*', 1, y);
}