mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-25 00:11:07 +00:00
51 lines
1.7 KiB
C
51 lines
1.7 KiB
C
|
/* This file generated by gen-psqr.c - DO NOT EDIT. */
|
||
|
|
||
|
#if GMP_LIMB_BITS != 32 || GMP_NAIL_BITS != 0
|
||
|
Error, error, this data is for 32 bit limb and 0 bit nail
|
||
|
#endif
|
||
|
|
||
|
/* Non-zero bit indicates a quadratic residue mod 0x100.
|
||
|
This test identifies 82.81% as non-squares (212/256). */
|
||
|
static const mp_limb_t
|
||
|
sq_res_0x100[8] = {
|
||
|
CNST_LIMB(0x2030213),
|
||
|
CNST_LIMB(0x2020212),
|
||
|
CNST_LIMB(0x2020213),
|
||
|
CNST_LIMB(0x2020212),
|
||
|
CNST_LIMB(0x2030212),
|
||
|
CNST_LIMB(0x2020212),
|
||
|
CNST_LIMB(0x2020212),
|
||
|
CNST_LIMB(0x2020212),
|
||
|
};
|
||
|
|
||
|
/* 2^24-1 = 3^2 * 5 * 7 * 13 * 17 ... */
|
||
|
#define PERFSQR_MOD_BITS 25
|
||
|
|
||
|
/* This test identifies 95.66% as non-squares. */
|
||
|
#define PERFSQR_MOD_TEST(up, usize) \
|
||
|
do { \
|
||
|
mp_limb_t r; \
|
||
|
PERFSQR_MOD_34 (r, up, usize); \
|
||
|
\
|
||
|
/* 73.33% */ \
|
||
|
PERFSQR_MOD_2 (r, CNST_LIMB(45), CNST_LIMB(0xfa4fa5), \
|
||
|
CNST_LIMB(0x920), CNST_LIMB(0x1a442481)); \
|
||
|
\
|
||
|
/* 47.06% */ \
|
||
|
PERFSQR_MOD_1 (r, CNST_LIMB(17), CNST_LIMB(0xf0f0f1), \
|
||
|
CNST_LIMB(0x1a317)); \
|
||
|
\
|
||
|
/* 46.15% */ \
|
||
|
PERFSQR_MOD_1 (r, CNST_LIMB(13), CNST_LIMB(0xec4ec5), \
|
||
|
CNST_LIMB(0x9e5)); \
|
||
|
\
|
||
|
/* 42.86% */ \
|
||
|
PERFSQR_MOD_1 (r, CNST_LIMB( 7), CNST_LIMB(0xdb6db7), \
|
||
|
CNST_LIMB(0x69)); \
|
||
|
} while (0)
|
||
|
|
||
|
/* Grand total sq_res_0x100 and PERFSQR_MOD_TEST, 99.25% non-squares. */
|
||
|
|
||
|
/* helper for tests/mpz/t-perfsqr.c */
|
||
|
#define PERFSQR_DIVISORS { 256, 45, 17, 13, 7, }
|