X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/578a86d91941a0f722b87973d88e84ec2cf9a608..a69a3efddbe1261f55e90d4ff477053ab80663a5:/mpbarrett-mexp.c diff --git a/mpbarrett-mexp.c b/mpbarrett-mexp.c index 4be854d..0338527 100644 --- a/mpbarrett-mexp.c +++ b/mpbarrett-mexp.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: mpbarrett-mexp.c,v 1.3 2004/04/08 01:36:15 mdw Exp $ + * $Id$ * * Multiple simultaneous exponentiations * @@ -63,10 +63,10 @@ mp *mpbarrett_mexp(mpbarrett *mb, mp *d, const mp_expfactor *f, size_t n) for (i = 0; i < n; i++) { if (f[i].exp->f & MP_BURN) spare = MP_NEWSEC; - if (!(f[i].exp->f & MP_NEG)) - ff[i].base = MP_COPY(f[i].base); - else + if (MP_NEGP(f[i].exp)) ff[i].base = mp_modinv(MP_NEW, f[i].base, mb->m); + else + ff[i].base = MP_COPY(f[i].base); ff[i].exp = f[i].exp; } mp_drop(g);