summaryrefslogtreecommitdiff
path: root/vere/ext/gmp/gen/x86_64-macos/mpn/perfsqr.h
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-10-05 21:56:51 +0700
committerpolwex <polwex@sortug.com>2025-10-05 21:56:51 +0700
commitfcedfddf00b3f994e4f4e40332ac7fc192c63244 (patch)
tree51d38e62c7bdfcc5f9a5e9435fe820c93cfc9a3d /vere/ext/gmp/gen/x86_64-macos/mpn/perfsqr.h
claude is gud
Diffstat (limited to 'vere/ext/gmp/gen/x86_64-macos/mpn/perfsqr.h')
-rw-r--r--vere/ext/gmp/gen/x86_64-macos/mpn/perfsqr.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/vere/ext/gmp/gen/x86_64-macos/mpn/perfsqr.h b/vere/ext/gmp/gen/x86_64-macos/mpn/perfsqr.h
new file mode 100644
index 0000000..80c5eb7
--- /dev/null
+++ b/vere/ext/gmp/gen/x86_64-macos/mpn/perfsqr.h
@@ -0,0 +1,46 @@
+/* This file generated by gen-psqr.c - DO NOT EDIT. */
+
+#if GMP_LIMB_BITS != 64 || GMP_NAIL_BITS != 0
+Error, error, this data is for 64 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[4] = {
+ CNST_LIMB(0x202021202030213),
+ CNST_LIMB(0x202021202020213),
+ CNST_LIMB(0x202021202030212),
+ CNST_LIMB(0x202021202020212),
+};
+
+/* 2^48-1 = 3^2 * 5 * 7 * 13 * 17 * 97 ... */
+#define PERFSQR_MOD_BITS 49
+
+/* This test identifies 97.81% as non-squares. */
+#define PERFSQR_MOD_TEST(up, usize) \
+ do { \
+ mp_limb_t r; \
+ PERFSQR_MOD_34 (r, up, usize); \
+ \
+ /* 69.23% */ \
+ PERFSQR_MOD_2 (r, CNST_LIMB(91), CNST_LIMB(0xfd2fd2fd2fd3), \
+ CNST_LIMB(0x2191240), CNST_LIMB(0x8850a206953820e1)); \
+ \
+ /* 68.24% */ \
+ PERFSQR_MOD_2 (r, CNST_LIMB(85), CNST_LIMB(0xfcfcfcfcfcfd), \
+ CNST_LIMB(0x82158), CNST_LIMB(0x10b48c4b4206a105)); \
+ \
+ /* 55.56% */ \
+ PERFSQR_MOD_1 (r, CNST_LIMB( 9), CNST_LIMB(0xe38e38e38e39), \
+ CNST_LIMB(0x93)); \
+ \
+ /* 49.48% */ \
+ PERFSQR_MOD_2 (r, CNST_LIMB(97), CNST_LIMB(0xfd5c5f02a3a1), \
+ CNST_LIMB(0x1eb628b47), CNST_LIMB(0x6067981b8b451b5f)); \
+ } while (0)
+
+/* Grand total sq_res_0x100 and PERFSQR_MOD_TEST, 99.62% non-squares. */
+
+/* helper for tests/mpz/t-perfsqr.c */
+#define PERFSQR_DIVISORS { 256, 91, 85, 9, 97, }