1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* time.c (rb_big_abs_find_minbit): fix handling the last word.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-03-31 19:56:04 +00:00
parent e758c3fbce
commit c97f5f514a
3 changed files with 7 additions and 1 deletions

View file

@ -1,3 +1,7 @@
Thu Apr 1 04:55:08 2010 Tanaka Akira <akr@fsij.org>
* time.c (rb_big_abs_find_minbit): fix handling the last word.
Thu Apr 1 04:30:11 2010 Tanaka Akira <akr@fsij.org>
* time.c (long_mul): overflow condition changed.

View file

@ -181,6 +181,8 @@ class TestTime < Test::Unit::TestCase
assert_equal(-146138510344, t.year)
t = Time.at(-0x5000_0000_0000_0001)
assert_equal(-182673138422, t.year)
t = Time.at(-0x6000_0000_0000_0000)
assert_equal(-219207766501, t.year)
end
def test_at2

2
time.c
View file

@ -343,7 +343,7 @@ rb_big_abs_find_minbit(VALUE big)
return Qnil;
res = mul(LONG2NUM(i), INT2FIX(SIZEOF_BDIGITS * CHAR_BIT));
d = ds[i];
res = add(res, LONG2FIX(bdigit_find_maxbit(d)));
res = add(res, LONG2FIX(bdigit_find_maxbit(d & -d)));
return res;
}