py/mpz: Apply a small code-size optimisation.
This commit is contained in:
parent
2bfa531798
commit
ae1be76d40
5
py/mpz.c
5
py/mpz.c
@ -1395,8 +1395,9 @@ void mpz_pow3_inpl(mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs, const mpz_t
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rhs->len == 0) {
|
|
||||||
mpz_set_from_int(dest, 1);
|
mpz_set_from_int(dest, 1);
|
||||||
|
|
||||||
|
if (rhs->len == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1404,8 +1405,6 @@ void mpz_pow3_inpl(mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs, const mpz_t
|
|||||||
mpz_t *n = mpz_clone(rhs);
|
mpz_t *n = mpz_clone(rhs);
|
||||||
mpz_t quo; mpz_init_zero(&quo);
|
mpz_t quo; mpz_init_zero(&quo);
|
||||||
|
|
||||||
mpz_set_from_int(dest, 1);
|
|
||||||
|
|
||||||
while (n->len > 0) {
|
while (n->len > 0) {
|
||||||
if ((n->dig[0] & 1) != 0) {
|
if ((n->dig[0] & 1) != 0) {
|
||||||
mpz_mul_inpl(dest, dest, x);
|
mpz_mul_inpl(dest, dest, x);
|
||||||
|
Loading…
Reference in New Issue
Block a user