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

ruby-changes:32910

From: akr <ko1@a...>
Date: Sun, 16 Feb 2014 06:17:42 +0900 (JST)
Subject: [ruby-changes:32910] akr:r44989 (trunk): * internal.h: Rename macro names: RBIGNUM_FOO to BIGNUM_FOO.

akr	2014-02-16 06:17:34 +0900 (Sun, 16 Feb 2014)

  New Revision: 44989

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

  Log:
    * internal.h: Rename macro names: RBIGNUM_FOO to BIGNUM_FOO.
      (BIGNUM_EMBED_LEN_NUMBITS): Renamed from RBIGNUM_EMBED_LEN_NUMBITS.
      (BIGNUM_EMBED_LEN_MAX): Renamed from RBIGNUM_EMBED_LEN_MAX.
      (BIGNUM_SIGN_BIT): Renamed from RBIGNUM_SIGN_BIT.
      (BIGNUM_SIGN): Renamed from RBIGNUM_SIGN.
      (BIGNUM_SET_SIGN): Renamed from RBIGNUM_SET_SIGN.
      (BIGNUM_POSITIVE_P): Renamed from RBIGNUM_POSITIVE_P.
      (BIGNUM_NEGATIVE_P): Renamed from RBIGNUM_NEGATIVE_P.
      (BIGNUM_EMBED_FLAG): Renamed from RBIGNUM_EMBED_FLAG.
      (BIGNUM_EMBED_LEN_MASK): Renamed from RBIGNUM_EMBED_LEN_MASK.
      (BIGNUM_EMBED_LEN_SHIFT): Renamed from RBIGNUM_EMBED_LEN_SHIFT.
      (BIGNUM_LEN): Renamed from RBIGNUM_LEN.
      (RBIGNUM_DIGITS): Renamed from RBIGNUM_DIGITS.
      (BIGNUM_LENINT): Renamed from RBIGNUM_LENINT.
    
    * bignum.c: Follow the above change.
    
    * gc.c: Ditto.
    
    * marshal.c: Ditto.
    
    * math.c: Ditto.
    
    * numeric.c: Ditto.
    
    * random.c: Ditto.
    
    * rational.c: Ditto.
    
    * sprintf.c: Ditto.
    
    * ext/-test-/bignum/bigzero.c: Ditto.
    
    * ext/-test-/bignum/intpack.c: Ditto.
    
    * ext/bigdecimal/bigdecimal.c: Ditto.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c
    trunk/ext/-test-/bignum/bigzero.c
    trunk/ext/-test-/bignum/intpack.c
    trunk/ext/bigdecimal/bigdecimal.c
    trunk/gc.c
    trunk/internal.h
    trunk/marshal.c
    trunk/math.c
    trunk/numeric.c
    trunk/random.c
    trunk/rational.c
    trunk/sprintf.c
Index: math.c
===================================================================
--- math.c	(revision 44988)
+++ math.c	(revision 44989)
@@ -446,7 +446,7 @@ math_log(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/math.c#L446
 
     rb_scan_args(argc, argv, "11", &x, &base);
 
-    if (RB_BIGNUM_TYPE_P(x) && RBIGNUM_POSITIVE_P(x) &&
+    if (RB_BIGNUM_TYPE_P(x) && BIGNUM_POSITIVE_P(x) &&
             DBL_MAX_EXP <= (numbits = rb_absint_numwords(x, 1, NULL))) {
         numbits -= DBL_MANT_DIG;
         x = rb_big_rshift(x, SIZET2NUM(numbits));
@@ -506,7 +506,7 @@ math_log2(VALUE obj, VALUE x) https://github.com/ruby/ruby/blob/trunk/math.c#L506
     double d0, d;
     size_t numbits;
 
-    if (RB_BIGNUM_TYPE_P(x) && RBIGNUM_POSITIVE_P(x) &&
+    if (RB_BIGNUM_TYPE_P(x) && BIGNUM_POSITIVE_P(x) &&
             DBL_MAX_EXP <= (numbits = rb_absint_numwords(x, 1, NULL))) {
         numbits -= DBL_MANT_DIG;
         x = rb_big_rshift(x, SIZET2NUM(numbits));
@@ -548,7 +548,7 @@ math_log10(VALUE obj, VALUE x) https://github.com/ruby/ruby/blob/trunk/math.c#L548
     double d0, d;
     size_t numbits;
 
-    if (RB_BIGNUM_TYPE_P(x) && RBIGNUM_POSITIVE_P(x) &&
+    if (RB_BIGNUM_TYPE_P(x) && BIGNUM_POSITIVE_P(x) &&
             DBL_MAX_EXP <= (numbits = rb_absint_numwords(x, 1, NULL))) {
         numbits -= DBL_MANT_DIG;
         x = rb_big_rshift(x, SIZET2NUM(numbits));
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44988)
+++ ChangeLog	(revision 44989)
@@ -1,3 +1,42 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Feb 16 06:12:23 2014  Tanaka Akira  <akr@f...>
+
+	* internal.h: Rename macro names: RBIGNUM_FOO to BIGNUM_FOO.
+	  (BIGNUM_EMBED_LEN_NUMBITS): Renamed from RBIGNUM_EMBED_LEN_NUMBITS.
+	  (BIGNUM_EMBED_LEN_MAX): Renamed from RBIGNUM_EMBED_LEN_MAX.
+	  (BIGNUM_SIGN_BIT): Renamed from RBIGNUM_SIGN_BIT.
+	  (BIGNUM_SIGN): Renamed from RBIGNUM_SIGN.
+	  (BIGNUM_SET_SIGN): Renamed from RBIGNUM_SET_SIGN.
+	  (BIGNUM_POSITIVE_P): Renamed from RBIGNUM_POSITIVE_P.
+	  (BIGNUM_NEGATIVE_P): Renamed from RBIGNUM_NEGATIVE_P.
+	  (BIGNUM_EMBED_FLAG): Renamed from RBIGNUM_EMBED_FLAG.
+	  (BIGNUM_EMBED_LEN_MASK): Renamed from RBIGNUM_EMBED_LEN_MASK.
+	  (BIGNUM_EMBED_LEN_SHIFT): Renamed from RBIGNUM_EMBED_LEN_SHIFT.
+	  (BIGNUM_LEN): Renamed from RBIGNUM_LEN.
+	  (RBIGNUM_DIGITS): Renamed from RBIGNUM_DIGITS.
+	  (BIGNUM_LENINT): Renamed from RBIGNUM_LENINT.
+
+	* bignum.c: Follow the above change.
+
+	* gc.c: Ditto.
+
+	* marshal.c: Ditto.
+
+	* math.c: Ditto.
+
+	* numeric.c: Ditto.
+
+	* random.c: Ditto.
+
+	* rational.c: Ditto.
+
+	* sprintf.c: Ditto.
+
+	* ext/-test-/bignum/bigzero.c: Ditto.
+
+	* ext/-test-/bignum/intpack.c: Ditto.
+
+	* ext/bigdecimal/bigdecimal.c: Ditto.
+
 Sat Feb 15 20:48:49 2014  Tanaka Akira  <akr@f...>
 
 	* configure.in (FILE_READEND): Don't detect it because it is not used.
Index: sprintf.c
===================================================================
--- sprintf.c	(revision 44988)
+++ sprintf.c	(revision 44989)
@@ -853,7 +853,7 @@ rb_str_format(int argc, const VALUE *arg https://github.com/ruby/ruby/blob/trunk/sprintf.c#L853
                         if (numdigits == 0 ||
                                 ((abs_nlz_bits != (size_t)(numbits-1) ||
                                   !rb_absint_singlebit_p(val)) &&
-                                 (!bignum ? v < 0 : RBIGNUM_NEGATIVE_P(val))))
+                                 (!bignum ? v < 0 : BIGNUM_NEGATIVE_P(val))))
                             numdigits++;
                         tmp = rb_str_new(NULL, numdigits);
                         valsign = rb_integer_pack(val, RSTRING_PTR(tmp), RSTRING_LEN(tmp),
Index: gc.c
===================================================================
--- gc.c	(revision 44988)
+++ gc.c	(revision 44989)
@@ -1612,8 +1612,8 @@ obj_free(rb_objspace_t *objspace, VALUE https://github.com/ruby/ruby/blob/trunk/gc.c#L1612
 	break;
 
       case T_BIGNUM:
-	if (!(RBASIC(obj)->flags & RBIGNUM_EMBED_FLAG) && RBIGNUM_DIGITS(obj)) {
-	    xfree(RBIGNUM_DIGITS(obj));
+	if (!(RBASIC(obj)->flags & BIGNUM_EMBED_FLAG) && BIGNUM_DIGITS(obj)) {
+	    xfree(BIGNUM_DIGITS(obj));
 	}
 	break;
       case T_NODE:
@@ -2506,8 +2506,8 @@ obj_memsize_of(VALUE obj, int use_tdata) https://github.com/ruby/ruby/blob/trunk/gc.c#L2506
 	break;
 
       case T_BIGNUM:
-	if (!(RBASIC(obj)->flags & RBIGNUM_EMBED_FLAG) && RBIGNUM_DIGITS(obj)) {
-	    size += RBIGNUM_LEN(obj) * sizeof(BDIGIT);
+	if (!(RBASIC(obj)->flags & BIGNUM_EMBED_FLAG) && BIGNUM_DIGITS(obj)) {
+	    size += BIGNUM_LEN(obj) * sizeof(BDIGIT);
 	}
 	break;
       case T_NODE:
Index: ext/bigdecimal/bigdecimal.c
===================================================================
--- ext/bigdecimal/bigdecimal.c	(revision 44988)
+++ ext/bigdecimal/bigdecimal.c	(revision 44989)
@@ -86,8 +86,8 @@ static ID id_eq; https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L86
 #define DBLE_FIG (DBL_DIG+1)    /* figure of double */
 #endif
 
-#ifndef RBIGNUM_ZERO_P
-# define RBIGNUM_ZERO_P(x) rb_bigzero_p(x)
+#ifndef BIGNUM_ZERO_P
+# define BIGNUM_ZERO_P(x) rb_bigzero_p(x)
 #endif
 
 #ifndef RRATIONAL_ZERO_P
Index: ext/-test-/bignum/bigzero.c
===================================================================
--- ext/-test-/bignum/bigzero.c	(revision 44988)
+++ ext/-test-/bignum/bigzero.c	(revision 44989)
@@ -6,7 +6,7 @@ bug_big_zero(VALUE self, VALUE length) https://github.com/ruby/ruby/blob/trunk/ext/-test-/bignum/bigzero.c#L6
 {
     long len = NUM2ULONG(length);
     VALUE z = rb_big_new(len, 1);
-    MEMZERO(RBIGNUM_DIGITS(z), BDIGIT, len);
+    MEMZERO(BIGNUM_DIGITS(z), BDIGIT, len);
     return z;
 }
 
@@ -15,7 +15,7 @@ bug_big_negzero(VALUE self, VALUE length https://github.com/ruby/ruby/blob/trunk/ext/-test-/bignum/bigzero.c#L15
 {
     long len = NUM2ULONG(length);
     VALUE z = rb_big_new(len, 0);
-    MEMZERO(RBIGNUM_DIGITS(z), BDIGIT, len);
+    MEMZERO(BIGNUM_DIGITS(z), BDIGIT, len);
     return z;
 }
 
Index: ext/-test-/bignum/intpack.c
===================================================================
--- ext/-test-/bignum/intpack.c	(revision 44988)
+++ ext/-test-/bignum/intpack.c	(revision 44989)
@@ -49,7 +49,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/ext/-test-/bignum/intpack.c#L49
 rb_integer_test_numbits_2comp_without_sign(VALUE val)
 {
   size_t size;
-  int neg = FIXNUM_P(val) ? FIX2LONG(val) < 0 : RBIGNUM_NEGATIVE_P(val);
+  int neg = FIXNUM_P(val) ? FIX2LONG(val) < 0 : BIGNUM_NEGATIVE_P(val);
   size = rb_absint_numwords(val, 1, NULL) - (neg && rb_absint_singlebit_p(val));
   return SIZET2NUM(size);
 }
@@ -57,7 +57,7 @@ rb_integer_test_numbits_2comp_without_si https://github.com/ruby/ruby/blob/trunk/ext/-test-/bignum/intpack.c#L57
 static VALUE
 rb_integer_test_numbytes_2comp_with_sign(VALUE val)
 {
-  int neg = FIXNUM_P(val) ? FIX2LONG(val) < 0 : RBIGNUM_NEGATIVE_P(val);
+  int neg = FIXNUM_P(val) ? FIX2LONG(val) < 0 : BIGNUM_NEGATIVE_P(val);
   int nlz_bits;
   size_t size = rb_absint_size(val, &nlz_bits);
   if (nlz_bits == 0 && !(neg && rb_absint_singlebit_p(val)))
Index: numeric.c
===================================================================
--- numeric.c	(revision 44988)
+++ numeric.c	(revision 44989)
@@ -145,7 +145,7 @@ rb_num_to_uint(VALUE val, unsigned int * https://github.com/ruby/ruby/blob/trunk/numeric.c#L145
     }
 
     if (RB_TYPE_P(val, T_BIGNUM)) {
-	if (RBIGNUM_NEGATIVE_P(val)) return NUMERR_NEGATIVE;
+	if (BIGNUM_NEGATIVE_P(val)) return NUMERR_NEGATIVE;
 #if SIZEOF_INT < SIZEOF_LONG
 	/* long is 64bit */
 	return NUMERR_TOOLARGE;
@@ -172,7 +172,7 @@ positive_int_p(VALUE num) https://github.com/ruby/ruby/blob/trunk/numeric.c#L172
     }
     else if (RB_TYPE_P(num, T_BIGNUM)) {
 	if (method_basic_p(rb_cBignum))
-	    return RBIGNUM_POSITIVE_P(num);
+	    return BIGNUM_POSITIVE_P(num);
     }
     return RTEST(rb_funcall(num, mid, 1, INT2FIX(0)));
 }
@@ -188,7 +188,7 @@ negative_int_p(VALUE num) https://github.com/ruby/ruby/blob/trunk/numeric.c#L188
     }
     else if (RB_TYPE_P(num, T_BIGNUM)) {
 	if (method_basic_p(rb_cBignum))
-	    return RBIGNUM_NEGATIVE_P(num);
+	    return BIGNUM_NEGATIVE_P(num);
     }
     return RTEST(rb_funcall(num, mid, 1, INT2FIX(0)));
 }
@@ -2066,7 +2066,7 @@ rb_num2ulong_internal(VALUE val, int *wr https://github.com/ruby/ruby/blob/trunk/numeric.c#L2066
         {
             unsigned long ul = rb_big2ulong(val);
             if (wrap_p)
-                *wrap_p = RBIGNUM_NEGATIVE_P(val);
+                *wrap_p = BIGNUM_NEGATIVE_P(val);
             return ul;
         }
     }
@@ -3434,7 +3434,7 @@ fix_aref(VALUE fix, VALUE idx) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3434
     if (!FIXNUM_P(idx)) {
 	idx = rb_big_norm(idx);
 	if (!FIXNUM_P(idx)) {
-	    if (!RBIGNUM_SIGN(idx) || val >= 0)
+	    if (!BIGNUM_SIGN(idx) || val >= 0)
 		return INT2FIX(0);
 	    return INT2FIX(1);
 	}
Index: internal.h
===================================================================
--- internal.h	(revision 44988)
+++ internal.h	(revision 44989)
@@ -305,12 +305,12 @@ struct method_table_wrapper { https://github.com/ruby/ruby/blob/trunk/internal.h#L305
     size_t serial;
 };
 
-#define RBIGNUM_EMBED_LEN_NUMBITS 3
-#ifndef RBIGNUM_EMBED_LEN_MAX
-# if (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT) < (1 << RBIGNUM_EMBED_LEN_NUMBITS)-1
-#   define RBIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT)
+#define BIGNUM_EMBED_LEN_NUMBITS 3
+#ifndef BIGNUM_EMBED_LEN_MAX
+# if (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT) < (1 << BIGNUM_EMBED_LEN_NUMBITS)-1
+#   define BIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT)
 # else
-#   define RBIGNUM_EMBED_LEN_MAX ((1 << RBIGNUM_EMBED_LEN_NUMBITS)-1)
+#   define BIGNUM_EMBED_LEN_MAX ((1 << BIGNUM_EMBED_LEN_NUMBITS)-1)
 # endif
 #endif
 
@@ -321,32 +321,32 @@ struct RBignum { https://github.com/ruby/ruby/blob/trunk/internal.h#L321
             long len;
             BDIGIT *digits;
         } heap;
-        BDIGIT ary[RBIGNUM_EMBED_LEN_MAX];
+        BDIGIT ary[BIGNUM_EMBED_LEN_MAX];
     } as;
 };
-#define RBIGNUM_SIGN_BIT FL_USER1
+#define BIGNUM_SIGN_BIT FL_USER1
 /* sign: positive:1, negative:0 */
-#define RBIGNUM_SIGN(b) ((RBASIC(b)->flags & RBIGNUM_SIGN_BIT) != 0)
-#define RBIGNUM_SET_SIGN(b,sign) \
-  ((sign) ? (RBASIC(b)->flags |= RBIGNUM_SIGN_BIT) \
-          : (RBASIC(b)->flags &= ~RBIGNUM_SIGN_BIT))
-#define RBIGNUM_POSITIVE_P(b) RBIGNUM_SIGN(b)
-#define RBIGNUM_NEGATIVE_P(b) (!RBIGNUM_SIGN(b))
+#define BIGNUM_SIGN(b) ((RBASIC(b)->flags & BIGNUM_SIGN_BIT) != 0)
+#define BIGNUM_SET_SIGN(b,sign) \
+  ((sign) ? (RBASIC(b)->flags |= BIGNUM_SIGN_BIT) \
+          : (RBASIC(b)->flags &= ~BIGNUM_SIGN_BIT))
+#define BIGNUM_POSITIVE_P(b) BIGNUM_SIGN(b)
+#define BIGNUM_NEGATIVE_P(b) (!BIGNUM_SIGN(b))
 
-#define RBIGNUM_EMBED_FLAG FL_USER2
-#define RBIGNUM_EMBED_LEN_MASK (FL_USER5|FL_USER4|FL_USER3)
-#define RBIGNUM_EMBED_LEN_SHIFT (FL_USHIFT+RBIGNUM_EMBED_LEN_NUMBITS)
-#define RBIGNUM_LEN(b) \
-    ((RBASIC(b)->flags & RBIGNUM_EMBED_FLAG) ? \
-     (long)((RBASIC(b)->flags >> RBIGNUM_EMBED_LEN_SHIFT) & \
-            (RBIGNUM_EMBED_LEN_MASK >> RBIGNUM_EMBED_LEN_SHIFT)) : \
+#define BIGNUM_EMBED_FLAG FL_USER2
+#define BIGNUM_EMBED_LEN_MASK (FL_USER5|FL_USER4|FL_USER3)
+#define BIGNUM_EMBED_LEN_SHIFT (FL_USHIFT+BIGNUM_EMBED_LEN_NUMBITS)
+#define BIGNUM_LEN(b) \
+    ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \
+     (long)((RBASIC(b)->flags >> BIGNUM_EMBED_LEN_SHIFT) & \
+            (BIGNUM_EMBED_LEN_MASK >> BIGNUM_EMBED_LEN_SHIFT)) : \
      RBIGNUM(b)->as.heap.len)
-/* LSB:RBIGNUM_DIGITS(b)[0], MSB:RBIGNUM_DIGITS(b)[RBIGNUM_LEN(b)-1] */
-#define RBIGNUM_DIGITS(b) \
-    ((RBASIC(b)->flags & RBIGNUM_EMBED_FLAG) ? \
+/* LSB:BIGNUM_DIGITS(b)[0], MSB:BIGNUM_DIGITS(b)[BIGNUM_LEN(b)-1] */
+#define BIGNUM_DIGITS(b) \
+    ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \
      RBIGNUM(b)->as.ary : \
      RBIGNUM(b)->as.heap.digits)
-#define RBIGNUM_LENINT(b) rb_long2int(RBIGNUM_LEN(b))
+#define BIGNUM_LENINT(b) rb_long2int(BIGNUM_LEN(b))
 
 #define RBIGNUM(obj) (R_CAST(RBignum)(obj))
 
Index: bignum.c
===================================================================
--- bignum.c	(revision 44988)
+++ bignum.c	(revision 44989)
@@ -50,7 +50,7 @@ STATIC_ASSERT(sizeof_bdigit_and_dbl, SIZ https://github.com/ruby/ruby/blob/trunk/bignum.c#L50
 STATIC_ASSERT(bdigit_signedness, 0 < (BDIGIT)-1);
 STATIC_ASSERT(bdigit_dbl_signedness, 0 < (BDIGIT_DBL)-1);
 STATIC_ASSERT(bdigit_dbl_signed_signedness, 0 > (BDIGIT_DBL_SIGNED)-1);
-STATIC_ASSERT(rbignum_embed_len_max, RBIGNUM_EMBED_LEN_MAX <= (RBIGNUM_EMBED_LEN_MASK >> RBIGNUM_EMBED_LEN_SHIFT));
+STATIC_ASSERT(rbignum_embed_len_max, BIGNUM_EMBED_LEN_MAX <= (BIGNUM_EMBED_LEN_MASK >> BIGNUM_EMBED_LEN_SHIFT));
 
 #if SIZEOF_BDIGITS < SIZEOF_LONG
 STATIC_ASSERT(sizeof_long_and_sizeof_bdigit, SIZEOF_LONG % SIZEOF_BDIGITS == 0);
@@ -71,7 +71,7 @@ STATIC_ASSERT(sizeof_long_and_sizeof_bdi https://github.com/ruby/ruby/blob/trunk/bignum.c#L71
 #define FILL_LOWBITS(d, numbits) ((d) | (LSHIFTX(((d)*0+1), (numbits))-1))
 #define POW2_P(x) (((x)&((x)-1))==0)
 
-#define BDIGITS(x) (RBIGNUM_DIGITS(x))
+#define BDIGITS(x) (BIGNUM_DIGITS(x))
 #define BITSPERDIG (SIZEOF_BDIGITS*CHAR_BIT)
 #define BIGRAD ((BDIGIT_DBL)1 << BITSPERDIG)
 #define BIGRAD_HALF ((BDIGIT)(BIGRAD >> 1))
@@ -90,12 +90,12 @@ STATIC_ASSERT(sizeof_long_and_sizeof_bdi https://github.com/ruby/ruby/blob/trunk/bignum.c#L90
 #   define swap_bdigit(x) swap64(x)
 #endif
 
-#define BIGZEROP(x) (RBIGNUM_LEN(x) == 0 || \
+#define BIGZEROP(x) (BIGNUM_LEN(x) == 0 || \
 		     (BDIGITS(x)[0] == 0 && \
-		      (RBIGNUM_LEN(x) == 1 || bigzero_p(x))))
-#define BIGSIZE(x) (RBIGNUM_LEN(x) == 0 ? (size_t)0 : \
-    BDIGITS(x)[RBIGNUM_LEN(x)-1] ? \
-        (size_t)(RBIGNUM_LEN(x)*SIZEOF_BDIGITS - nlz(BDIGITS(x)[RBIGNUM_LEN(x)-1])/CHAR_BIT) : \
+		      (BIGNUM_LEN(x) == 1 || bigzero_p(x))))
+#define BIGSIZE(x) (BIGNUM_LEN(x) == 0 ? (size_t)0 : \
+    BDIGITS(x)[BIGNUM_LEN(x)-1] ? \
+        (size_t)(BIGNUM_LEN(x)*SIZEOF_BDIGITS - nlz(BDIGITS(x)[BIGNUM_LEN(x)-1])/CHAR_BIT) : \
     rb_absint_size(x, NULL))
 
 #define BIGDIVREM_EXTRA_WORDS 1
@@ -109,8 +109,8 @@ STATIC_ASSERT(sizeof_long_and_sizeof_bdi https://github.com/ruby/ruby/blob/trunk/bignum.c#L109
 #define BARY_DIVMOD(q, r, x, y) bary_divmod(BARY_ARGS(q), BARY_ARGS(r), BARY_ARGS(x), BARY_ARGS(y))
 #define BARY_ZERO_P(x) bary_zero_p(BARY_ARGS(x))
 
-#define RBIGNUM_SET_NEGATIVE_SIGN(b) RBIGNUM_SET_SIGN(b, 0)
-#define RBIGNUM_SET_POSITIVE_SIGN(b) RBIGNUM_SET_SIGN(b, 1)
+#define BIGNUM_SET_NEGATIVE_SIGN(b) BIGNUM_SET_SIGN(b, 0)
+#define BIGNUM_SET_POSITIVE_SIGN(b) BIGNUM_SET_SIGN(b, 1)
 
 #define bignew(len,sign) bignew_1(rb_cBignum,(len),(sign))
 
@@ -1542,8 +1542,8 @@ bary_mul_normal(BDIGIT *zds, size_t zn, https://github.com/ruby/ruby/blob/trunk/bignum.c#L1542
 VALUE
 rb_big_mul_normal(VALUE x, VALUE y)
 {
-    size_t xn = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), zn = xn + yn;
-    VALUE z = bignew(zn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
+    size_t xn = BIGNUM_LEN(x), yn = BIGNUM_LEN(y), zn = xn + yn;
+    VALUE z = bignew(zn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
     bary_mul_normal(BDIGITS(z), zn, BDIGITS(x), xn, BDIGITS(y), yn);
     RB_GC_GUARD(x);
     RB_GC_GUARD(y);
@@ -1611,7 +1611,7 @@ bary_sq_fast(BDIGIT *zds, size_t zn, con https://github.com/ruby/ruby/blob/trunk/bignum.c#L1611
 VALUE
 rb_big_sq_fast(VALUE x)
 {
-    size_t xn = RBIGNUM_LEN(x), zn = 2 * xn;
+    size_t xn = BIGNUM_LEN(x), zn = 2 * xn;
     VALUE z = bignew(zn, 1);
     bary_sq_fast(BDIGITS(z), zn, BDIGITS(x), xn);
     RB_GC_GUARD(x);
@@ -1670,8 +1670,8 @@ bary_mul_balance_with_mulfunc(BDIGIT *zd https://github.com/ruby/ruby/blob/trunk/bignum.c#L1670
 VALUE
 rb_big_mul_balance(VALUE x, VALUE y)
 {
-    size_t xn = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), zn = xn + yn;
-    VALUE z = bignew(zn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
+    size_t xn = BIGNUM_LEN(x), yn = BIGNUM_LEN(y), zn = xn + yn;
+    VALUE z = bignew(zn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
     bary_mul_balance_with_mulfunc(BDIGITS(z), zn, BDIGITS(x), xn, BDIGITS(y), yn, NULL, 0, bary_mul_toom3_start);
     RB_GC_GUARD(x);
     RB_GC_GUARD(y);
@@ -1851,8 +1851,8 @@ bary_mul_karatsuba(BDIGIT *zds, size_t z https://github.com/ruby/ruby/blob/trunk/bignum.c#L1851
 VALUE
 rb_big_mul_karatsuba(VALUE x, VALUE y)
 {
-    size_t xn = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), zn = xn + yn;
-    VALUE z = bignew(zn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
+    size_t xn = BIGNUM_LEN(x), yn = BIGNUM_LEN(y), zn = xn + yn;
+    VALUE z = bignew(zn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
     if (!((xn <= yn && yn < 2) || KARATSUBA_BALANCED(xn, yn)))
         rb_raise(rb_eArgError, "unexpected bignum length for karatsuba");
     bary_mul_karatsuba(BDIGITS(z), zn, BDIGITS(x), xn, BDIGITS(y), yn, NULL, 0);
@@ -2248,8 +2248,8 @@ bary_mul_toom3(BDIGIT *zds, size_t zn, c https://github.com/ruby/ruby/blob/trunk/bignum.c#L2248
 VALUE
 rb_big_mul_toom3(VALUE x, VALUE y)
 {
-    size_t xn = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), zn = xn + yn;
-    VALUE z = bignew(zn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
+    size_t xn = BIGNUM_LEN(x), yn = BIGNUM_LEN(y), zn = xn + yn;
+    VALUE z = bignew(zn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
     if (xn > yn || yn < 3 || !TOOM3_BALANCED(xn,yn))
         rb_raise(rb_eArgError, "unexpected bignum length for toom3");
     bary_mul_toom3(BDIGITS(z), zn, BDIGITS(x), xn, BDIGITS(y), yn, NULL, 0);
@@ -2289,8 +2289,8 @@ bary_mul_gmp(BDIGIT *zds, size_t zn, con https://github.com/ruby/ruby/blob/trunk/bignum.c#L2289
 VALUE
 rb_big_mul_gmp(VALUE x, VALUE y)
 {
-    size_t xn = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), zn = xn + yn;
-    VALUE z = bignew(zn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
+    size_t xn = BIGNUM_LEN(x), yn = BIGNUM_LEN(y), zn = xn + yn;
+    VALUE z = bignew(zn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
     bary_mul_gmp(BDIGITS(z), zn, BDIGITS(x), xn, BDIGITS(y), yn);
     RB_GC_GUARD(x);
     RB_GC_GUARD(y);
@@ -2700,7 +2700,7 @@ bary_divmod_normal(BDIGIT *qds, size_t q https://github.com/ruby/ruby/blob/trunk/bignum.c#L2700
 VALUE
 rb_big_divrem_normal(VALUE x, VALUE y)
 {
-    size_t xn = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), qn, rn;
+    size_t xn = BIGNUM_LEN(x), yn = BIGNUM_LEN(y), qn, rn;
     BDIGIT *xds = BDIGITS(x), *yds = BDIGITS(y), *qds, *rds;
     VALUE q, r;
 
@@ -2713,11 +2713,11 @@ rb_big_divrem_normal(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L2713
         return rb_assoc_new(LONG2FIX(0), x);
 
     qn = xn + BIGDIVREM_EXTRA_WORDS;
-    q = bignew(qn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
+    q = bignew(qn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
     qds = BDIGITS(q);
 
     rn = yn;
-    r = bignew(rn, RBIGNUM_SIGN(x));
+    r = bignew(rn, BIGNUM_SIGN(x));
     rds = BDIGITS(r);
 
     bary_divmod_normal(qds, qn, rds, rn, xds, xn, yds, yn);
@@ -2781,7 +2781,7 @@ bary_divmod_gmp(BDIGIT *qds, size_t qn, https://github.com/ruby/ruby/blob/trunk/bignum.c#L2781
 VALUE
 rb_big_divrem_gmp(VALUE x, VALUE y)
 {
-    size_t xn = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), qn, rn;
+    size_t xn = BIGNUM_LEN(x), yn = BIGNUM_LEN(y), qn, rn;
     BDIGIT *xds = BDIGITS(x), *yds = BDIGITS(y), *qds, *rds;
     VALUE q, r;
 
@@ -2794,11 +2794,11 @@ rb_big_divrem_gmp(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L2794
         return rb_assoc_new(LONG2FIX(0), x);
 
     qn = xn - yn + 1;
-    q = bignew(qn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
+    q = bignew(qn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
     qds = BDIGITS(q);
 
     rn = yn;
-    r = bignew(rn, RBIGNUM_SIGN(x));
+    r = bignew(rn, BIGNUM_SIGN(x));
     rds = BDIGITS(r);
 
     bary_divmod_gmp(qds, qn, rds, rn, xds, xn, yds, yn);
@@ -2878,11 +2878,11 @@ static void https://github.com/ruby/ruby/blob/trunk/bignum.c#L2878
 dump_bignum(VALUE x)
 {
     long i;
-    printf("%c0x0", RBIGNUM_SIGN(x) ? '+' : '-');
-    for (i = RBIGNUM_LEN(x); i--;  (... truncated)

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

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