Major memory management overhaul. Added arena support. Use the secure
[u/mdw/catacomb] / mpscan.c
CommitLineData
d03ab969 1/* -*-c-*-
2 *
962405ef 3 * $Id: mpscan.c,v 1.2 1999/11/13 01:55:10 mdw Exp $
d03ab969 4 *
5 * Sequential bit scan of multiprecision integers
6 *
7 * (c) 1999 Straylight/Edgeware
8 */
9
10/*----- Licensing notice --------------------------------------------------*
11 *
12 * This file is part of Catacomb.
13 *
14 * Catacomb is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
18 *
19 * Catacomb is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
23 *
24 * You should have received a copy of the GNU Library General Public
25 * License along with Catacomb; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27 * MA 02111-1307, USA.
28 */
29
30/*----- Revision history --------------------------------------------------*
31 *
32 * $Log: mpscan.c,v $
962405ef 33 * Revision 1.2 1999/11/13 01:55:10 mdw
34 * Fixed so that they compile. Minor interface changes.
35 *
d03ab969 36 * Revision 1.1 1999/09/03 08:41:12 mdw
37 * Initial import.
38 *
39 */
40
41/*----- Header files ------------------------------------------------------*/
42
962405ef 43#include "mpscan.h"
d03ab969 44
45/*----- Main code ---------------------------------------------------------*/
46
47/* --- @mpscan_initx@ --- *
48 *
49 * Arguments: @mpscan *m@ = pointer to bitscanner structure
962405ef 50 * @const mpw *v, *vl@ = vector of words to scan
d03ab969 51 *
52 * Returns: ---
53 *
54 * Use: Initializes a bitscanner from a low-level vector-and-length
55 * representation of an integer. Initially no bit is ready; you
56 * must call @mpscan_step@ before anything useful will come
57 * out.
58 */
59
962405ef 60void mpscan_initx(mpscan *m, const mpw *v, const mpw *vl)
d03ab969 61{
962405ef 62 MPSCAN_INITX(m, v, vl);
d03ab969 63}
64
65/* --- @mpscan_step@ --- *
66 *
67 * Arguments: @mpscan *m@ = pointer to bitscanner
68 *
69 * Returns: Nonzero if there is another bit to read.
70 *
71 * Use: Steps on to the next bit in the integer. The macro version
72 * evaluates its argument multiple times.
73 */
74
75int mpscan_step(mpscan *m) { return (MPSCAN_STEP(m)); }
76
77/* --- @mpscan_bit@ --- *
78 *
79 * Arguments: @const mpscan *m@ = pointer to bitscanner
80 *
81 * Returns: The value of the current bit.
82 *
83 * Use: Reads the value of the current bit looked at by a
84 * bitscanner.
85 */
86
87int mpscan_bit(const mpscan *m) { return (MPSCAN_BIT(m)); }
88
89/*----- That's all, folks -------------------------------------------------*/