summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-13 09:35:05 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-13 09:35:05 +0000
commitdb3b317ca74c075e49264bf21b71a85280a26890 (patch)
tree5389a07f4485628524de9b04badbc3915f431c7e /bignum.c
parent392d7a797a8fab2933d1eab96fee13d1457b4ff7 (diff)
* bignum.c (bigdivrem): Use nlz.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/bignum.c b/bignum.c
index 7086fe5724..42d0a74d6c 100644
--- a/bignum.c
+++ b/bignum.c
@@ -3793,12 +3793,9 @@ bigdivrem(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp)
if (nx==ny) zds[nx+1] = 0;
while (!yds[ny-1]) ny--;
- dd = 0;
q = yds[ny-1];
- while ((q & (BDIGIT)(1UL<<(BITSPERDIG-1))) == 0) {
- q <<= 1UL;
- dd++;
- }
+ dd = nlz(q);
+ q <<= dd;
if (dd) {
yy = rb_big_clone(y);
tds = BDIGITS(yy);