X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/3563e36580c7dad68cd6d3f7eb82eef570fc0c76..02d7884df1f33c9c7dc3a14c4b1a5f520ebe090a:/mp.h diff --git a/mp.h b/mp.h index c38bb3c..bfed14a 100644 --- a/mp.h +++ b/mp.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: mp.h,v 1.17 2003/05/16 09:09:24 mdw Exp $ + * $Id: mp.h,v 1.18 2004/04/03 03:32:05 mdw Exp $ * * Simple multiprecision arithmetic * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: mp.h,v $ + * Revision 1.18 2004/04/03 03:32:05 mdw + * General robustification. + * * Revision 1.17 2003/05/16 09:09:24 mdw * Fix @mp_lsl2c@. Turns out to be surprisingly tricky. * @@ -854,8 +857,10 @@ extern int mp_cmp(const mp */*a*/, const mp */*b*/); /* --- Other handy macros --- */ #define MP_ISNEG(x) ((x)->f & MP_NEG) -#define MP_ISZERO(x) MP_EQ((x), MP_ZERO) +#define MP_ISZERO(x) (!MP_LEN(x)) #define MP_ISPOS(x) (!MP_ISNEG(x) && !MP_ISZERO(x)) +#define MP_ISODD(x) (!MP_ISZERO(x) && ((x)->v[0] & 1u)) +#define MP_ISEVEN(x) (!MP_ISODD(x)) /*----- Arithmetic operations ---------------------------------------------*/