1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* bignum.c (bigdivrem): bignum zero's len should not be 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2002-10-07 07:44:18 +00:00
parent 7da40cbcb8
commit df2d56c03f
2 changed files with 6 additions and 2 deletions

View file

@ -1,3 +1,7 @@
Mon Oct 7 16:43:07 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* bignum.c (bigdivrem): bignum zero's len should not be 0.
Mon Oct 7 15:36:42 2002 Yukihiro Matsumoto <matz@ruby-lang.org> Mon Oct 7 15:36:42 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* bignum.c (bigdivmod): wrong condition check for Bignum zero. * bignum.c (bigdivmod): wrong condition check for Bignum zero.

View file

@ -1217,10 +1217,10 @@ bigdivrem(x, y, divp, modp)
for (i = 0;i < j;i++) zds[i] = zds[i+ny]; for (i = 0;i < j;i++) zds[i] = zds[i+ny];
RBIGNUM(*divp)->len = i; RBIGNUM(*divp)->len = i;
} }
if (modp) { /* just normalize remainder */ if (modp) { /* normalize remainder */
*modp = rb_big_clone(z); *modp = rb_big_clone(z);
zds = BDIGITS(*modp); zds = BDIGITS(*modp);
while (ny-- && !zds[ny]); ++ny; while (--ny && !zds[ny]); ++ny;
if (dd) { if (dd) {
t2 = 0; i = ny; t2 = 0; i = ny;
while(i--) { while(i--) {