X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/f09e814abfcb58c0bb5423589e2940c205106e8d..813390c45f438f411662b1a55678e63f11681eb4:/mp-io.c diff --git a/mp-io.c b/mp-io.c index 2f87892..9639a99 100644 --- a/mp-io.c +++ b/mp-io.c @@ -1,13 +1,13 @@ /* -*-c-*- * - * $Id: mp-io.c,v 1.5 2002/10/06 22:52:50 mdw Exp $ + * $Id$ * * Loading and storing of multiprecision integers * * (c) 1999 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of Catacomb. * @@ -15,40 +15,18 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * Catacomb is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with Catacomb; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: mp-io.c,v $ - * Revision 1.5 2002/10/06 22:52:50 mdw - * Pile of changes for supporting two's complement properly. - * - * Revision 1.4 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.3 1999/11/21 22:13:02 mdw - * Add mp version of MPX_BITS. - * - * Revision 1.2 1999/11/19 13:19:06 mdw - * Set flags on results correctly. - * - * Revision 1.1 1999/11/17 18:02:16 mdw - * New multiprecision integer arithmetic suite. - * - */ - /*----- Header files ------------------------------------------------------*/ #include "mp.h" @@ -242,7 +220,7 @@ mp *mp_loadl2c(mp *d, const void *pv, size_t sz) void mp_storel2c(const mp *m, void *pv, size_t sz) { - if (m->f & MP_NEG) + if (MP_NEGP(m)) mpx_storel2cn(m->v, m->vl, pv, sz); else mpx_storel(m->v, m->vl, pv, sz); @@ -266,10 +244,10 @@ mp *mp_loadb2c(mp *d, const void *pv, size_t sz) const octet *ov = pv; MP_DEST(d, MPW_RQ(sz), MP_UNDEF); if (!sz || !(ov[0] & 0x80)) { - mpx_loadl(d->v, d->vl, pv, sz); + mpx_loadb(d->v, d->vl, pv, sz); d->f &= ~MP_NEG; } else { - mpx_loadl2cn(d->v, d->vl, pv, sz); + mpx_loadb2cn(d->v, d->vl, pv, sz); d->f |= MP_NEG; } d->f &= ~MP_UNDEF; @@ -294,7 +272,7 @@ mp *mp_loadb2c(mp *d, const void *pv, size_t sz) void mp_storeb2c(const mp *m, void *pv, size_t sz) { - if (m->f & MP_NEG) + if (MP_NEGP(m)) mpx_storeb2cn(m->v, m->vl, pv, sz); else mpx_storeb(m->v, m->vl, pv, sz);