From: mdw Date: Thu, 19 Apr 2001 18:25:38 +0000 (+0000) Subject: Use mpmul for the multiplication. X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/commitdiff_plain/5e1601ef0d8692dd25e337e37a7c98e119e08cf0 Use mpmul for the multiplication. --- diff --git a/mpcrt.c b/mpcrt.c index de61d4b..18c622f 100644 --- a/mpcrt.c +++ b/mpcrt.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: mpcrt.c,v 1.3 2000/10/08 12:11:22 mdw Exp $ + * $Id: mpcrt.c,v 1.4 2001/04/19 18:25:38 mdw Exp $ * * Chinese Remainder Theorem computations (Gauss's algorithm) * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: mpcrt.c,v $ + * Revision 1.4 2001/04/19 18:25:38 mdw + * Use mpmul for the multiplication. + * * Revision 1.3 2000/10/08 12:11:22 mdw * Use @MP_EQ@ instead of @MP_CMP@. * @@ -45,6 +48,7 @@ #include "mp.h" #include "mpcrt.h" +#include "mpmul.h" #include "mpbarrett.h" /*----- Main code ---------------------------------------------------------*/ @@ -82,9 +86,12 @@ void mpcrt_create(mpcrt *c, mpcrt_mod *v, size_t k, mp *n) if (n != MP_NEW) n = MP_COPY(n); else { + mpmul mm; + mpmul_init(&mm); n = MP_COPY(v[0].m); - for (i = 1; i < k; i++) - n = mp_mul(n, n, v[i].m); + for (i = 0; i < k; i++) + mpmul_add(&mm, v[i].m); + n = mpmul_done(&mm); } /* --- A quick hack if %$k = 2$% --- */