Use @MP_EQ@ instead of @MP_CMP@.
[u/mdw/catacomb] / mp-arith.c
index c67fdd8..96fdeb8 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: mp-arith.c,v 1.7 2000/06/22 19:02:53 mdw Exp $
+ * $Id: mp-arith.c,v 1.8 2000/10/08 12:02:21 mdw Exp $
  *
  * Basic arithmetic on multiprecision integers
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mp-arith.c,v $
+ * Revision 1.8  2000/10/08 12:02:21  mdw
+ * Use @MP_EQ@ instead of @MP_CMP@.
+ *
  * Revision 1.7  2000/06/22 19:02:53  mdw
  * New function @mp_odd@ to extract powers of two from an integer.  This is
  * common code from the Rabin-Miller test, RSA key recovery and modular
@@ -143,6 +146,15 @@ mp *mp_lsr(mp *d, mp *a, size_t n)
   return (d);
 }
 
+/* --- @mp_eq@ --- *
+ *
+ * Arguments:  @const mp *a, *b@ = two numbers
+ *
+ * Returns:    Nonzero if the numbers are equal.
+ */
+
+int mp_eq(const mp *a, const mp *b) { return (MP_EQ(a, b)); }
+
 /* --- @mp_cmp@ --- *
  *
  * Arguments:  @const mp *a, *b@ = two numbers
@@ -418,7 +430,7 @@ mp *mp_odd(mp *d, mp *m, size_t *s)
 
 static int verify(const char *op, mp *expect, mp *result, mp *a, mp *b)
 {
-  if (MP_CMP(expect, !=, result)) {
+  if (!MP_EQ(expect, result)) {
     fprintf(stderr, "\n*** %s failed", op);
     fputs("\n*** a      = ", stderr); mp_writefile(a, stderr, 10);
     fputs("\n*** b      = ", stderr); mp_writefile(b, stderr, 10);
@@ -495,7 +507,7 @@ static int todd(dstr *v)
   mp *t;
   size_t s;
   t = mp_odd(MP_NEW, a, &s);
-  if (s != rs || MP_CMP(t, !=, rt)) {
+  if (s != rs || !MP_EQ(t, rt)) {
     ok = 0;
     fprintf(stderr, "\n*** odd failed");
     fputs("\n*** a  = ", stderr); mp_writefile(a, stderr, 10);