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

ruby-changes:30299

From: akr <ko1@a...>
Date: Sat, 3 Aug 2013 13:32:45 +0900 (JST)
Subject: [ruby-changes:30299] akr:r42351 (trunk): * bignum.c (MAX_BASE36_POWER_TABLE_ENTRIES): Renamed from

akr	2013-08-03 13:32:33 +0900 (Sat, 03 Aug 2013)

  New Revision: 42351

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

  Log:
    * bignum.c (MAX_BASE36_POWER_TABLE_ENTRIES): Renamed from
      MAX_BIG2STR_TABLE_ENTRIES.
      (base36_power_cache): Renamed from big2str_power_cache.
      (base36_numdigits_cache): Renamed from big2str_numdigits_cache.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42350)
+++ ChangeLog	(revision 42351)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Aug  3 13:30:04 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.c (MAX_BASE36_POWER_TABLE_ENTRIES): Renamed from
+	  MAX_BIG2STR_TABLE_ENTRIES.
+	  (base36_power_cache): Renamed from big2str_power_cache.
+	  (base36_numdigits_cache): Renamed from big2str_numdigits_cache.
+
 Sat Aug  3 10:33:52 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* parse.y (parser_set_integer_literal): use rb_rational_raw1() for
Index: bignum.c
===================================================================
--- bignum.c	(revision 42350)
+++ bignum.c	(revision 42351)
@@ -4108,18 +4108,18 @@ big_rshift(VALUE x, unsigned long shift) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4108
     return big_shift3(x, 0, s1, s2);
 }
 
-#define MAX_BIG2STR_TABLE_ENTRIES (SIZEOF_SIZE_T * CHAR_BIT + 1)
+#define MAX_BASE36_POWER_TABLE_ENTRIES (SIZEOF_SIZE_T * CHAR_BIT + 1)
 
-static VALUE big2str_power_cache[35][MAX_BIG2STR_TABLE_ENTRIES];
-static size_t big2str_numdigits_cache[35][MAX_BIG2STR_TABLE_ENTRIES];
+static VALUE base36_power_cache[35][MAX_BASE36_POWER_TABLE_ENTRIES];
+static size_t base36_numdigits_cache[35][MAX_BASE36_POWER_TABLE_ENTRIES];
 
 static void
 power_cache_init(void)
 {
     int i, j;
     for (i = 0; i < 35; ++i) {
-	for (j = 0; j < MAX_BIG2STR_TABLE_ENTRIES; ++j) {
-	    big2str_power_cache[i][j] = Qnil;
+	for (j = 0; j < MAX_BASE36_POWER_TABLE_ENTRIES; ++j) {
+	    base36_power_cache[i][j] = Qnil;
 	}
     }
 }
@@ -4128,23 +4128,23 @@ static inline VALUE https://github.com/ruby/ruby/blob/trunk/bignum.c#L4128
 power_cache_get_power(int base, int power_level, size_t *numdigits_ret)
 {
     /*
-     * MAX_BIG2STR_TABLE_ENTRIES is big enough to that
-     * big2str_power_cache[base][MAX_BIG2STR_TABLE_ENTRIES-1] fills whole memory.
-     * So MAX_BIG2STR_TABLE_ENTRIES <= power_level is not possible to calculate.
+     * MAX_BASE36_POWER_TABLE_ENTRIES is big enough to that
+     * base36_power_cache[base][MAX_BASE36_POWER_TABLE_ENTRIES-1] fills whole memory.
+     * So MAX_BASE36_POWER_TABLE_ENTRIES <= power_level is not possible to calculate.
      *
      * number-of-bytes =
-     * log256(big2str_power_cache[base][MAX_BIG2STR_TABLE_ENTRIES-1]) =
-     * log256(maxpow_in_bdigit_dbl(base)**(2**(MAX_BIG2STR_TABLE_ENTRIES-1))) =
+     * log256(base36_power_cache[base][MAX_BASE36_POWER_TABLE_ENTRIES-1]) =
+     * log256(maxpow_in_bdigit_dbl(base)**(2**(MAX_BASE36_POWER_TABLE_ENTRIES-1))) =
      * log256(maxpow_in_bdigit_dbl(base)**(2**(SIZEOF_SIZE_T*CHAR_BIT))) =
      * (2**(SIZEOF_SIZE_T*CHAR_BIT))*log256(maxpow_in_bdigit_dbl(base)) =
      * (256**SIZEOF_SIZE_T)*log256(maxpow_in_bdigit_dbl(base)) >
      * (256**SIZEOF_SIZE_T)*(sizeof(BDIGIT_DBL)-1) >
      * 256**SIZEOF_SIZE_T
      */
-    if (MAX_BIG2STR_TABLE_ENTRIES <= power_level)
+    if (MAX_BASE36_POWER_TABLE_ENTRIES <= power_level)
         rb_bug("too big power number requested: maxpow_in_bdigit_dbl(%d)**(2**%d)", base, power_level);
 
-    if (NIL_P(big2str_power_cache[base - 2][power_level])) {
+    if (NIL_P(base36_power_cache[base - 2][power_level])) {
         VALUE power;
         size_t numdigits;
         if (power_level == 0) {
@@ -4160,13 +4160,13 @@ power_cache_get_power(int base, int powe https://github.com/ruby/ruby/blob/trunk/bignum.c#L4160
             numdigits *= 2;
         }
         rb_obj_hide(power);
-        big2str_power_cache[base - 2][power_level] = power;
-        big2str_numdigits_cache[base - 2][power_level] = numdigits;
+        base36_power_cache[base - 2][power_level] = power;
+        base36_numdigits_cache[base - 2][power_level] = numdigits;
 	rb_gc_register_mark_object(power);
     }
     if (numdigits_ret)
-        *numdigits_ret = big2str_numdigits_cache[base - 2][power_level];
-    return big2str_power_cache[base - 2][power_level];
+        *numdigits_ret = base36_numdigits_cache[base - 2][power_level];
+    return base36_power_cache[base - 2][power_level];
 }
 
 /*
@@ -4444,12 +4444,12 @@ rb_big2str1(VALUE x, int base) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4444
 
     power_level = 0;
     power = power_cache_get_power(base, power_level, NULL);
-    while (power_level < MAX_BIG2STR_TABLE_ENTRIES &&
+    while (power_level < MAX_BASE36_POWER_TABLE_ENTRIES &&
            RBIGNUM_LEN(power) <= (RBIGNUM_LEN(x)+1)/2) {
         power_level++;
         power = power_cache_get_power(base, power_level, NULL);
     }
-    assert(power_level != MAX_BIG2STR_TABLE_ENTRIES);
+    assert(power_level != MAX_BASE36_POWER_TABLE_ENTRIES);
 
     if (RBIGNUM_LEN(power) <= RBIGNUM_LEN(x)) {
         /*

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

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