summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--bignum.c5
2 files changed, 6 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index f18d6f7284..4610f51e9e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Jun 14 20:12:37 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (bigdivrem): Use bignew when ny == 1.
+
Fri Jun 14 18:52:51 2013 Koichi Sasada <ko1@atdot.net>
* compile.c (rb_iseq_compile_node): fix location of a `trace'
diff --git a/bignum.c b/bignum.c
index cada8d0658..ddb889a284 100644
--- a/bignum.c
+++ b/bignum.c
@@ -3777,15 +3777,14 @@ bigdivrem(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp)
}
if (ny == 1) {
dd = yds[0];
- z = rb_big_clone(x);
+ z = bignew(nx, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
zds = BDIGITS(z);
t2 = 0; i = nx;
while (i--) {
- t2 = BIGUP(t2) + zds[i];
+ t2 = BIGUP(t2) + xds[i];
zds[i] = (BDIGIT)(t2 / dd);
t2 %= dd;
}
- RBIGNUM_SET_SIGN(z, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
if (modp) {
*modp = rb_uint2big((VALUE)t2);
RBIGNUM_SET_SIGN(*modp, RBIGNUM_SIGN(x));