diff --git a/ChangeLog b/ChangeLog index 96d1f92299..89bfa0a74b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Mon Jul 29 22:16:11 2013 Tanaka Akira + + * 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 * hash.c (rb_hash_compare_by_id): add function prototype. diff --git a/bignum.c b/bignum.c index 1f3f4b4169..d2973a5135 100644 --- a/bignum.c +++ b/bignum.c @@ -4080,8 +4080,8 @@ big_rshift(VALUE x, unsigned long shift) return big_shift3(x, 0, s1, s2); } -#define LOG2_KARATSUBA_DIGITS 7 -#define KARATSUBA_DIGITS (1L< 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, char* ptr, } } - 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) 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 {