3 * $Id: mpw.h,v 1.2 1999/12/10 23:29:48 mdw Exp $
5 * Very low-level multiprecision definitions
7 * (c) 1999 Straylight/Edgeware
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of Catacomb.
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.
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.
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,
30 /*----- Revision history --------------------------------------------------*
33 * Revision 1.2 1999/12/10 23:29:48 mdw
34 * Change header file guard names.
36 * Revision 1.1 1999/11/13 01:52:34 mdw
37 * Very low-level definitions for MP types.
39 * Revision 1.1 1999/11/13 01:50:17 mdw
40 * Veyr low level definitions for MP types.
44 #ifndef CATACOMB_MPW_H
45 #define CATACOMB_MPW_H
51 /*----- Header files ------------------------------------------------------*/
53 #ifndef CATACOMB_BITS_H
54 # include <mLib/bits.h>
57 #ifndef CATACOMB_MPTYPES_H
61 /*----- Useful macros -----------------------------------------------------*/
65 * Arguments: @x@ = an unsigned value
67 * Use: Expands to the value of @x@ masked and typecast to a
68 * multiprecision integer word.
71 #define MPW(x) ((mpw)((x) & MPW_MAX))
75 * Arguments: @n@ = number of words
77 * Use: Expands to the number of bytes occupied by a given number of
81 #define MPWS(n) ((n) * sizeof(mpw))
85 * Arguments: @sz@ = size of an octet array, in octets
87 * Use: Expands to the number of @mpw@ words required to represent
88 * the number held in the octet array.
91 #define MPW_RQ(sz) (((sz) * 8 + MPW_BITS - 1) / MPW_BITS)
93 /*----- That's all, folks -------------------------------------------------*/