summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-14 11:13:16 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-14 11:13:16 +0000
commit48bfbb574ea4112fdaf5d542a2c8d9918afd9237 (patch)
tree4e7f54209b8997fc2d9d8ea4fd93e18e2192260b /bignum.c
parentf41b284fab83ad067eead551e7e9b3d67b2a1e8e (diff)
* bignum.c (bigdivrem): Use bignew when ny == 1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c5
1 files changed, 2 insertions, 3 deletions
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));