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

ruby-changes:7772

From: matz <ko1@a...>
Date: Thu, 11 Sep 2008 15:34:18 +0900 (JST)
Subject: [ruby-changes:7772] Ruby:r19293 (trunk): * bignum.c (bigdivrem): adjust length for division and remainder.

matz	2008-09-11 15:30:56 +0900 (Thu, 11 Sep 2008)

  New Revision: 19293

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

  Log:
    * bignum.c (bigdivrem): adjust length for division and remainder.
      a patch from TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com> in 
      [ruby-dev:36231].

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19292)
+++ ChangeLog	(revision 19293)
@@ -1,3 +1,9 @@
+Thu Sep 11 15:23:26 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* bignum.c (bigdivrem): adjust length for division and remainder.
+	  a patch from TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com> in 
+	  [ruby-dev:36231].
+
 Thu Sep 11 02:59:47 2008  Tanaka Akira  <akr@f...>
 
 	* io.c (io_binwrite): extracted from io_fwrite.
Index: bignum.c
===================================================================
--- bignum.c	(revision 19292)
+++ bignum.c	(revision 19293)
@@ -1749,6 +1749,7 @@
 	zds = BDIGITS(*divp);
 	j = (nx==ny ? nx+2 : nx+1) - ny;
 	for (i = 0;i < j;i++) zds[i] = zds[i+ny];
+	if (!zds[i-1]) i--;
 	RBIGNUM_SET_LEN(*divp, i);
     }
     if (modp) {			/* normalize remainder */
@@ -1764,6 +1765,7 @@
 		t2 = BIGUP(q);
 	    }
 	}
+	if (!zds[ny-1]) ny--;
 	RBIGNUM_SET_LEN(*modp, ny);
 	RBIGNUM_SET_SIGN(*modp, RBIGNUM_SIGN(x));
     }

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

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