projects
/
u
/
mdw
/
catacomb
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8582bb3
)
Add mp version of MPX_BITS.
author
mdw
<mdw>
Sun, 21 Nov 1999 22:13:02 +0000
(22:13 +0000)
committer
mdw
<mdw>
Sun, 21 Nov 1999 22:13:02 +0000
(22:13 +0000)
mp-io.c
patch
|
blob
|
blame
|
history
mp.h
patch
|
blob
|
blame
|
history
diff --git
a/mp-io.c
b/mp-io.c
index
1592269
..
8e76917
100644
(file)
--- a/
mp-io.c
+++ b/
mp-io.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-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
*
*
* Loading and storing of multiprecision integers
*
@@
-30,6
+30,9
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: mp-io.c,v $
/*----- 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.
*
* 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);
}
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
/* --- @mp_loadl@ --- *
*
* Arguments: @mp *d@ = destination
diff --git
a/mp.h
b/mp.h
index
6f8959a
..
13bcd3d
100644
(file)
--- a/
mp.h
+++ b/
mp.h
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-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
*
*
* Simple multiprecision arithmetic
*
@@
-30,6
+30,9
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: mp.h,v $
/*----- 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.
*
* Revision 1.3 1999/11/19 13:19:14 mdw
* Fix const annotation.
*
@@
-424,7
+427,19
@@
extern void mp_scan(mpscan */*sc*/, const mp */*m*/);
* integer.
*/
* 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@ --- *
*
/* --- @mp_loadl@ --- *
*