tens_in_limb.c 995 B

12345678910111213141516171819202122232425262728293031
  1. #include <gmp.h>
  2. /* Definitions according to limb size used. */
  3. #if BITS_PER_MP_LIMB == 32
  4. # define MAX_DIG_PER_LIMB 9
  5. # define MAX_FAC_PER_LIMB 1000000000UL
  6. #elif BITS_PER_MP_LIMB == 64
  7. # define MAX_DIG_PER_LIMB 19
  8. # define MAX_FAC_PER_LIMB 10000000000000000000ULL
  9. #else
  10. # error "mp_limb_t size " BITS_PER_MP_LIMB "not accounted for"
  11. #endif
  12. /* Local data structure. */
  13. const mp_limb_t _tens_in_limb[MAX_DIG_PER_LIMB + 1] =
  14. { 0, 10, 100,
  15. 1000, 10000, 100000L,
  16. 1000000L, 10000000L, 100000000L,
  17. 1000000000L
  18. #if BITS_PER_MP_LIMB > 32
  19. , 10000000000ULL, 100000000000ULL,
  20. 1000000000000ULL, 10000000000000ULL, 100000000000000ULL,
  21. 1000000000000000ULL, 10000000000000000ULL, 100000000000000000ULL,
  22. 1000000000000000000ULL, 10000000000000000000ULL
  23. #endif
  24. #if BITS_PER_MP_LIMB > 64
  25. #error "Need to expand tens_in_limb table to" MAX_DIG_PER_LIMB
  26. #endif
  27. };