mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* bignum.c (bigdivrem): Reduce number of digits before bignew() for div.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
48bfbb574e
commit
2f407300fa
2 changed files with 6 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
|||
Fri Jun 14 20:47:41 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* bignum.c (bigdivrem): Reduce number of digits before bignew() for div.
|
||||
|
||||
Fri Jun 14 20:12:37 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* bignum.c (bigdivrem): Use bignew when ny == 1.
|
||||
|
|
4
bignum.c
4
bignum.c
|
@ -3848,11 +3848,11 @@ bigdivrem(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp)
|
|||
|
||||
if (divp) { /* move quotient down in z */
|
||||
j = nz - ny;
|
||||
while (0 < j && !zds[j-1+ny])
|
||||
j--;
|
||||
*divp = zz = bignew(j, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
|
||||
qds = BDIGITS(zz);
|
||||
for (i = 0;i < j;i++) qds[i] = zds[i+ny];
|
||||
if (!qds[i-1])
|
||||
RBIGNUM_SET_LEN(zz, i-1);
|
||||
}
|
||||
if (modp) { /* normalize remainder */
|
||||
while (ny > 1 && !zds[ny-1]) --ny;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue