зеркало из https://github.com/github/ruby.git
* bignum.c (bigdivrem_restoring): Use bigdivrem_single if non-topmost
BDIGITs of y are zero. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
7fc4142a02
Коммит
49e8387bae
|
@ -1,3 +1,8 @@
|
|||
Fri Aug 16 01:09:33 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* bignum.c (bigdivrem_restoring): Use bigdivrem_single if non-topmost
|
||||
BDIGITs of y are zero.
|
||||
|
||||
Fri Aug 16 00:33:12 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* bignum.c (rb_big2str1): Truncate topmost zeros of x.
|
||||
|
|
10
bignum.c
10
bignum.c
|
@ -2704,6 +2704,16 @@ bigdivrem_restoring(BDIGIT *zds, size_t zn, BDIGIT *yds, size_t yn)
|
|||
assert(BDIGIT_MSB(yds[yn-1]));
|
||||
|
||||
for (ynzero = 0; !yds[ynzero]; ynzero++);
|
||||
|
||||
if (ynzero+1 == yn) {
|
||||
BDIGIT r;
|
||||
r = bigdivrem_single(zds+ynzero, zds+ynzero, zn-ynzero, yds[yn-1]);
|
||||
assert(zds[zn-1] == 0);
|
||||
MEMMOVE(zds+yn, zds+yn-1, BDIGIT, zn - yn);
|
||||
zds[yn-1] = r;
|
||||
return;
|
||||
}
|
||||
|
||||
bds.yn = yn - ynzero;
|
||||
bds.zds = zds + ynzero;
|
||||
bds.yds = yds + ynzero;
|
||||
|
|
Загрузка…
Ссылка в новой задаче