X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/b817bfc642225b8c3c0b6a7e42d1fb949b61a606..025c5f4aa5ffbf8948482a4233318db81c2df5d2:/mptext.c diff --git a/mptext.c b/mptext.c index 8130679..9cca8a8 100644 --- a/mptext.c +++ b/mptext.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: mptext.c,v 1.18 2004/04/08 01:36:15 mdw Exp $ + * $Id$ * * Textual representation of multiprecision numbers * @@ -155,7 +155,7 @@ mp *mp_read(mp *m, int radix, const mptext_ops *ops, void *p) r = -1; } else if (radix < 0) { rd = -radix; - assert(((void)"binary radix must fit in a byte", rd < UCHAR_MAX)); + assert(((void)"binary radix must fit in a byte", rd <= UCHAR_MAX)); r = -1; } else if (ch != '0') { rd = 10; @@ -542,7 +542,7 @@ static int complicated(mp *m, int radix, mp **pr, unsigned i, unsigned z, assert(i); mp_div(&q, &m, m, pr[i]); - if (!MP_LEN(q)) + if (MP_ZEROP(q)) d = z; else { if (z > d) @@ -669,13 +669,13 @@ int mp_write(mp *m, int radix, const mptext_ops *ops, void *p) if (radix > 0) assert(((void)"ascii radix must be <= 62", radix <= 62)); else if (radix < 0) - assert(((void)"binary radix must fit in a byte", -radix < UCHAR_MAX)); + assert(((void)"binary radix must fit in a byte", -radix <= UCHAR_MAX)); else assert(((void)"radix can't be zero in mp_write", 0)); /* --- If the number is negative, sort that out --- */ - if (m->f & MP_NEG) { + if (MP_NEGP(m)) { if (ops->put("-", 1, p)) return (EOF); m->f &= ~MP_NEG;