Handy new comparison macros.
authormdw <mdw>
Tue, 15 Oct 2002 22:57:22 +0000 (22:57 +0000)
committermdw <mdw>
Tue, 15 Oct 2002 22:57:22 +0000 (22:57 +0000)
mp.h

diff --git a/mp.h b/mp.h
index f7a703c..bf0303a 100644 (file)
--- a/mp.h
+++ b/mp.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: mp.h,v 1.15 2002/10/15 19:18:31 mdw Exp $
+ * $Id: mp.h,v 1.16 2002/10/15 22:57:22 mdw Exp $
  *
  * Simple multiprecision arithmetic
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mp.h,v $
+ * Revision 1.16  2002/10/15 22:57:22  mdw
+ * Handy new comparison macros.
+ *
  * Revision 1.15  2002/10/15 19:18:31  mdw
  * New operation to negate numbers.
  *
@@ -839,6 +842,12 @@ extern int mp_cmp(const mp */*a*/, const mp */*b*/);
 
 #define MP_CMP(a, op, b) (mp_cmp((a), (b)) op 0)
 
+/* --- Other handy macros --- */
+
+#define MP_ISNEG(x) ((x)->f & MP_NEG)
+#define MP_ISZERO(x) MP_EQ((x), MP_ZERO)
+#define MP_ISPOS(x) (!MP_ISNEG(x) && !MP_ISZERO(x))
+
 /*----- Arithmetic operations ---------------------------------------------*/
 
 /* --- @mp_neg@ --- *