From 075cbd2ad6657b367ddb0919848fab4ce731ec20 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 27 Mar 2010 22:14:23 +0000 Subject: * time.c (mul): condition refined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- time.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'time.c') 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); } -- cgit v1.2.3