chiark
/
gitweb
/
~mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Release 2.5.0.
[catacomb]
/
math
/
mpreduce.h
diff --git
a/math/mpreduce.h
b/math/mpreduce.h
index c90c93fb64979e9668ef7121db4f48b113a688f9..b6eb2d7cfc895bb177db969c27e183277fc34e00 100644
(file)
--- a/
math/mpreduce.h
+++ b/
math/mpreduce.h
@@
-34,6
+34,12
@@
/*----- Header files ------------------------------------------------------*/
/*----- Header files ------------------------------------------------------*/
+#include <stdio.h>
+
+#ifndef CATACOMB_MP_H
+# include "mp.h"
+#endif
+
/*----- Data structures ---------------------------------------------------*/
typedef struct mpreduce_instr {
/*----- Data structures ---------------------------------------------------*/
typedef struct mpreduce_instr {
@@
-64,7
+70,10
@@
typedef struct mpreduce {
* Arguments: @gfreduce *r@ = structure to fill in
* @mp *x@ = an integer
*
* Arguments: @gfreduce *r@ = structure to fill in
* @mp *x@ = an integer
*
- * Returns: Zero for success, nonzero on error.
+ * Returns: Zero if successful; nonzero on failure. The current
+ * algorithm always succeeds when given positive @x@. Earlier
+ * versions used to fail on particular kinds of integers, but
+ * this is guaranteed not to happen any more.
*
* Use: Initializes a context structure for reduction.
*/
*
* Use: Initializes a context structure for reduction.
*/
@@
-84,7
+93,7
@@
extern void mpreduce_destroy(mpreduce */*r*/);
/* --- @mpreduce_dump@ --- *
*
/* --- @mpreduce_dump@ --- *
*
- * Arguments: @mpreduce *r@ = structure to dump
+ * Arguments: @
const
mpreduce *r@ = structure to dump
* @FILE *fp@ = file to dump on
*
* Returns: ---
* @FILE *fp@ = file to dump on
*
* Returns: ---
@@
-92,7
+101,7
@@
extern void mpreduce_destroy(mpreduce */*r*/);
* Use: Dumps a reduction context.
*/
* Use: Dumps a reduction context.
*/
-extern void mpreduce_dump(mpreduce */*r*/, FILE */*fp*/);
+extern void mpreduce_dump(
const
mpreduce */*r*/, FILE */*fp*/);
/* --- @mpreduce_do@ --- *
*
/* --- @mpreduce_do@ --- *
*
@@
-103,11
+112,11
@@
extern void mpreduce_dump(mpreduce */*r*/, FILE */*fp*/);
* Returns: Destination, @x@ reduced modulo the reduction poly.
*/
* Returns: Destination, @x@ reduced modulo the reduction poly.
*/
-extern mp *mpreduce_do(mpreduce */*r*/, mp */*d*/, mp */*x*/);
+extern mp *mpreduce_do(
const
mpreduce */*r*/, mp */*d*/, mp */*x*/);
/* --- @mpreduce_exp@ --- *
*
/* --- @mpreduce_exp@ --- *
*
- * Arguments: @mpreduce *mr@ = pointer to reduction context
+ * Arguments: @
const
mpreduce *mr@ = pointer to reduction context
* @mp *d@ = fake destination
* @mp *a@ = base
* @mp *e@ = exponent
* @mp *d@ = fake destination
* @mp *a@ = base
* @mp *e@ = exponent
@@
-115,7
+124,8
@@
extern mp *mpreduce_do(mpreduce */*r*/, mp */*d*/, mp */*x*/);
* Returns: Result, %$a^e \bmod m$%.
*/
* Returns: Result, %$a^e \bmod m$%.
*/
-extern mp *mpreduce_exp(mpreduce */*mr*/, mp */*d*/, mp */*a*/, mp */*e*/);
+extern mp *mpreduce_exp(const mpreduce */*mr*/, mp */*d*/,
+ mp */*a*/, mp */*e*/);
/*----- That's all, folks -------------------------------------------------*/
/*----- That's all, folks -------------------------------------------------*/