X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/92c2a29042b4e2b5b4429f9848dc22fd92acb0d8..1589affab225db500965e2cb869c534d6860e6bd:/mpint.h diff --git a/mpint.h b/mpint.h index f75d5aa..ed614a8 100644 --- a/mpint.h +++ b/mpint.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: mpint.h,v 1.2 1999/12/10 23:22:53 mdw Exp $ + * $Id: mpint.h,v 1.5 2002/01/13 19:23:16 mdw Exp $ * * Conversion between MPs and standard C integers * @@ -30,6 +30,17 @@ /*----- Revision history --------------------------------------------------* * * $Log: mpint.h,v $ + * Revision 1.5 2002/01/13 19:23:16 mdw + * Fix division-by-zero bug translating @MPW_MAX@ to an @mp@. + * + * Revision 1.4 2000/10/08 12:04:01 mdw + * Remove spurious semicolon. + * + * Revision 1.3 2000/06/17 11:45:09 mdw + * Major memory management overhaul. Added arena support. Use the secure + * arena for secret integers. Replace and improve the MP management macros + * (e.g., replace MP_MODIFY by MP_DEST). + * * Revision 1.2 1999/12/10 23:22:53 mdw * Support for uint32. * @@ -71,7 +82,7 @@ mp *_d = (d); \ size_t _sz = 4; \ \ - MP_MODIFY(_d, _sz); \ + MP_DEST(_d, _sz, 0); \ _d->f &= ~(MP_NEG | MP_UNDEF); \ \ /* --- Set the sign on the MP --- * \ @@ -105,7 +116,7 @@ * up all of my negative arithmetic. So do an explicit test here. \ */ \ \ - if (_i > -MPW_MAX) \ + if (_i >= -MPW_MAX) \ break; \ else \ _i /= (type)MPW_MAX + 1; \ @@ -191,7 +202,7 @@ mp_fromINT(ulong, unsigned long); */ #define mp_toINT(name, type) \ - extern type mp_to##name(const mp */*m*/); + extern type mp_to##name(const mp */*m*/) mp_toINT(short, short); mp_toINT(ushort, unsigned short);