X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/d3409d5ecf2492cff862616de72a580d1a8e8dc0..3471ebd194145da52d419c6315459237b076e18d:/mptext.c diff --git a/mptext.c b/mptext.c index dd78bde..b216fea 100644 --- a/mptext.c +++ b/mptext.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: mptext.c,v 1.1 1999/11/17 18:02:16 mdw Exp $ + * $Id: mptext.c,v 1.3 1999/12/10 23:23:26 mdw Exp $ * * Textual representation of multiprecision numbers * @@ -30,6 +30,12 @@ /*----- Revision history --------------------------------------------------* * * $Log: mptext.c,v $ + * Revision 1.3 1999/12/10 23:23:26 mdw + * Allocate slightly less memory. + * + * Revision 1.2 1999/11/20 22:24:15 mdw + * Use function versions of MPX_UMULN and MPX_UADDN. + * * Revision 1.1 1999/11/17 18:02:16 mdw * New multiprecision integer arithmetic suite. * @@ -85,7 +91,7 @@ mp *mp_read(mp *m, int radix, const mptext_ops *ops, void *p) /* --- Initialize the destination number --- */ - MP_MODIFY(m, 16); + MP_MODIFY(m, 4); m->vl = m->v; m->f &= ~MP_UNDEF; @@ -164,10 +170,10 @@ mp *mp_read(mp *m, int radix, const mptext_ops *ops, void *p) /* --- Stick the character on the end of my integer --- */ - MP_ENSURE(m, MP_LEN(m) + 1); - MPX_UMULN(m->v, m->vl, m->v, m->vl - 1, radix); - MPX_UADDN(m->v, m->vl, x); - MP_SHRINK(m); + mp_ensure(m, MP_LEN(m) + 1); + mpx_umuln(m->v, m->vl, m->v, m->vl - 1, radix); + mpx_uaddn(m->v, m->vl, x); + mp_shrink(m); f |= f_ok; } @@ -293,6 +299,7 @@ static int verify(dstr *v) } dstr_destroy(&d); + assert(mparena_count(MPARENA_GLOBAL) == 0); return (ok); }