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