diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-13 09:35:05 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-13 09:35:05 +0000 |
commit | db3b317ca74c075e49264bf21b71a85280a26890 (patch) | |
tree | 5389a07f4485628524de9b04badbc3915f431c7e | |
parent | 392d7a797a8fab2933d1eab96fee13d1457b4ff7 (diff) | |
download | ruby-db3b317ca74c075e49264bf21b71a85280a26890.tar.gz |
* bignum.c (bigdivrem): Use nlz.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | bignum.c | 7 |
2 files changed, 6 insertions, 5 deletions
@@ -1,3 +1,7 @@ +Thu Jun 13 18:34:20 2013 Tanaka Akira <akr@fsij.org> + + * bignum.c (bigdivrem): Use nlz. + Thu Jun 13 14:51:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> * include/ruby/ruby.h (RUBY_SAFE_LEVEL_CHECK): check constant safe @@ -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); |