py: Added optimised support for 3-argument calls to builtin.pow()

Updated modbuiltin.c to add conditional support for 3-arg calls to
pow() using MICROPY_PY_BUILTINS_POW3 config parameter. Added support in
objint_mpz.c for for optimised implementation.
This commit is contained in:
Nicko van Someren
2017-02-01 16:41:22 -07:00
committed by Paul Sokolovsky
parent 2486c4ff46
commit df0117c8ae
8 changed files with 80 additions and 4 deletions

View File

@@ -1395,9 +1395,6 @@ void mpz_pow_inpl(mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs) {
mpz_free(n);
}
#if 0
these functions are unused
/* computes dest = (lhs ** rhs) % mod
can have dest, lhs, rhs the same; mod can't be the same as dest
*/
@@ -1436,6 +1433,9 @@ void mpz_pow3_inpl(mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs, const mpz_t
mpz_free(n);
}
#if 0
these functions are unused
/* computes gcd(z1, z2)
based on Knuth's modified gcd algorithm (I think?)
gcd(z1, z2) >= 0