[前][次][番号順一覧][スレッド一覧]

ruby-changes:29250

From: akr <ko1@a...>
Date: Fri, 14 Jun 2013 21:05:51 +0900 (JST)
Subject: [ruby-changes:29250] akr:r41302 (trunk): * bignum.c (bigdivrem): Reduce number of digits before bignew() for div.

akr	2013-06-14 21:05:38 +0900 (Fri, 14 Jun 2013)

  New Revision: 41302

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41302

  Log:
    * bignum.c (bigdivrem): Reduce number of digits before bignew() for div.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41301)
+++ ChangeLog	(revision 41302)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jun 14 20:47:41 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.c (bigdivrem): Reduce number of digits before bignew() for div.
+
 Fri Jun 14 20:12:37 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (bigdivrem): Use bignew when ny == 1.
Index: bignum.c
===================================================================
--- bignum.c	(revision 41301)
+++ bignum.c	(revision 41302)
@@ -3848,11 +3848,11 @@ bigdivrem(VALUE x, VALUE y, volatile VAL https://github.com/ruby/ruby/blob/trunk/bignum.c#L3848
 
     if (divp) {			/* move quotient down in z */
         j = nz - ny;
+	while (0 < j && !zds[j-1+ny])
+            j--;
 	*divp = zz = bignew(j, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
 	qds = BDIGITS(zz);
 	for (i = 0;i < j;i++) qds[i] = zds[i+ny];
-	if (!qds[i-1])
-            RBIGNUM_SET_LEN(zz, i-1);
     }
     if (modp) {			/* normalize remainder */
 	while (ny > 1 && !zds[ny-1]) --ny;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]