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

ruby-changes:29477

From: akr <ko1@a...>
Date: Fri, 21 Jun 2013 19:09:45 +0900 (JST)
Subject: [ruby-changes:29477] akr:r41529 (trunk): * bignum.c (bigsub_int): Use bdigit_roomof.

akr	2013-06-21 19:09:34 +0900 (Fri, 21 Jun 2013)

  New Revision: 41529

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

  Log:
    * bignum.c (bigsub_int): Use bdigit_roomof.
      (bigadd_int): Ditto.
      (bigand_int): Ditto.
      (bigor_int): Ditto.
      (bigxor_int): Ditto.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41528)
+++ ChangeLog	(revision 41529)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jun 21 18:56:58 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.c (bigsub_int): Use bdigit_roomof.
+	  (bigadd_int): Ditto.
+	  (bigand_int): Ditto.
+	  (bigor_int): Ditto.
+	  (bigxor_int): Ditto.
+
 Fri Jun 21 17:56:25 2013  Koichi Sasada  <ko1@a...>
 
 	* benchmark/gc/gcbench.rb: fix summary of benchmark result notaton.
Index: bignum.c
===================================================================
--- bignum.c	(revision 41528)
+++ bignum.c	(revision 41529)
@@ -2975,7 +2975,7 @@ bigsub_int(VALUE x, long y0) https://github.com/ruby/ruby/blob/trunk/bignum.c#L2975
     i = 1;
 #else
     num = 0;
-    for (i=0; i<(int)(sizeof(y)/SIZEOF_BDIGITS); i++) {
+    for (i=0; i<bdigit_roomof(SIZEOF_LONG); i++) {
 	num += (BDIGIT_DBL_SIGNED)xds[i] - BIGLO(y);
 	zds[i] = BIGLO(num);
 	num = BIGDN(num);
@@ -3026,7 +3026,7 @@ bigadd_int(VALUE x, long y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L3026
     i = 1;
 #else
     num = 0;
-    for (i=0; i<(int)(sizeof(y)/SIZEOF_BDIGITS); i++) {
+    for (i=0; i<bdigit_roomof(SIZEOF_LONG); i++) {
 	num += (BDIGIT_DBL)xds[i] + BIGLO(y);
 	zds[i] = BIGLO(num);
 	num = BIGDN(num);
@@ -4439,7 +4439,7 @@ bigand_int(VALUE x, long y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4439
     {
 	BDIGIT_DBL num = y;
 
-	for (i=0; i<(int)(sizeof(y)/SIZEOF_BDIGITS); i++) {
+	for (i=0; i<bdigit_roomof(SIZEOF_LONG); i++) {
 	    zds[i] = xds[i] & BIGLO(num);
 	    num = BIGDN(num);
 	}
@@ -4535,7 +4535,7 @@ bigor_int(VALUE x, long y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4535
     {
 	BDIGIT_DBL num = y;
 
-	for (i=0; i<(int)(sizeof(y)/SIZEOF_BDIGITS); i++) {
+	for (i=0; i<bdigit_roomof(SIZEOF_LONG); i++) {
 	    zds[i] = xds[i] | BIGLO(num);
 	    num = BIGDN(num);
 	}
@@ -4631,7 +4631,7 @@ bigxor_int(VALUE x, long y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4631
     {
 	BDIGIT_DBL num = y;
 
-	for (i=0; i<(int)(sizeof(y)/SIZEOF_BDIGITS); i++) {
+	for (i=0; i<bdigit_roomof(SIZEOF_LONG); i++) {
 	    zds[i] = xds[i] ^ BIGLO(num);
 	    num = BIGDN(num);
 	}

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

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