Exemplo n.º 1
0
#if BITS_PER_MP_LIMB == 64
# define LIMB64(L, H) 0x ## H ## L
#elif BITS_PER_MP_LIMB == 32
# define LIMB64(L, H) 0x ## L, 0x ## H
#else
# error
#endif

/* Once upon a time these constants were generated to 400 bits.
   We only need FRAC bits (128) at present, but we retain 384 bits
   in the text Just In Case.  */
#define CONSTSZ(INT, F1, F2, F3, F4, F5, F6, F7, F8, F9, Fa, Fb, Fc) \
	LIMB64(F4, F3), LIMB64(F2, F1), INT

static const mp1 mp_exp1 = {
  CONSTSZ (2, b7e15162, 8aed2a6a, bf715880, 9cf4f3c7, 62e7160f, 38b4da56,
           a784d904, 5190cfef, 324e7738, 926cfbe5, f4bf8d8d, 8c31d763)
};

static const mp1 mp_exp_m1 = {
  CONSTSZ (0, 5e2d58d8, b3bcdf1a, badec782, 9054f90d, da9805aa, b56c7733,
           3024b9d0, a507daed, b16400bf, 472b4215, b8245b66, 9d90d27a)
};

static const mp1 mp_log2 = {
  CONSTSZ (0, b17217f7, d1cf79ab, c9e3b398, 03f2f6af, 40f34326, 7298b62d,
           8a0d175b, 8baafa2b, e7b87620, 6debac98, 559552fb, 4afa1b10)
};

static void
print_mpn_fp (const mp_limb_t *x, unsigned int dp, unsigned int base)
{
Exemplo n.º 2
0
#if BITS_PER_MP_LIMB == 64
# define LIMB64(L, H) 0x ## H ## L
#elif BITS_PER_MP_LIMB == 32
# define LIMB64(L, H) 0x ## L, 0x ## H
#else
# error
#endif

/* Once upon a time these constants were generated to 400 bits.
   We only need FRAC bits (128) at present, but we retain 384 bits
   in the text Just In Case.  */
#define CONSTSZ(INT, F1, F2, F3, F4, F5, F6, F7, F8, F9, Fa, Fb, Fc) \
	LIMB64(F4, F3), LIMB64(F2, F1), INT

static const mp1 mp_exp1 = {
  CONSTSZ (2, b7e15162, 8aed2a6a, bf715880, 9cf4f3c7, 62e7160f, 38b4da56,
           a784d904, 5190cfef, 324e7738, 926cfbe5, f4bf8d8d, 8c31d763)
};

static const mp1 mp_log2 = {
  CONSTSZ (0, b17217f7, d1cf79ab, c9e3b398, 03f2f6af, 40f34326, 7298b62d,
           8a0d175b, 8baafa2b, e7b87620, 6debac98, 559552fb, 4afa1b10)
};

static void
print_mpn_fp (const mp_limb_t *x, unsigned int dp, unsigned int base)
{
   static const char hexdig[16] = "0123456789abcdef";
   unsigned int i;
   mp1 tx;

   memcpy (tx, x, sizeof (mp1));