projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Quick compilation tool.
[u/mdw/catacomb]
/
mpscan.h
diff --git
a/mpscan.h
b/mpscan.h
index
6ec09cc
..
98f2a3d
100644
(file)
--- a/
mpscan.h
+++ b/
mpscan.h
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: mpscan.h,v 1.
1 1999/09/03 08:41:12
mdw Exp $
+ * $Id: mpscan.h,v 1.
3 1999/12/10 23:29:48
mdw Exp $
*
* Sequential bit scan of multiprecision integers
*
*
* Sequential bit scan of multiprecision integers
*
@@
-30,13
+30,19
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: mpscan.h,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: mpscan.h,v $
+ * Revision 1.3 1999/12/10 23:29:48 mdw
+ * Change header file guard names.
+ *
+ * Revision 1.2 1999/11/13 01:55:10 mdw
+ * Fixed so that they compile. Minor interface changes.
+ *
* Revision 1.1 1999/09/03 08:41:12 mdw
* Initial import.
*
*/
* Revision 1.1 1999/09/03 08:41:12 mdw
* Initial import.
*
*/
-#ifndef MPSCAN_H
-#define MPSCAN_H
+#ifndef
CATACOMB_
MPSCAN_H
+#define
CATACOMB_
MPSCAN_H
#ifdef __cplusplus
extern "C" {
#ifdef __cplusplus
extern "C" {
@@
-44,17
+50,16
@@
/*----- Header files ------------------------------------------------------*/
/*----- Header files ------------------------------------------------------*/
-#ifndef
MPTYPES
_H
-# include "mp
types
.h"
+#ifndef
CATACOMB_MPW
_H
+# include "mp
w
.h"
#endif
/*----- Data structures ---------------------------------------------------*/
typedef struct mpscan {
#endif
/*----- Data structures ---------------------------------------------------*/
typedef struct mpscan {
- const mpw *v
;
/* Vector of words to scan */
+ const mpw *v
, *vl;
/* Vector of words to scan */
mpw w; /* Current word to scan */
int bits; /* Number of bits left in @w@ */
mpw w; /* Current word to scan */
int bits; /* Number of bits left in @w@ */
- size_t len; /* Length of the vector in words */
} mpscan;
/*----- Functions provided ------------------------------------------------*/
} mpscan;
/*----- Functions provided ------------------------------------------------*/
@@
-62,25
+67,24
@@
typedef struct mpscan {
/* --- @mpscan_initx@ --- *
*
* Arguments: @mpscan *m@ = pointer to bitscanner structure
/* --- @mpscan_initx@ --- *
*
* Arguments: @mpscan *m@ = pointer to bitscanner structure
- * @const mpw *v@ = vector of words to scan
- * @size_t len@ = length of vector in words
+ * @const mpw *v, *vl@ = vector of words to scan
*
* Returns: ---
*
*
* Returns: ---
*
- * Use: Initializes a bitscanner from a low-level
vector-and-length
+ * Use: Initializes a bitscanner from a low-level
base-and-limit
* representation of an integer. Initially no bit is ready; you
* must call @mpscan_step@ before anything useful will come
* out.
*/
* representation of an integer. Initially no bit is ready; you
* must call @mpscan_step@ before anything useful will come
* out.
*/
-#define MPSCAN_INITX(m_, v_,
len_) do {
\
+#define MPSCAN_INITX(m_, v_,
vl_) do {
\
mpscan *_m = (m_); \
_m->v = (v_); \
mpscan *_m = (m_); \
_m->v = (v_); \
- _m->
len = (len_);
\
+ _m->
vl = (vl_);
\
_m->bits = 0; \
} while (0)
_m->bits = 0; \
} while (0)
-extern void mpscan_initx(mpscan */*m*/, const mpw */*v*/,
size_t /*len
*/);
+extern void mpscan_initx(mpscan */*m*/, const mpw */*v*/,
const mpw */*vl
*/);
/* --- @mpscan_step@ --- *
*
/* --- @mpscan_step@ --- *
*
@@
-95,9
+99,8
@@
extern void mpscan_initx(mpscan */*m*/, const mpw */*v*/, size_t /*len*/);
#define MPSCAN_STEP(m) \
((m)->bits ? ((m)->w >>= 1, \
(m)->bits--, 1) : \
#define MPSCAN_STEP(m) \
((m)->bits ? ((m)->w >>= 1, \
(m)->bits--, 1) : \
- (m)->len ? ((m)->len--, \
- (m)->w = *(m)->v++, \
- (m)->bits = MP_WBITS - 1, 1) : \
+ (m)->v < (m)->vl ? ((m)->w = *(m)->v++, \
+ (m)->bits = MPW_BITS - 1, 1) : \
0)
extern int mpscan_step(mpscan */*m*/);
0)
extern int mpscan_step(mpscan */*m*/);