Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / gnu / usr.bin / as / bignum.h
1 /* bignum.h-arbitrary precision integers
2    Copyright (C) 1987, 1992 Free Software Foundation, Inc.
3
4    This file is part of GAS, the GNU Assembler.
5
6    GAS is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2, or (at your option)
9    any later version.
10
11    GAS is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with GAS; see the file COPYING.  If not, write to
18    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
19
20 /*
21  * $FreeBSD: src/gnu/usr.bin/as/bignum.h,v 1.6 1999/08/27 23:34:13 peter Exp $
22  * $DragonFly: src/gnu/usr.bin/as/Attic/bignum.h,v 1.2 2003/06/17 04:25:44 dillon Exp $
23  */
24
25 /***********************************************************************\
26  *                                                                      *
27  *      Arbitrary-precision integer arithmetic.                         *
28  *      For speed, we work in groups of bits, even though this          *
29  *      complicates algorithms.                                         *
30  *      Each group of bits is called a 'littlenum'.                     *
31  *      A bunch of littlenums representing a (possibly large)           *
32  *      integer is called a 'bignum'.                                   *
33  *      Bignums are >= 0.                                               *
34  *                                                                      *
35  \***********************************************************************/
36
37 #define LITTLENUM_NUMBER_OF_BITS        (16)
38 #define LITTLENUM_RADIX                 (1 << LITTLENUM_NUMBER_OF_BITS)
39 #define LITTLENUM_MASK                  (0xFFFF)
40 #define LITTLENUM_SHIFT                 (1)
41 #define CHARS_PER_LITTLENUM             (1 << LITTLENUM_SHIFT)
42 #ifndef BITS_PER_CHAR
43 #define BITS_PER_CHAR                   (8)
44 #endif
45
46 typedef unsigned short LITTLENUM_TYPE;
47
48 /* JF truncated this to get around a problem with GCC */
49 #define LOG_TO_BASE_2_OF_10 (3.3219280948873623478703194294893901758651)
50 /* WARNING: I haven't checked that the trailing digits are correct! */
51
52  /* lengths are in sizeof(littlenum)s */
53 #if __STDC__ == 1
54
55 int bignum_copy(LITTLENUM_TYPE *in, int in_length,
56                 LITTLENUM_TYPE *out, int out_length);
57
58 #else
59
60 int bignum_copy();
61
62 #endif /* __STDC__ */
63
64
65 /* end of bignum.h */