bignum.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* bignum.h-arbitrary precision integers
  2. Copyright (C) 1987 Free Software Foundation, Inc.
  3. This file is part of GAS, the GNU Assembler.
  4. GAS is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 1, or (at your option)
  7. any later version.
  8. GAS is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GAS; see the file COPYING. If not, write to
  14. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
  15. /***********************************************************************\
  16. * *
  17. * Arbitrary-precision integer arithmetic. *
  18. * For speed, we work in groups of bits, even though this *
  19. * complicates algorithms. *
  20. * Each group of bits is called a 'littlenum'. *
  21. * A bunch of littlenums representing a (possibly large) *
  22. * integer is called a 'bignum'. *
  23. * Bignums are >= 0. *
  24. * *
  25. \***********************************************************************/
  26. #define LITTLENUM_NUMBER_OF_BITS (16)
  27. #define LITTLENUM_RADIX (1 << LITTLENUM_NUMBER_OF_BITS)
  28. #define LITTLENUM_MASK (0xFFFF)
  29. #define LITTLENUM_SHIFT (1)
  30. #define CHARS_PER_LITTLENUM (1 << LITTLENUM_SHIFT)
  31. #ifndef BITS_PER_CHAR
  32. #define BITS_PER_CHAR (8)
  33. #endif
  34. typedef unsigned short int LITTLENUM_TYPE;
  35. /* JF truncated this to get around a problem with GCC */
  36. #define LOG_TO_BASE_2_OF_10 (3.3219280948873623478703194294893901758651 )
  37. /* WARNING: I haven't checked that the trailing digits are correct! */
  38. /* end: bignum.h */