1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* bignum.c (bigsq): Renamed from bigsqr.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2013-07-16 11:23:03 +00:00
parent a08c5527ea
commit 6be7c95734
2 changed files with 9 additions and 5 deletions

View file

@ -1,3 +1,7 @@
Tue Jul 16 20:21:28 2013 Tanaka Akira <akr@fsij.org>
* bignum.c (bigsq): Renamed from bigsqr.
Tue Jul 16 19:42:08 2013 Tanaka Akira <akr@fsij.org>
* bignum.c (USHORT): Unused macro removed.

View file

@ -122,7 +122,7 @@ static VALUE bigmul1_toom3(VALUE x, VALUE y);
static VALUE bignew_1(VALUE klass, long len, int sign);
static inline VALUE bigtrunc(VALUE x);
static VALUE bigsqr(VALUE x);
static VALUE bigsq(VALUE x);
static void bigdivmod(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp);
static int
@ -3371,7 +3371,7 @@ power_cache_get_power0(int base, int i)
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))
: bigsqr(power_cache_get_power0(base, i - 1));
: bigsq(power_cache_get_power0(base, i - 1));
rb_gc_register_mark_object(big2str_power_cache[base - 2][i]);
}
return big2str_power_cache[base - 2][i];
@ -3396,7 +3396,7 @@ power_cache_get_power(int base, long n1, long* m1)
j = KARATSUBA_DIGITS*(1 << i);
while (n1 > j) {
t = bigsqr(t);
t = bigsq(t);
j *= 2;
}
return t;
@ -5357,7 +5357,7 @@ rb_big_fdiv(VALUE x, VALUE y)
}
static VALUE
bigsqr(VALUE x)
bigsq(VALUE x)
{
return bigtrunc(bigmul0(x, x));
}
@ -5417,7 +5417,7 @@ rb_big_pow(VALUE x, VALUE y)
break;
}
for (mask = FIXNUM_MAX + 1; mask; mask >>= 1) {
if (z) z = bigsqr(z);
if (z) z = bigsq(z);
if (yy & mask) {
z = z ? bigtrunc(bigmul0(z, x)) : x;
}