X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/8582bb3b6cbec5206ab0a9f8c06b3de8a75e1454..24e1e862d1cf06eb08af7c44468c1d12fcffc747:/mp-io.c diff --git a/mp-io.c b/mp-io.c index 1592269..8e76917 100644 --- a/mp-io.c +++ b/mp-io.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: mp-io.c,v 1.2 1999/11/19 13:19:06 mdw Exp $ + * $Id: mp-io.c,v 1.3 1999/11/21 22:13:02 mdw Exp $ * * Loading and storing of multiprecision integers * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: mp-io.c,v $ + * 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. * @@ -61,6 +64,23 @@ size_t mp_octets(const mp *m) return (sz); } +/* --- @mp_bits@ --- * + * + * Arguments: @const mp *m@ = a multiprecision integer + * + * Returns: The number of bits required to represent @m@. + * + * Use: Calculates the external storage required for a multiprecision + * integer. + */ + +unsigned long mp_bits(const mp *m) +{ + unsigned long bits; + MPX_BITS(bits, m->v, m->vl); + return (bits); +} + /* --- @mp_loadl@ --- * * * Arguments: @mp *d@ = destination