ruby-changes:29223
From: akr <ko1@a...>
Date: Thu, 13 Jun 2013 18:35:20 +0900 (JST)
Subject: [ruby-changes:29223] akr:r41275 (trunk): * bignum.c (bigdivrem): Use nlz.
akr 2013-06-13 18:35:05 +0900 (Thu, 13 Jun 2013) New Revision: 41275 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41275 Log: * bignum.c (bigdivrem): Use nlz. Modified files: trunk/ChangeLog trunk/bignum.c Index: ChangeLog =================================================================== --- ChangeLog (revision 41274) +++ ChangeLog (revision 41275) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Jun 13 18:34:20 2013 Tanaka Akira <akr@f...> + + * bignum.c (bigdivrem): Use nlz. + Thu Jun 13 14:51:06 2013 Nobuyoshi Nakada <nobu@r...> * include/ruby/ruby.h (RUBY_SAFE_LEVEL_CHECK): check constant safe Index: bignum.c =================================================================== --- bignum.c (revision 41274) +++ bignum.c (revision 41275) @@ -3793,12 +3793,9 @@ bigdivrem(VALUE x, VALUE y, volatile VAL https://github.com/ruby/ruby/blob/trunk/bignum.c#L3793 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/