ruby-changes:29275
From: akr <ko1@a...>
Date: Sun, 16 Jun 2013 08:56:42 +0900 (JST)
Subject: [ruby-changes:29275] akr:r41327 (trunk): * bignum.c (bigdivrem): Use a BDIGIT variable to store the return
akr 2013-06-16 08:56:32 +0900 (Sun, 16 Jun 2013) New Revision: 41327 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41327 Log: * bignum.c (bigdivrem): Use a BDIGIT variable to store the return value of bigdivrem_single. Modified files: trunk/ChangeLog trunk/bignum.c Index: ChangeLog =================================================================== --- ChangeLog (revision 41326) +++ ChangeLog (revision 41327) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Jun 16 08:55:22 2013 Tanaka Akira <akr@f...> + + * bignum.c (bigdivrem): Use a BDIGIT variable to store the return + value of bigdivrem_single. + Sun Jun 16 08:43:59 2013 Tanaka Akira <akr@f...> * bignum.c (bary_divmod): New function. Index: bignum.c =================================================================== --- bignum.c (revision 41326) +++ bignum.c (revision 41327) @@ -3951,12 +3951,12 @@ bary_divmod(BDIGIT *qds, long nq, BDIGIT https://github.com/ruby/ruby/blob/trunk/bignum.c#L3951 MEMZERO(zds+nx, BDIGIT, nz-nx); if ((yds[ny-1] >> (BITSPERDIG-1)) & 1) { - /* digits_bigdivrem_multi_sub will not modify y. + /* bigdivrem_normal will not modify y. * So use yds directly. */ tds = yds; } else { - /* digits_bigdivrem_multi_sub will modify y. + /* bigdivrem_normal will modify y. * So use rds as a temporary buffer. */ MEMCPY(rds, yds, BDIGIT, ny); tds = rds; @@ -3986,7 +3986,6 @@ bigdivrem(VALUE x, VALUE y, volatile VAL https://github.com/ruby/ruby/blob/trunk/bignum.c#L3986 VALUE z, zz; VALUE tmpy = 0, tmpz = 0; BDIGIT *xds, *yds, *zds, *tds; - BDIGIT_DBL t2; BDIGIT dd; yds = BDIGITS(y); @@ -4006,9 +4005,9 @@ bigdivrem(VALUE x, VALUE y, volatile VAL https://github.com/ruby/ruby/blob/trunk/bignum.c#L4005 dd = yds[0]; z = bignew(nx, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y)); zds = BDIGITS(z); - t2 = bigdivrem_single(zds, xds, nx, dd); + dd = bigdivrem_single(zds, xds, nx, dd); if (modp) { - *modp = rb_uint2big((VALUE)t2); + *modp = rb_uint2big((VALUE)dd); RBIGNUM_SET_SIGN(*modp, RBIGNUM_SIGN(x)); } if (divp) *divp = z; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/