diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | time.c | 12 |
2 files changed, 13 insertions, 5 deletions
@@ -1,4 +1,8 @@ -2010-03-27 Tanaka Akira <akr@fsij.org> +Sun Mar 28 07:12:41 2010 Tanaka Akira <akr@fsij.org> + + * time.c (mul): condition refined. + +Sun Mar 28 02:14:13 2010 Tanaka Akira <akr@fsij.org> * time.c: fix previos commit. @@ -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); } |