diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-14 11:13:16 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-14 11:13:16 +0000 |
commit | 48bfbb574ea4112fdaf5d542a2c8d9918afd9237 (patch) | |
tree | 4e7f54209b8997fc2d9d8ea4fd93e18e2192260b | |
parent | f41b284fab83ad067eead551e7e9b3d67b2a1e8e (diff) | |
download | ruby-48bfbb574ea4112fdaf5d542a2c8d9918afd9237.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | bignum.c | 5 |
2 files changed, 6 insertions, 3 deletions
@@ -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' @@ -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)); |