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

ruby-changes:29481

From: akr <ko1@a...>
Date: Fri, 21 Jun 2013 19:40:30 +0900 (JST)
Subject: [ruby-changes:29481] akr:r41533 (trunk): * bignum.c (BDIGMAX): Use BIGRAD.

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

  New Revision: 41533

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

  Log:
    * bignum.c (BDIGMAX): Use BIGRAD.
      (BIGLO): Use BDIGMAX.
      (bigdivrem1): Ditto.
      (bigor_int): Ditto.
      (rb_big_or): Ditto.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41532)
+++ ChangeLog	(revision 41533)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jun 21 19:38:37 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.c (BDIGMAX): Use BIGRAD.
+	  (BIGLO): Use BDIGMAX.
+	  (bigdivrem1): Ditto.
+	  (bigor_int): Ditto.
+	  (rb_big_or): Ditto.
+
 Fri Jun 21 19:18:48 2013  Tanaka Akira  <akr@f...>
 
 	* pack.c (pack_pack): Move the implementation for 'c' directive after
Index: bignum.c
===================================================================
--- bignum.c	(revision 41532)
+++ bignum.c	(revision 41533)
@@ -45,8 +45,8 @@ static VALUE big_three = Qnil; https://github.com/ruby/ruby/blob/trunk/bignum.c#L45
 #endif
 #define BIGUP(x) ((BDIGIT_DBL)(x) << BITSPERDIG)
 #define BIGDN(x) RSHIFT((x),BITSPERDIG)
-#define BIGLO(x) ((BDIGIT)((x) & (BIGRAD-1)))
-#define BDIGMAX ((BDIGIT)-1)
+#define BIGLO(x) ((BDIGIT)((x) & BDIGMAX))
+#define BDIGMAX ((BDIGIT)(BIGRAD-1))
 
 #define BIGZEROP(x) (RBIGNUM_LEN(x) == 0 || \
 		     (BDIGITS(x)[0] == 0 && \
@@ -3834,7 +3834,7 @@ bigdivrem1(void *ptr) https://github.com/ruby/ruby/blob/trunk/bignum.c#L3834
 	    bds->j = j;
 	    return 0;
         }
-	if (zds[j] ==  yds[ny-1]) q = (BDIGIT)BIGRAD-1;
+	if (zds[j] ==  yds[ny-1]) q = BDIGMAX;
 	else q = (BDIGIT)((BIGUP(zds[j]) + zds[j-1])/yds[ny-1]);
 	if (q) {
            i = bds->nyzero; num = 0; t2 = 0;
@@ -4542,7 +4542,7 @@ bigor_int(VALUE x, long y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4542
     }
 #endif
     while (i < xn) {
-	zds[i] = sign?xds[i]:(BDIGIT)(BIGRAD-1);
+	zds[i] = sign?xds[i]:BDIGMAX;
 	i++;
     }
     if (!RBIGNUM_SIGN(z)) get2comp(z);
@@ -4603,7 +4603,7 @@ rb_big_or(VALUE xx, VALUE yy) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4603
 	zds[i] = ds1[i] | ds2[i];
     }
     for (; i<l2; i++) {
-	zds[i] = sign?ds2[i]:(BDIGIT)(BIGRAD-1);
+	zds[i] = sign?ds2[i]:BDIGMAX;
     }
     if (!RBIGNUM_SIGN(z)) get2comp(z);
     return bignorm(z);

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

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