xref: /dflybsd-src/contrib/binutils-2.27/gas/bignum.h (revision e656dc90e3d65d744d534af2f5ea88cf8101ebcf)
1*a9fa9459Szrj /* bignum.h-arbitrary precision integers
2*a9fa9459Szrj    Copyright (C) 1987-2016 Free Software Foundation, Inc.
3*a9fa9459Szrj 
4*a9fa9459Szrj    This file is part of GAS, the GNU Assembler.
5*a9fa9459Szrj 
6*a9fa9459Szrj    GAS is free software; you can redistribute it and/or modify
7*a9fa9459Szrj    it under the terms of the GNU General Public License as published by
8*a9fa9459Szrj    the Free Software Foundation; either version 3, or (at your option)
9*a9fa9459Szrj    any later version.
10*a9fa9459Szrj 
11*a9fa9459Szrj    GAS is distributed in the hope that it will be useful, but WITHOUT
12*a9fa9459Szrj    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13*a9fa9459Szrj    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
14*a9fa9459Szrj    License for more details.
15*a9fa9459Szrj 
16*a9fa9459Szrj    You should have received a copy of the GNU General Public License
17*a9fa9459Szrj    along with GAS; see the file COPYING.  If not, write to
18*a9fa9459Szrj    the Free Software Foundation, 51 Franklin Street - Fifth Floor,
19*a9fa9459Szrj    Boston, MA 02110-1301, USA.  */
20*a9fa9459Szrj 
21*a9fa9459Szrj /***********************************************************************\
22*a9fa9459Szrj  *									*
23*a9fa9459Szrj  *	Arbitrary-precision integer arithmetic.				*
24*a9fa9459Szrj  *	For speed, we work in groups of bits, even though this		*
25*a9fa9459Szrj  *	complicates algorithms.						*
26*a9fa9459Szrj  *	Each group of bits is called a 'littlenum'.			*
27*a9fa9459Szrj  *	A bunch of littlenums representing a (possibly large)		*
28*a9fa9459Szrj  *	integer is called a 'bignum'.					*
29*a9fa9459Szrj  *	Bignums are >= 0.						*
30*a9fa9459Szrj  *									*
31*a9fa9459Szrj  \***********************************************************************/
32*a9fa9459Szrj 
33*a9fa9459Szrj #define	LITTLENUM_NUMBER_OF_BITS	(16)
34*a9fa9459Szrj #define	LITTLENUM_RADIX			(1 << LITTLENUM_NUMBER_OF_BITS)
35*a9fa9459Szrj #define	LITTLENUM_MASK			(0xFFFF)
36*a9fa9459Szrj #define LITTLENUM_SHIFT			(1)
37*a9fa9459Szrj #define CHARS_PER_LITTLENUM		(1 << LITTLENUM_SHIFT)
38*a9fa9459Szrj #ifndef BITS_PER_CHAR
39*a9fa9459Szrj #define BITS_PER_CHAR			(8)
40*a9fa9459Szrj #endif
41*a9fa9459Szrj 
42*a9fa9459Szrj typedef unsigned short LITTLENUM_TYPE;
43