/* -*-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
*
/*----- 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
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
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);
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);