perftest: Document the `-q' option for disabling checking.
[u/mdw/catacomb] / mpw.h
1 /* -*-c-*-
2 *
3 * $Id: mpw.h,v 1.3 2004/04/08 01:36:15 mdw Exp $
4 *
5 * Very low-level multiprecision definitions
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 #ifndef CATACOMB_MPW_H
31 #define CATACOMB_MPW_H
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 /*----- Header files ------------------------------------------------------*/
38
39 #ifndef CATACOMB_BITS_H
40 # include <mLib/bits.h>
41 #endif
42
43 #ifndef CATACOMB_MPTYPES_H
44 # include "mptypes.h"
45 #endif
46
47 /*----- Useful macros -----------------------------------------------------*/
48
49 /* --- @MPW@ --- *
50 *
51 * Arguments: @x@ = an unsigned value
52 *
53 * Use: Expands to the value of @x@ masked and typecast to a
54 * multiprecision integer word.
55 */
56
57 #define MPW(x) ((mpw)((x) & MPW_MAX))
58
59 /* --- @MPWS@ --- *
60 *
61 * Arguments: @n@ = number of words
62 *
63 * Use: Expands to the number of bytes occupied by a given number of
64 * words.
65 */
66
67 #define MPWS(n) ((n) * sizeof(mpw))
68
69 /* --- @MPW_RQ@ --- *
70 *
71 * Arguments: @sz@ = size of an octet array, in octets
72 *
73 * Use: Expands to the number of @mpw@ words required to represent
74 * the number held in the octet array.
75 */
76
77 #define MPW_RQ(sz) (((sz) * 8 + MPW_BITS - 1) / MPW_BITS)
78
79 /*----- That's all, folks -------------------------------------------------*/
80
81 #ifdef __cplusplus
82 }
83 #endif
84
85 #endif