diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-27 22:14:23 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-27 22:14:23 +0000 |
commit | 075cbd2ad6657b367ddb0919848fab4ce731ec20 (patch) | |
tree | e073a94638d9932e08a5dbf270367f3f20b4b473 | |
parent | d5c005fd3611070f57b77f30bfeb4404e9550ea6 (diff) | |
download | ruby-075cbd2ad6657b367ddb0919848fab4ce731ec20.tar.gz |
* time.c (mul): condition refined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-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); } |