/* -*-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
*
/*----- 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.
*
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
/* -*-c-*-
*
- * $Id: mp.h,v 1.3 1999/11/19 13:19:14 mdw Exp $
+ * $Id: mp.h,v 1.4 1999/11/21 22:13:02 mdw Exp $
*
* Simple multiprecision arithmetic
*
/*----- Revision history --------------------------------------------------*
*
* $Log: mp.h,v $
+ * Revision 1.4 1999/11/21 22:13:02 mdw
+ * Add mp version of MPX_BITS.
+ *
* Revision 1.3 1999/11/19 13:19:14 mdw
* Fix const annotation.
*
* integer.
*/
-extern size_t mp_octets(const mp *m);
+extern size_t mp_octets(const mp */*m*/);
+
+/* --- @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.
+ */
+
+extern unsigned long mp_bits(const mp */*m*/);
/* --- @mp_loadl@ --- *
*