133965Sjdp/* bignum.h-arbitrary precision integers
2218822Sdim   Copyright 1987, 1992, 2003, 2005 Free Software Foundation, Inc.
333965Sjdp
433965Sjdp   This file is part of GAS, the GNU Assembler.
533965Sjdp
633965Sjdp   GAS is free software; you can redistribute it and/or modify
733965Sjdp   it under the terms of the GNU General Public License as published by
833965Sjdp   the Free Software Foundation; either version 2, or (at your option)
933965Sjdp   any later version.
1033965Sjdp
1133965Sjdp   GAS is distributed in the hope that it will be useful,
1233965Sjdp   but WITHOUT ANY WARRANTY; without even the implied warranty of
1333965Sjdp   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1433965Sjdp   GNU General Public License for more details.
1533965Sjdp
1633965Sjdp   You should have received a copy of the GNU General Public License
1733965Sjdp   along with GAS; see the file COPYING.  If not, write to
18218822Sdim   the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
1933965Sjdp
2033965Sjdp/***********************************************************************\
2133965Sjdp *									*
2233965Sjdp *	Arbitrary-precision integer arithmetic.				*
2333965Sjdp *	For speed, we work in groups of bits, even though this		*
2433965Sjdp *	complicates algorithms.						*
2533965Sjdp *	Each group of bits is called a 'littlenum'.			*
2633965Sjdp *	A bunch of littlenums representing a (possibly large)		*
2733965Sjdp *	integer is called a 'bignum'.					*
2833965Sjdp *	Bignums are >= 0.						*
2933965Sjdp *									*
3033965Sjdp \***********************************************************************/
3133965Sjdp
3233965Sjdp#define	LITTLENUM_NUMBER_OF_BITS	(16)
3333965Sjdp#define	LITTLENUM_RADIX			(1 << LITTLENUM_NUMBER_OF_BITS)
3433965Sjdp#define	LITTLENUM_MASK			(0xFFFF)
3533965Sjdp#define LITTLENUM_SHIFT			(1)
3633965Sjdp#define CHARS_PER_LITTLENUM		(1 << LITTLENUM_SHIFT)
3733965Sjdp#ifndef BITS_PER_CHAR
3833965Sjdp#define BITS_PER_CHAR			(8)
3933965Sjdp#endif
4033965Sjdp
4133965Sjdptypedef unsigned short LITTLENUM_TYPE;
42