ruby-changes:30188
From: akr <ko1@a...>
Date: Mon, 29 Jul 2013 22:19:02 +0900 (JST)
Subject: [ruby-changes:30188] akr:r42240 (trunk): * bignum.c (LOG2_KARATSUBA_BIG2STR_DIGITS): Renamed from
akr 2013-07-29 22:18:46 +0900 (Mon, 29 Jul 2013) New Revision: 42240 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42240 Log: * bignum.c (LOG2_KARATSUBA_BIG2STR_DIGITS): Renamed from LOG2_KARATSUBA_DIGITS. (KARATSUBA_BIG2STR_DIGITS): Renamed from KARATSUBA_DIGITS. Modified files: trunk/ChangeLog trunk/bignum.c Index: ChangeLog =================================================================== --- ChangeLog (revision 42239) +++ ChangeLog (revision 42240) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon Jul 29 22:16:11 2013 Tanaka Akira <akr@f...> + + * bignum.c (LOG2_KARATSUBA_BIG2STR_DIGITS): Renamed from + LOG2_KARATSUBA_DIGITS. + (KARATSUBA_BIG2STR_DIGITS): Renamed from KARATSUBA_DIGITS. + Mon Jul 29 22:04:45 2013 Masaki Matsushita <glass.saga@g...> * hash.c (rb_hash_compare_by_id): add function prototype. Index: bignum.c =================================================================== --- bignum.c (revision 42239) +++ bignum.c (revision 42240) @@ -4080,8 +4080,8 @@ big_rshift(VALUE x, unsigned long shift) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4080 return big_shift3(x, 0, s1, s2); } -#define LOG2_KARATSUBA_DIGITS 7 -#define KARATSUBA_DIGITS (1L<<LOG2_KARATSUBA_DIGITS) +#define LOG2_KARATSUBA_BIG2STR_DIGITS 7 +#define KARATSUBA_BIG2STR_DIGITS (1L<<LOG2_KARATSUBA_BIG2STR_DIGITS) #define MAX_BIG2STR_TABLE_ENTRIES 64 static VALUE big2str_power_cache[35][MAX_BIG2STR_TABLE_ENTRIES]; @@ -4102,7 +4102,7 @@ power_cache_get_power0(int base, int i) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4102 { if (NIL_P(big2str_power_cache[base - 2][i])) { big2str_power_cache[base - 2][i] = - i == 0 ? rb_big_pow(rb_int2big(base), INT2FIX(KARATSUBA_DIGITS)) + i == 0 ? rb_big_pow(rb_int2big(base), INT2FIX(KARATSUBA_BIG2STR_DIGITS)) : bigsq(power_cache_get_power0(base, i - 1)); rb_gc_register_mark_object(big2str_power_cache[base - 2][i]); } @@ -4116,17 +4116,17 @@ power_cache_get_power(int base, long n1, https://github.com/ruby/ruby/blob/trunk/bignum.c#L4116 long j; VALUE t; - if (n1 <= KARATSUBA_DIGITS) - rb_bug("n1 > KARATSUBA_DIGITS"); + if (n1 <= KARATSUBA_BIG2STR_DIGITS) + rb_bug("n1 > KARATSUBA_BIG2STR_DIGITS"); m = bitsize(n1-1); /* ceil(log2(n1)) */ if (m1) *m1 = 1 << m; - i = m - LOG2_KARATSUBA_DIGITS; + i = m - LOG2_KARATSUBA_BIG2STR_DIGITS; if (i >= MAX_BIG2STR_TABLE_ENTRIES) i = MAX_BIG2STR_TABLE_ENTRIES - 1; t = power_cache_get_power0(base, i); - j = KARATSUBA_DIGITS*(1 << i); + j = KARATSUBA_BIG2STR_DIGITS*(1 << i); while (n1 > j) { t = bigsq(t); j *= 2; @@ -4233,7 +4233,7 @@ big2str_karatsuba(VALUE x, int base, cha https://github.com/ruby/ruby/blob/trunk/bignum.c#L4233 } } - if (n1 <= KARATSUBA_DIGITS) { + if (n1 <= KARATSUBA_BIG2STR_DIGITS) { return big2str_orig(x, base, ptr, len, hbase, hbase_numdigits, trim); } @@ -4318,7 +4318,7 @@ rb_big2str1(VALUE x, int base, int trim) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4318 off = !(trim && RBIGNUM_SIGN(x)); /* erase plus sign if trim */ xx = rb_big_clone(x); RBIGNUM_SET_SIGN(xx, 1); - if (n1 <= KARATSUBA_DIGITS) { + if (n1 <= KARATSUBA_BIG2STR_DIGITS) { len = off + big2str_orig(xx, base, ptr + off, n2, hbase, hbase_numdigits, trim); } else { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/