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

ruby-changes:29249

From: akr <ko1@a...>
Date: Fri, 14 Jun 2013 20:13:26 +0900 (JST)
Subject: [ruby-changes:29249] akr:r41301 (trunk): * bignum.c (bigdivrem): Use bignew when ny == 1.

akr	2013-06-14 20:13:16 +0900 (Fri, 14 Jun 2013)

  New Revision: 41301

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

  Log:
    * bignum.c (bigdivrem): Use bignew when ny == 1.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41300)
+++ ChangeLog	(revision 41301)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jun 14 20:12:37 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.c (bigdivrem): Use bignew when ny == 1.
+
 Fri Jun 14 18:52:51 2013  Koichi Sasada  <ko1@a...>
 
 	* compile.c (rb_iseq_compile_node): fix location of a `trace'
Index: bignum.c
===================================================================
--- bignum.c	(revision 41300)
+++ bignum.c	(revision 41301)
@@ -3777,15 +3777,14 @@ bigdivrem(VALUE x, VALUE y, volatile VAL https://github.com/ruby/ruby/blob/trunk/bignum.c#L3777
     }
     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));

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

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