summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-10-07 07:44:18 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-10-07 07:44:18 +0000
commitdf2d56c03fd60d63fa5c2336186d4d80e08eb65c (patch)
treebc7d39a8e532aa5e577833f8b9afc4ec8cacdbe8
parent7da40cbcb8861029d2bd5e5b3454b29a86631a01 (diff)
downloadruby-df2d56c03fd60d63fa5c2336186d4d80e08eb65c.tar.gz
* 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
-rw-r--r--ChangeLog4
-rw-r--r--bignum.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index cf5a0d5d47..7a70a042eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* bignum.c (bigdivmod): wrong condition check for Bignum zero.
diff --git a/bignum.c b/bignum.c
index 0fa2233ebc..3cf4544cb4 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1217,10 +1217,10 @@ bigdivrem(x, y, divp, modp)
for (i = 0;i < j;i++) zds[i] = zds[i+ny];
RBIGNUM(*divp)->len = i;
}
- if (modp) { /* just normalize remainder */
+ if (modp) { /* normalize remainder */
*modp = rb_big_clone(z);
zds = BDIGITS(*modp);
- while (ny-- && !zds[ny]); ++ny;
+ while (--ny && !zds[ny]); ++ny;
if (dd) {
t2 = 0; i = ny;
while(i--) {