summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-08 12:05:57 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-08 12:05:57 +0000
commit747894a32d6ea2b123b2abc292fd903c53a7aa36 (patch)
treec6a59d1b30a97c752b4367aa6ffb9050a609f74f /time.c
parentaf612be8e0e54ffa602cede04d355a1399a02b81 (diff)
* bignum.c (rb_absint_singlebit_p): New function.
* internal.h (rb_absint_singlebit_p): Declared. * time.c (v2w_bignum): Use rb_absint_singlebit_p instead of rb_big_abs_find_minbit. (rb_big_abs_find_minbit): Removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/time.c b/time.c
index 68c5384..86dfc9b 100644
--- a/time.c
+++ b/time.c
@@ -313,25 +313,6 @@ rb_big_abs_find_maxbit(VALUE big)
return res;
}
-static VALUE
-rb_big_abs_find_minbit(VALUE big)
-{
- BDIGIT *ds = RBIGNUM_DIGITS(big);
- BDIGIT d;
- long len = RBIGNUM_LEN(big);
- long i;
- VALUE res;
- for (i = 0; i < len; i++)
- if (ds[i])
- break;
- if (i == len)
- return Qnil;
- res = mul(LONG2NUM(i), INT2FIX(SIZEOF_BDIGITS * CHAR_BIT));
- d = ds[i];
- res = add(res, LONG2FIX(ffs(d)-1));
- return res;
-}
-
static wideval_t
v2w_bignum(VALUE v)
{
@@ -346,8 +327,7 @@ v2w_bignum(VALUE v)
return WINT2FIXWV(0);
if (lt(maxbit, INT2FIX(sizeof(wideint_t) * CHAR_BIT - 2)) ||
(eq(maxbit, INT2FIX(sizeof(wideint_t) * CHAR_BIT - 2)) &&
- RBIGNUM_NEGATIVE_P(v) &&
- eq(rb_big_abs_find_minbit(v), INT2FIX(sizeof(wideint_t) * CHAR_BIT - 2)))) {
+ RBIGNUM_NEGATIVE_P(v) && rb_absint_singlebit_p(v))) {
wideint_t i;
i = 0;
while (len)