Performance improvement: use @mp_sqr@ and @mpmont_reduce@ instead of
[u/mdw/catacomb] / mpmont-mexp.c
index 4180fbc..1d1266f 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: mpmont-mexp.c,v 1.1 1999/11/19 13:19:29 mdw Exp $
+ * $Id: mpmont-mexp.c,v 1.2 1999/11/21 11:35:10 mdw Exp $
  *
  * Multiplle simultaneous exponentiations
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mpmont-mexp.c,v $
+ * Revision 1.2  1999/11/21 11:35:10  mdw
+ * Performance improvement: use @mp_sqr@ and @mpmont_reduce@ instead of
+ * @mpmont_mul@ for squaring in exponentiation.
+ *
  * Revision 1.1  1999/11/19 13:19:29  mdw
  * Simultaneous exponentiation support.
  *
@@ -157,7 +161,8 @@ mp *mpmont_mexpr(mpmont *mm, mpmont_factor *f, size_t n)
     /* --- Accumulate the result --- */
 
     if (spare) {
-      dd = mpmont_mul(mm, spare, a, a);
+      dd = mp_sqr(spare, a);
+      dd = mpmont_reduce(mm, dd, dd);
       spare = a;
       a = dd;
     }