mpmul.[ch]: Move internal `HWM' and `LWM' constants to implementation.
[u/mdw/catacomb] / mpcrt.h
diff --git a/mpcrt.h b/mpcrt.h
index 5474a92..c108916 100644 (file)
--- a/mpcrt.h
+++ b/mpcrt.h
@@ -1,13 +1,13 @@
 /* -*-c-*-
  *
- * $Id: mpcrt.h,v 1.1 1999/11/22 20:50:57 mdw Exp $
+ * $Id: mpcrt.h,v 1.3 2004/04/08 01:36:15 mdw Exp $
  *
  * Chinese Remainder Theorem computations (Gauss's algorithm)
  *
  * (c) 1999 Straylight/Edgeware
  */
 
-/*----- Licensing notice --------------------------------------------------* 
+/*----- Licensing notice --------------------------------------------------*
  *
  * This file is part of Catacomb.
  *
  * it under the terms of the GNU Library General Public License as
  * published by the Free Software Foundation; either version 2 of the
  * License, or (at your option) any later version.
- * 
+ *
  * Catacomb is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU Library General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Library General Public
  * License along with Catacomb; if not, write to the Free
  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
  * MA 02111-1307, USA.
  */
 
-/*----- Revision history --------------------------------------------------* 
- *
- * $Log: mpcrt.h,v $
- * Revision 1.1  1999/11/22 20:50:57  mdw
- * Add support for solving Chinese Remainder Theorem problems.
- *
- */
-
-#ifndef MPCRT_H
-#define MPCRT_H
+#ifndef CATACOMB_MPCRT_H
+#define CATACOMB_MPCRT_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #include <stddef.h>
 
-#ifndef MP_H
+#ifndef CATACOMB_MP_H
 #  include "mp.h"
 #endif
 
-#ifndef MPMONT_H
-#  include "mpmont.h"
+#ifndef CATACOMB_MPBARRETT_H
+#  include "mpbarrett.h"
 #endif
 
 /*----- Data structures ---------------------------------------------------*/
@@ -60,12 +52,12 @@ typedef struct mpcrt_mod {
   mp *m;                               /* %$n_i$% -- the modulus */
   mp *n;                               /* %$N_i = n / n_i$% */
   mp *ni;                              /* %$M_i = N_i^{-1} \bmod n_i$% */
-  mp *nnir;                            /* %$N_i M_i R \bmod m$% */
+  mp *nni;                             /* %$N_i M_i \bmod m$% */
 } mpcrt_mod;
 
 typedef struct mpcrt {
   size_t k;                            /* Number of distinct moduli */
-  mpmont mm;                           /* Montgomery context for product */
+  mpbarrett mb;                                /* Barrett context for product */
   mpcrt_mod *v;                                /* Vector of information for each */
 } mpcrt;
 
@@ -107,6 +99,7 @@ extern void mpcrt_destroy(mpcrt */*c*/);
 /* --- @mpcrt_solve@ --- *
  *
  * Arguments:  @mpcrt *c@ = pointer to CRT context
+ *             @mp *d@ = fake destination
  *             @mp **v@ = array of residues
  *
  * Returns:    The unique solution modulo the product of the individual
@@ -121,7 +114,7 @@ extern void mpcrt_destroy(mpcrt */*c*/);
  *             exponentiation.
  */
 
-extern mp *mpcrt_solve(mpcrt */*c*/, mp **/*v*/);
+extern mp *mpcrt_solve(mpcrt */*c*/, mp */*d*/, mp **/*v*/);
 
 /*----- That's all, folks -------------------------------------------------*/