aboutsummaryrefslogtreecommitdiff
path: root/vendor/gmp-6.3.0/tests
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gmp-6.3.0/tests')
-rw-r--r--vendor/gmp-6.3.0/tests/Makefile.am40
-rw-r--r--vendor/gmp-6.3.0/tests/Makefile.in1369
-rw-r--r--vendor/gmp-6.3.0/tests/amd64call.asm167
-rw-r--r--vendor/gmp-6.3.0/tests/amd64check.c111
-rw-r--r--vendor/gmp-6.3.0/tests/arm32call.asm83
-rw-r--r--vendor/gmp-6.3.0/tests/arm32check.c95
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/Makefile.am87
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/Makefile.in1445
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/clocale.c66
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-assign.cc603
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-binary.cc465
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-cast.cc56
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-constr.cc755
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-cxx11.cc232
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc38
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-headers.cc26
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-iostream.cc106
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-istream.cc598
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-locale.cc194
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-misc.cc397
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-mix.cc82
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-ops.cc753
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-ops2.h82
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-ops2f.cc87
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-ops2qf.cc89
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-ops2z.cc126
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-ops3.cc132
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-ostream.cc449
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-prec.cc216
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-rand.cc148
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-ternary.cc734
-rw-r--r--vendor/gmp-6.3.0/tests/cxx/t-unary.cc132
-rw-r--r--vendor/gmp-6.3.0/tests/devel/Makefile.am47
-rw-r--r--vendor/gmp-6.3.0/tests/devel/Makefile.in673
-rw-r--r--vendor/gmp-6.3.0/tests/devel/README37
-rw-r--r--vendor/gmp-6.3.0/tests/devel/gen-test-longlong_h.c140
-rw-r--r--vendor/gmp-6.3.0/tests/devel/primes.c424
-rw-r--r--vendor/gmp-6.3.0/tests/devel/sqrtrem_1_2.c401
-rw-r--r--vendor/gmp-6.3.0/tests/devel/try.c3658
-rw-r--r--vendor/gmp-6.3.0/tests/memory.c246
-rw-r--r--vendor/gmp-6.3.0/tests/misc.c608
-rw-r--r--vendor/gmp-6.3.0/tests/misc/Makefile.am34
-rw-r--r--vendor/gmp-6.3.0/tests/misc/Makefile.in1041
-rw-r--r--vendor/gmp-6.3.0/tests/misc/t-locale.c197
-rw-r--r--vendor/gmp-6.3.0/tests/misc/t-printf.c955
-rw-r--r--vendor/gmp-6.3.0/tests/misc/t-scanf.c1615
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/Makefile.am32
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/Makefile.in1452
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/reuse.c218
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-add.c107
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-cmp_d.c103
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-cmp_si.c134
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-conv.c261
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-div.c185
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-dm2exp.c118
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-eq.c217
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-fits.c327
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-get_d.c106
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-get_d_2exp.c136
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-get_si.c222
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-get_ui.c127
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-gsprec.c61
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-inp_str.c191
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-int_p.c90
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-mul_ui.c164
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-muldiv.c158
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-pow_ui.c69
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-set.c112
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-set_q.c126
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-set_si.c90
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-set_ui.c89
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-sqrt.c193
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-sqrt_ui.c125
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-sub.c287
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-trunc.c270
-rw-r--r--vendor/gmp-6.3.0/tests/mpf/t-ui_div.c151
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/Makefile.am40
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/Makefile.in1874
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/logic.c133
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-addaddmul.c98
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-aors_1.c310
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-asmtype.c63
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-bdiv.c354
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-broot.c108
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-brootinv.c96
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-div.c497
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-divrem_1.c123
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-fat.c310
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-fib2m.c344
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-gcd_11.c86
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-gcd_22.c87
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-gcdext_1.c134
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-get_d.c497
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-hgcd.c406
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-hgcd_appr.c563
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-instrument.c415
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-invert.c151
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-iord_u.c220
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-matrix22.c206
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-minvert.c167
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-mod_1.c127
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-mp_bases.c104
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-mul.c97
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-mullo.c132
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-mulmid.c92
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-mulmod_bknp1.c202
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-mulmod_bnm1.c210
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-perfsqr.c116
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-scan.c144
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-sizeinbase.c98
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-sqrlo.c129
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-sqrmod_bknp1.c251
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-sqrmod_bnm1.c182
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-toom2-sqr.c86
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-toom22.c10
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-toom3-sqr.c6
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-toom32.c8
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-toom33.c11
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-toom4-sqr.c6
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-toom42.c8
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-toom43.c8
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-toom44.c11
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-toom52.c8
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-toom53.c8
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-toom54.c8
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-toom6-sqr.c8
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-toom62.c8
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-toom63.c8
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-toom6h.c13
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-toom8-sqr.c8
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/t-toom8h.c19
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/toom-shared.h148
-rw-r--r--vendor/gmp-6.3.0/tests/mpn/toom-sqr-shared.h125
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/Makefile.am35
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/Makefile.in1241
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/io.c136
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/reuse.c245
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-aors.c182
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-cmp.c101
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-cmp_si.c117
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-cmp_ui.c116
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-cmp_z.c146
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-equal.c146
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-get_d.c294
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-get_str.c142
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-inp_str.c171
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-inv.c60
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-md_2exp.c244
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-set_f.c169
-rw-r--r--vendor/gmp-6.3.0/tests/mpq/t-set_str.c102
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/Makefile.am43
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/Makefile.in2059
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/convert.c186
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/dive.c100
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/dive_ui.c86
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/io.c151
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/logic.c194
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/reuse.c786
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-addsub.c121
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-aorsmul.c464
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-bin.c328
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-bit.c405
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-cdiv_ui.c158
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-cmp.c181
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-cmp_d.c292
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-cmp_si.c101
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-cong.c226
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-cong_2exp.c207
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-div_2exp.c223
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-divis.c166
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-divis_2exp.c132
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-export.c205
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-fac_ui.c108
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-fdiv.c146
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-fdiv_ui.c158
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-fib_ui.c155
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-fits.c197
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-gcd.c467
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-gcd_ui.c156
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-get_d.c80
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-get_d_2exp.c222
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-get_si.c121
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-hamdist.c123
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-import.c175
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-inp_str.c198
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-invert.c117
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-io_raw.c286
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-jac.c1008
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-lcm.c184
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-limbs.c232
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-lucm.c144
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-lucnum_ui.c96
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-mfac_uiui.c135
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-mul.c221
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-mul_i.c134
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-nextprime.c459
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-oddeven.c87
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-perfpow.c247
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-perfsqr.c154
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-popcount.c167
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-pow.c217
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-powm.c263
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-powm_ui.c127
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-pprime_p.c243
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-primorial_ui.c145
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-remove.c146
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-root.c174
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-scan.c131
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-set_d.c139
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-set_f.c125
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-set_si.c96
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-set_str.c108
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-sizeinbase.c89
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-sqrtrem.c122
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-tdiv.c145
-rw-r--r--vendor/gmp-6.3.0/tests/mpz/t-tdiv_ui.c158
-rw-r--r--vendor/gmp-6.3.0/tests/rand/Makefile.am90
-rw-r--r--vendor/gmp-6.3.0/tests/rand/Makefile.in1215
-rw-r--r--vendor/gmp-6.3.0/tests/rand/findlc.c251
-rw-r--r--vendor/gmp-6.3.0/tests/rand/gen.c480
-rw-r--r--vendor/gmp-6.3.0/tests/rand/gmpstat.h75
-rw-r--r--vendor/gmp-6.3.0/tests/rand/spect.c136
-rw-r--r--vendor/gmp-6.3.0/tests/rand/stat.c406
-rw-r--r--vendor/gmp-6.3.0/tests/rand/statlib.c836
-rw-r--r--vendor/gmp-6.3.0/tests/rand/t-iset.c67
-rw-r--r--vendor/gmp-6.3.0/tests/rand/t-lc2exp.c216
-rw-r--r--vendor/gmp-6.3.0/tests/rand/t-mt.c82
-rw-r--r--vendor/gmp-6.3.0/tests/rand/t-rand.c290
-rw-r--r--vendor/gmp-6.3.0/tests/rand/t-urbui.c64
-rw-r--r--vendor/gmp-6.3.0/tests/rand/t-urmui.c74
-rw-r--r--vendor/gmp-6.3.0/tests/rand/t-urndmm.c158
-rw-r--r--vendor/gmp-6.3.0/tests/rand/zdiv_round.c43
-rw-r--r--vendor/gmp-6.3.0/tests/refmpf.c427
-rw-r--r--vendor/gmp-6.3.0/tests/refmpn.c2630
-rw-r--r--vendor/gmp-6.3.0/tests/refmpq.c40
-rw-r--r--vendor/gmp-6.3.0/tests/refmpz.c343
-rw-r--r--vendor/gmp-6.3.0/tests/spinner.c128
-rw-r--r--vendor/gmp-6.3.0/tests/t-bswap.c70
-rw-r--r--vendor/gmp-6.3.0/tests/t-constants.c343
-rw-r--r--vendor/gmp-6.3.0/tests/t-count_zeros.c86
-rw-r--r--vendor/gmp-6.3.0/tests/t-hightomask.c42
-rw-r--r--vendor/gmp-6.3.0/tests/t-modlinv.c83
-rw-r--r--vendor/gmp-6.3.0/tests/t-parity.c66
-rw-r--r--vendor/gmp-6.3.0/tests/t-popc.c79
-rw-r--r--vendor/gmp-6.3.0/tests/t-sub.c114
-rw-r--r--vendor/gmp-6.3.0/tests/tests.h447
-rw-r--r--vendor/gmp-6.3.0/tests/trace.c317
-rw-r--r--vendor/gmp-6.3.0/tests/x86call.asm154
-rw-r--r--vendor/gmp-6.3.0/tests/x86check.c117
249 files changed, 64476 insertions, 0 deletions
diff --git a/vendor/gmp-6.3.0/tests/Makefile.am b/vendor/gmp-6.3.0/tests/Makefile.am
new file mode 100644
index 0000000..ff42b66
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/Makefile.am
@@ -0,0 +1,40 @@
+## Process this file with automake to generate Makefile.in
+
+# Copyright 2000-2004, 2013 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+
+
+SUBDIRS = . devel mpn mpz mpq mpf rand misc cxx
+
+include ../mpn/Makeasm.am
+
+AM_CPPFLAGS = -I$(top_srcdir)
+AM_LDFLAGS = -no-install
+LDADD = libtests.la $(top_builddir)/libgmp.la
+
+check_LTLIBRARIES = libtests.la
+
+EXTRA_libtests_la_SOURCES = amd64call.asm amd64check.c x86call.asm x86check.c \
+ arm32call.asm arm32check.c
+libtests_la_SOURCES = tests.h \
+ memory.c misc.c refmpf.c refmpn.c refmpq.c refmpz.c spinner.c trace.c
+libtests_la_DEPENDENCIES = @CALLING_CONVENTIONS_OBJS@
+libtests_la_LIBADD = $(libtests_la_DEPENDENCIES) $(top_builddir)/libgmp.la
+
+check_PROGRAMS = t-bswap t-constants t-count_zeros t-hightomask \
+ t-modlinv t-popc t-parity t-sub
+TESTS = $(check_PROGRAMS)
diff --git a/vendor/gmp-6.3.0/tests/Makefile.in b/vendor/gmp-6.3.0/tests/Makefile.in
new file mode 100644
index 0000000..073c9f3
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/Makefile.in
@@ -0,0 +1,1369 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 2000-2004, 2013 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+
+# Copyright 1996, 1998-2002 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library.
+#
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of either:
+#
+# * the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# or
+#
+# * the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# or both in parallel, as here.
+#
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received copies of the GNU General Public License and the
+# GNU Lesser General Public License along with the GNU MP Library. If not,
+# see https://www.gnu.org/licenses/.
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+check_PROGRAMS = t-bswap$(EXEEXT) t-constants$(EXEEXT) \
+ t-count_zeros$(EXEEXT) t-hightomask$(EXEEXT) \
+ t-modlinv$(EXEEXT) t-popc$(EXEEXT) t-parity$(EXEEXT) \
+ t-sub$(EXEEXT)
+subdir = tests
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__DEPENDENCIES_1 =
+am_libtests_la_OBJECTS = memory.lo misc.lo refmpf.lo refmpn.lo \
+ refmpq.lo refmpz.lo spinner.lo trace.lo
+libtests_la_OBJECTS = $(am_libtests_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+t_bswap_SOURCES = t-bswap.c
+t_bswap_OBJECTS = t-bswap.$(OBJEXT)
+t_bswap_LDADD = $(LDADD)
+t_bswap_DEPENDENCIES = libtests.la $(top_builddir)/libgmp.la
+t_constants_SOURCES = t-constants.c
+t_constants_OBJECTS = t-constants.$(OBJEXT)
+t_constants_LDADD = $(LDADD)
+t_constants_DEPENDENCIES = libtests.la $(top_builddir)/libgmp.la
+t_count_zeros_SOURCES = t-count_zeros.c
+t_count_zeros_OBJECTS = t-count_zeros.$(OBJEXT)
+t_count_zeros_LDADD = $(LDADD)
+t_count_zeros_DEPENDENCIES = libtests.la $(top_builddir)/libgmp.la
+t_hightomask_SOURCES = t-hightomask.c
+t_hightomask_OBJECTS = t-hightomask.$(OBJEXT)
+t_hightomask_LDADD = $(LDADD)
+t_hightomask_DEPENDENCIES = libtests.la $(top_builddir)/libgmp.la
+t_modlinv_SOURCES = t-modlinv.c
+t_modlinv_OBJECTS = t-modlinv.$(OBJEXT)
+t_modlinv_LDADD = $(LDADD)
+t_modlinv_DEPENDENCIES = libtests.la $(top_builddir)/libgmp.la
+t_parity_SOURCES = t-parity.c
+t_parity_OBJECTS = t-parity.$(OBJEXT)
+t_parity_LDADD = $(LDADD)
+t_parity_DEPENDENCIES = libtests.la $(top_builddir)/libgmp.la
+t_popc_SOURCES = t-popc.c
+t_popc_OBJECTS = t-popc.$(OBJEXT)
+t_popc_LDADD = $(LDADD)
+t_popc_DEPENDENCIES = libtests.la $(top_builddir)/libgmp.la
+t_sub_SOURCES = t-sub.c
+t_sub_OBJECTS = t-sub.$(OBJEXT)
+t_sub_LDADD = $(LDADD)
+t_sub_DEPENDENCIES = libtests.la $(top_builddir)/libgmp.la
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(libtests_la_SOURCES) $(EXTRA_libtests_la_SOURCES) \
+ t-bswap.c t-constants.c t-count_zeros.c t-hightomask.c \
+ t-modlinv.c t-parity.c t-popc.c t-sub.c
+DIST_SOURCES = $(libtests_la_SOURCES) $(EXTRA_libtests_la_SOURCES) \
+ t-bswap.c t-constants.c t-count_zeros.c t-hightomask.c \
+ t-modlinv.c t-parity.c t-popc.c t-sub.c
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+ ctags-recursive dvi-recursive html-recursive info-recursive \
+ install-data-recursive install-dvi-recursive \
+ install-exec-recursive install-html-recursive \
+ install-info-recursive install-pdf-recursive \
+ install-ps-recursive install-recursive installcheck-recursive \
+ installdirs-recursive pdf-recursive ps-recursive \
+ tags-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+am__recursive_targets = \
+ $(RECURSIVE_TARGETS) \
+ $(RECURSIVE_CLEAN_TARGETS) \
+ $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
+ check recheck distdir
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = { \
+ $(am__tty_colors_dummy); \
+ if test "X$(AM_COLOR_TESTS)" = Xno; then \
+ am__color_tests=no; \
+ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+ am__color_tests=yes; \
+ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+ am__color_tests=yes; \
+ fi; \
+ if test $$am__color_tests = yes; then \
+ red=''; \
+ grn=''; \
+ lgn=''; \
+ blu=''; \
+ mgn=''; \
+ brg=''; \
+ std=''; \
+ fi; \
+}
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__recheck_rx = ^[ ]*:recheck:[ ]*
+am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
+am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+ recheck = 1; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ { \
+ if ((getline line2 < ($$0 ".log")) < 0) \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+ { \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+ { \
+ break; \
+ } \
+ }; \
+ if (recheck) \
+ print $$0; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+ print "fatal: making $@: " msg | "cat >&2"; \
+ exit 1; \
+} \
+function rst_section(header) \
+{ \
+ print header; \
+ len = length(header); \
+ for (i = 1; i <= len; i = i + 1) \
+ printf "="; \
+ printf "\n\n"; \
+} \
+{ \
+ copy_in_global_log = 1; \
+ global_test_result = "RUN"; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".trs"); \
+ if (line ~ /$(am__global_test_result_rx)/) \
+ { \
+ sub("$(am__global_test_result_rx)", "", line); \
+ sub("[ ]*$$", "", line); \
+ global_test_result = line; \
+ } \
+ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+ copy_in_global_log = 0; \
+ }; \
+ if (copy_in_global_log) \
+ { \
+ rst_section(global_test_result ": " $$0); \
+ while ((rc = (getline line < ($$0 ".log"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".log"); \
+ print line; \
+ }; \
+ printf "\n"; \
+ }; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+ --color-tests "$$am__color_tests" \
+ --enable-hard-errors "$$am__enable_hard_errors" \
+ --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test. Creates the
+# directory for the log if needed. Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log. Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT. Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup); \
+$(am__vpath_adj_setup) $(am__vpath_adj) \
+$(am__tty_colors); \
+srcdir=$(srcdir); export srcdir; \
+case "$@" in \
+ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \
+ *) am__odir=.;; \
+esac; \
+test "x$$am__odir" = x"." || test -d "$$am__odir" \
+ || $(MKDIR_P) "$$am__odir" || exit $$?; \
+if test -f "./$$f"; then dir=./; \
+elif test -f "$$f"; then dir=; \
+else dir="$(srcdir)/"; fi; \
+tst=$$dir$$f; log='$@'; \
+if test -n '$(DISABLE_HARD_ERRORS)'; then \
+ am__enable_hard_errors=no; \
+else \
+ am__enable_hard_errors=yes; \
+fi; \
+case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
+ am__expect_failure=yes;; \
+ *) \
+ am__expect_failure=no;; \
+esac; \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed). The result is saved in the shell variable
+# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+ bases='$(TEST_LOGS)'; \
+ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+ bases=`echo $$bases`
+RECHECK_LOGS = $(TEST_LOGS)
+TEST_SUITE_LOG = test-suite.log
+TEST_EXTENSIONS = @EXEEXT@ .test
+LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
+am__set_b = \
+ case '$@' in \
+ */*) \
+ case '$*' in \
+ */*) b='$*';; \
+ *) b=`echo '$@' | sed 's/\.log$$//'`; \
+ esac;; \
+ *) \
+ b='$*';; \
+ esac
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+ $(TEST_LOG_FLAGS)
+DIST_SUBDIRS = $(SUBDIRS)
+am__DIST_COMMON = $(srcdir)/../mpn/Makeasm.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/test-driver
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+ABI = @ABI@
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+ASMFLAGS = @ASMFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
+CC = @CC@
+CCAS = @CCAS@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPP_FOR_BUILD = @CPP_FOR_BUILD@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
+DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
+FGREP = @FGREP@
+GMP_LDFLAGS = @GMP_LDFLAGS@
+GMP_LIMB_BITS = @GMP_LIMB_BITS@
+GMP_NAIL_BITS = @GMP_NAIL_BITS@
+GREP = @GREP@
+HAVE_CLOCK_01 = @HAVE_CLOCK_01@
+HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@
+HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@
+HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@
+HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@
+HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@
+HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@
+HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
+HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
+HAVE_STACK_T_01 = @HAVE_STACK_T_01@
+HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBCURSES = @LIBCURSES@
+LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@
+LIBGMP_DLL = @LIBGMP_DLL@
+LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@
+LIBM = @LIBM@
+LIBM_FOR_BUILD = @LIBM_FOR_BUILD@
+LIBOBJS = @LIBOBJS@
+LIBREADLINE = @LIBREADLINE@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+M4 = @M4@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
+STRIP = @STRIP@
+TAL_OBJECT = @TAL_OBJECT@
+TUNE_LIBS = @TUNE_LIBS@
+TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U_FOR_BUILD = @U_FOR_BUILD@
+VERSION = @VERSION@
+WITH_READLINE_01 = @WITH_READLINE_01@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gmp_srclinks = @gmp_srclinks@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mpn_objects = @mpn_objects@
+mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SUBDIRS = . devel mpn mpz mpq mpf rand misc cxx
+
+# COMPILE minus CC.
+#
+COMPILE_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(ASMFLAGS)
+
+
+# Flags used for preprocessing (in ansi2knr rules).
+#
+PREPROCESS_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS)
+
+
+# Recent versions of automake (1.5 and up for instance) append automake
+# generated suffixes to this $(SUFFIXES) list. This is essential for us,
+# since .c must come after .s, .S and .asm. If .c is before .s, for
+# instance, then in the mpn directory "make" will see add_n.c mentioned in
+# an explicit rule (the ansi2knr stuff) and decide it must have add_n.c,
+# even if add_n.c doesn't exist but add_n.s does. See GNU make
+# documentation "(make)Implicit Rule Search", part 5c.
+#
+# On IRIX 6 native make this doesn't work properly though. Somehow .c
+# remains ahead of .s, perhaps because .c.s is a builtin rule. .asm works
+# fine though, and mpn/mips3 uses this.
+#
+SUFFIXES = .s .S .asm
+
+# can be overridden during development, eg. "make RM_TMP=: mul_1.lo"
+RM_TMP = rm -f
+AM_CPPFLAGS = -I$(top_srcdir)
+AM_LDFLAGS = -no-install
+LDADD = libtests.la $(top_builddir)/libgmp.la
+check_LTLIBRARIES = libtests.la
+EXTRA_libtests_la_SOURCES = amd64call.asm amd64check.c x86call.asm x86check.c \
+ arm32call.asm arm32check.c
+
+libtests_la_SOURCES = tests.h \
+ memory.c misc.c refmpf.c refmpn.c refmpq.c refmpz.c spinner.c trace.c
+
+libtests_la_DEPENDENCIES = @CALLING_CONVENTIONS_OBJS@
+libtests_la_LIBADD = $(libtests_la_DEPENDENCIES) $(top_builddir)/libgmp.la
+TESTS = $(check_PROGRAMS)
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .s .S .asm .c .lo .log .o .obj .test .test$(EXEEXT) .trs
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../mpn/Makeasm.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+$(srcdir)/../mpn/Makeasm.am $(am__empty):
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkLTLIBRARIES:
+ -test -z "$(check_LTLIBRARIES)" || rm -f $(check_LTLIBRARIES)
+ @list='$(check_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
+libtests.la: $(libtests_la_OBJECTS) $(libtests_la_DEPENDENCIES) $(EXTRA_libtests_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(libtests_la_OBJECTS) $(libtests_la_LIBADD) $(LIBS)
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+t-bswap$(EXEEXT): $(t_bswap_OBJECTS) $(t_bswap_DEPENDENCIES) $(EXTRA_t_bswap_DEPENDENCIES)
+ @rm -f t-bswap$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_bswap_OBJECTS) $(t_bswap_LDADD) $(LIBS)
+
+t-constants$(EXEEXT): $(t_constants_OBJECTS) $(t_constants_DEPENDENCIES) $(EXTRA_t_constants_DEPENDENCIES)
+ @rm -f t-constants$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_constants_OBJECTS) $(t_constants_LDADD) $(LIBS)
+
+t-count_zeros$(EXEEXT): $(t_count_zeros_OBJECTS) $(t_count_zeros_DEPENDENCIES) $(EXTRA_t_count_zeros_DEPENDENCIES)
+ @rm -f t-count_zeros$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_count_zeros_OBJECTS) $(t_count_zeros_LDADD) $(LIBS)
+
+t-hightomask$(EXEEXT): $(t_hightomask_OBJECTS) $(t_hightomask_DEPENDENCIES) $(EXTRA_t_hightomask_DEPENDENCIES)
+ @rm -f t-hightomask$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_hightomask_OBJECTS) $(t_hightomask_LDADD) $(LIBS)
+
+t-modlinv$(EXEEXT): $(t_modlinv_OBJECTS) $(t_modlinv_DEPENDENCIES) $(EXTRA_t_modlinv_DEPENDENCIES)
+ @rm -f t-modlinv$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_modlinv_OBJECTS) $(t_modlinv_LDADD) $(LIBS)
+
+t-parity$(EXEEXT): $(t_parity_OBJECTS) $(t_parity_DEPENDENCIES) $(EXTRA_t_parity_DEPENDENCIES)
+ @rm -f t-parity$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_parity_OBJECTS) $(t_parity_LDADD) $(LIBS)
+
+t-popc$(EXEEXT): $(t_popc_OBJECTS) $(t_popc_DEPENDENCIES) $(EXTRA_t_popc_DEPENDENCIES)
+ @rm -f t-popc$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_popc_OBJECTS) $(t_popc_LDADD) $(LIBS)
+
+t-sub$(EXEEXT): $(t_sub_OBJECTS) $(t_sub_DEPENDENCIES) $(EXTRA_t_sub_DEPENDENCIES)
+ @rm -f t-sub$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_sub_OBJECTS) $(t_sub_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+.c.o:
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+ $(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+# (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+ @fail=; \
+ if $(am__make_keepgoing); then \
+ failcom='fail=yes'; \
+ else \
+ failcom='exit 1'; \
+ fi; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+ rm -f $< $@
+ $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+ @:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+ @$(am__set_TESTS_bases); \
+ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+ redo_bases=`for i in $$bases; do \
+ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+ done`; \
+ if test -n "$$redo_bases"; then \
+ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+ if $(am__make_dryrun); then :; else \
+ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+ fi; \
+ fi; \
+ if test -n "$$am__remaking_logs"; then \
+ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+ "recursion detected" >&2; \
+ elif test -n "$$redo_logs"; then \
+ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+ fi; \
+ if $(am__make_dryrun); then :; else \
+ st=0; \
+ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+ for i in $$redo_bases; do \
+ test -f $$i.trs && test -r $$i.trs \
+ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+ test -f $$i.log && test -r $$i.log \
+ || { echo "$$errmsg $$i.log" >&2; st=1; }; \
+ done; \
+ test $$st -eq 0 || exit 1; \
+ fi
+ @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+ ws='[ ]'; \
+ results=`for b in $$bases; do echo $$b.trs; done`; \
+ test -n "$$results" || results=/dev/null; \
+ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
+ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \
+ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \
+ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \
+ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+ if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+ success=true; \
+ else \
+ success=false; \
+ fi; \
+ br='==================='; br=$$br$$br$$br$$br; \
+ result_count () \
+ { \
+ if test x"$$1" = x"--maybe-color"; then \
+ maybe_colorize=yes; \
+ elif test x"$$1" = x"--no-color"; then \
+ maybe_colorize=no; \
+ else \
+ echo "$@: invalid 'result_count' usage" >&2; exit 4; \
+ fi; \
+ shift; \
+ desc=$$1 count=$$2; \
+ if test $$maybe_colorize = yes && test $$count -gt 0; then \
+ color_start=$$3 color_end=$$std; \
+ else \
+ color_start= color_end=; \
+ fi; \
+ echo "$${color_start}# $$desc $$count$${color_end}"; \
+ }; \
+ create_testsuite_report () \
+ { \
+ result_count $$1 "TOTAL:" $$all "$$brg"; \
+ result_count $$1 "PASS: " $$pass "$$grn"; \
+ result_count $$1 "SKIP: " $$skip "$$blu"; \
+ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+ result_count $$1 "FAIL: " $$fail "$$red"; \
+ result_count $$1 "XPASS:" $$xpass "$$red"; \
+ result_count $$1 "ERROR:" $$error "$$mgn"; \
+ }; \
+ { \
+ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
+ $(am__rst_title); \
+ create_testsuite_report --no-color; \
+ echo; \
+ echo ".. contents:: :depth: 2"; \
+ echo; \
+ for b in $$bases; do echo $$b; done \
+ | $(am__create_global_log); \
+ } >$(TEST_SUITE_LOG).tmp || exit 1; \
+ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
+ if $$success; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
+ fi; \
+ echo "$${col}$$br$${std}"; \
+ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \
+ echo "$${col}$$br$${std}"; \
+ create_testsuite_report --maybe-color; \
+ echo "$$col$$br$$std"; \
+ if $$success; then :; else \
+ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \
+ if test -n "$(PACKAGE_BUGREPORT)"; then \
+ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+ fi; \
+ echo "$$col$$br$$std"; \
+ fi; \
+ $$success || exit 1
+
+check-TESTS:
+ @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
+ @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+ exit $$?;
+recheck: all $(check_LTLIBRARIES) $(check_PROGRAMS)
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ bases=`for i in $$bases; do echo $$i; done \
+ | $(am__list_recheck_tests)` || exit 1; \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ log_list=`echo $$log_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+ am__force_recheck=am--force-recheck \
+ TEST_LOGS="$$log_list"; \
+ exit $$?
+t-bswap.log: t-bswap$(EXEEXT)
+ @p='t-bswap$(EXEEXT)'; \
+ b='t-bswap'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-constants.log: t-constants$(EXEEXT)
+ @p='t-constants$(EXEEXT)'; \
+ b='t-constants'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-count_zeros.log: t-count_zeros$(EXEEXT)
+ @p='t-count_zeros$(EXEEXT)'; \
+ b='t-count_zeros'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-hightomask.log: t-hightomask$(EXEEXT)
+ @p='t-hightomask$(EXEEXT)'; \
+ b='t-hightomask'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-modlinv.log: t-modlinv$(EXEEXT)
+ @p='t-modlinv$(EXEEXT)'; \
+ b='t-modlinv'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-popc.log: t-popc$(EXEEXT)
+ @p='t-popc$(EXEEXT)'; \
+ b='t-popc'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-parity.log: t-parity$(EXEEXT)
+ @p='t-parity$(EXEEXT)'; \
+ b='t-parity'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-sub.log: t-sub$(EXEEXT)
+ @p='t-sub$(EXEEXT)'; \
+ b='t-sub'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+.test.log:
+ @p='$<'; \
+ $(am__set_b); \
+ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+@am__EXEEXT_TRUE@.test$(EXEEXT).log:
+@am__EXEEXT_TRUE@ @p='$<'; \
+@am__EXEEXT_TRUE@ $(am__set_b); \
+@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
+@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ $(am__make_dryrun) \
+ || test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+ -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+ -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+ -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-checkLTLIBRARIES clean-checkPROGRAMS clean-generic \
+ clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(am__recursive_targets) check-am install-am install-strip
+
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
+ check-TESTS check-am clean clean-checkLTLIBRARIES \
+ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
+ ctags ctags-am distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ recheck tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+# .s assembler, no preprocessing.
+#
+.s.o:
+ $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<
+.s.obj:
+ $(CCAS) $(COMPILE_FLAGS) `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
+.s.lo:
+ $(LIBTOOL) --mode=compile --tag=CC $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<
+
+# .S assembler, preprocessed with cpp.
+#
+# It's necessary to run $(CPP) separately, since it seems not all compilers
+# recognise .S files, in particular "cc" on HP-UX 10 and 11 doesn't (and
+# will silently do nothing if given a .S).
+#
+# For .lo we need a helper script, as described below for .asm.lo.
+#
+.S.o:
+ $(CPP) $(PREPROCESS_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$< | grep -v '^#' >tmp-$*.s
+ $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@
+ $(RM_TMP) tmp-$*.s
+.S.obj:
+ $(CPP) $(PREPROCESS_FLAGS) `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` | grep -v '^#' >tmp-$*.s
+ $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@
+ $(RM_TMP) tmp-$*.s
+.S.lo:
+ $(LIBTOOL) --mode=compile --tag=CC $(top_srcdir)/mpn/cpp-ccas --cpp="$(CPP) $(PREPROCESS_FLAGS)" $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<
+
+# .asm assembler, preprocessed with m4.
+#
+# .o and .obj are non-PIC and just need m4 followed by a compile.
+#
+# .lo is a bit tricky. Libtool (as of version 1.5) has foo.lo as a little
+# text file, and .libs/foo.o and foo.o as the PIC and non-PIC objects,
+# respectively. It'd be asking for lots of trouble to try to create foo.lo
+# ourselves, so instead arrange to invoke libtool like a --mode=compile, but
+# with a special m4-ccas script which first m4 preprocesses, then compiles.
+# --tag=CC is necessary since foo.asm is otherwise unknown to libtool.
+#
+# Libtool adds -DPIC when building a shared object and the .asm files look
+# for that. But it should be noted that the other PIC flags are on occasion
+# important too, in particular FreeBSD 2.2.8 gas 1.92.3 requires -k before
+# it accepts PIC constructs like @GOT, and gcc adds that flag only under
+# -fPIC. (Later versions of gas are happy to accept PIC stuff any time.)
+#
+.asm.o:
+ $(M4) -DOPERATION_$* `test -f '$<' || echo '$(srcdir)/'`$< >tmp-$*.s
+ $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@
+ $(RM_TMP) tmp-$*.s
+.asm.obj:
+ $(M4) -DOPERATION_$* `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >tmp-$*.s
+ $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@
+ $(RM_TMP) tmp-$*.s
+.asm.lo:
+ $(LIBTOOL) --mode=compile --tag=CC $(top_srcdir)/mpn/m4-ccas --m4="$(M4)" $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/vendor/gmp-6.3.0/tests/amd64call.asm b/vendor/gmp-6.3.0/tests/amd64call.asm
new file mode 100644
index 0000000..dad7763
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/amd64call.asm
@@ -0,0 +1,167 @@
+dnl AMD64 calling conventions checking.
+
+dnl Copyright 2000, 2003, 2004, 2006, 2007, 2010 Free Software Foundation, Inc.
+
+dnl This file is part of the GNU MP Library test suite.
+
+dnl The GNU MP Library test suite is free software; you can redistribute it
+dnl and/or modify it under the terms of the GNU General Public License as
+dnl published by the Free Software Foundation; either version 3 of the
+dnl License, or (at your option) any later version.
+
+dnl The GNU MP Library test suite is distributed in the hope that it will be
+dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+dnl Public License for more details.
+
+dnl You should have received a copy of the GNU General Public License along
+dnl with the GNU MP Library test suite. If not, see
+dnl https://www.gnu.org/licenses/.
+
+
+dnl The current version of the code attempts to keep the call/return
+dnl prediction stack valid, but matching calls and returns.
+
+include(`../config.m4')
+
+
+C void x86_fldcw (unsigned short cw);
+C
+C Execute an fldcw, setting the x87 control word to cw.
+
+PROLOGUE(x86_fldcw)
+ mov %rdi, -8(%rsp)
+ fldcw -8(%rsp)
+ ret
+EPILOGUE()
+
+
+C unsigned short x86_fstcw (void);
+C
+C Execute an fstcw, returning the current x87 control word.
+
+PROLOGUE(x86_fstcw)
+ movq $0, -8(%rsp)
+ fstcw -8(%rsp)
+ mov -8(%rsp), %rax
+ ret
+EPILOGUE()
+
+
+dnl Instrumented profiling won't come out quite right below, since we don't do
+dnl an actual "ret". There's only a few instructions here, so there's no
+dnl great need to get them separately accounted, just let them get attributed
+dnl to the caller. FIXME this comment might no longer be true.
+
+ifelse(WANT_PROFILING,instrument,
+`define(`WANT_PROFILING',no)')
+
+
+C int calling_conventions (...);
+C
+C The global variable "calling_conventions_function" is the function to
+C call, with the arguments as passed here.
+C
+C Perhaps the finit should be done only if the tags word isn't clear, but
+C nothing uses the rounding mode or anything at the moment.
+
+define(`WANT_RBX', eval(8*0)($1))
+define(`WANT_RBP', eval(8*1)($1))
+define(`WANT_R12', eval(8*2)($1))
+define(`WANT_R13', eval(8*3)($1))
+define(`WANT_R14', eval(8*4)($1))
+define(`WANT_R15', eval(8*5)($1))
+
+define(`JUNK_RAX', eval(8*6)($1))
+define(`JUNK_R10', eval(8*7)($1))
+define(`JUNK_R11', eval(8*8)($1))
+
+define(`SAVE_RBX', eval(8*9)($1))
+define(`SAVE_RBP', eval(8*10)($1))
+define(`SAVE_R12', eval(8*11)($1))
+define(`SAVE_R13', eval(8*12)($1))
+define(`SAVE_R14', eval(8*13)($1))
+define(`SAVE_R15', eval(8*14)($1))
+
+define(`RETADDR', eval(8*15)($1))
+
+define(`RBX', eval(8*16)($1))
+define(`RBP', eval(8*17)($1))
+define(`R12', eval(8*18)($1))
+define(`R13', eval(8*19)($1))
+define(`R14', eval(8*20)($1))
+define(`R15', eval(8*21)($1))
+define(`RFLAGS', eval(8*22)($1))
+
+
+define(G,
+m4_assert_numargs(1)
+`GSYM_PREFIX`'$1')
+
+ TEXT
+ ALIGN(32)
+PROLOGUE(calling_conventions)
+ mov G(calling_conventions_values)@GOTPCREL(%rip), %rax
+ pop RETADDR(%rax)
+
+ mov %rbx, SAVE_RBX(%rax)
+ mov %rbp, SAVE_RBP(%rax)
+ mov %r12, SAVE_R12(%rax)
+ mov %r13, SAVE_R13(%rax)
+ mov %r14, SAVE_R14(%rax)
+ mov %r15, SAVE_R15(%rax)
+
+ C Values we expect to see unchanged, as per amd64check.c
+ mov WANT_RBX(%rax), %rbx
+ mov WANT_RBP(%rax), %rbp
+ mov WANT_R12(%rax), %r12
+ mov WANT_R13(%rax), %r13
+ mov WANT_R14(%rax), %r14
+ mov WANT_R15(%rax), %r15
+
+ C Try to provoke a problem by starting with junk in the caller-saves
+ C registers, especially %rax which will be the return value.
+C mov JUNK_RAX(%rax), %rax C overwritten below anyway
+ mov JUNK_R10(%rax), %r10
+ mov JUNK_R11(%rax), %r11
+
+ mov G(calling_conventions_function)@GOTPCREL(%rip), %rax
+ call *(%rax)
+
+ mov G(calling_conventions_values)@GOTPCREL(%rip), %rcx
+
+ mov %rbx, RBX(%rcx)
+ mov %rbp, RBP(%rcx)
+ mov %r12, R12(%rcx)
+ mov %r13, R13(%rcx)
+ mov %r14, R14(%rcx)
+ mov %r15, R15(%rcx)
+
+ pushf
+ pop %rbx
+ mov %rbx, RFLAGS(%rcx)
+
+ mov SAVE_RBX(%rcx), %rbx
+ mov SAVE_RBP(%rcx), %rbp
+ mov SAVE_R12(%rcx), %r12
+ mov SAVE_R13(%rcx), %r13
+ mov SAVE_R14(%rcx), %r14
+ mov SAVE_R15(%rcx), %r15
+
+ C Overwrite parameter registers
+C mov JUNK_R9(%rcx), %r9
+C mov JUNK_R8(%rcx), %r8
+C mov JUNK_RCX(%rcx), %rcx
+C mov JUNK_RDX(%rcx), %rdx
+C mov JUNK_RSI(%rcx), %rsi
+C mov JUNK_RDI(%rcx), %rdi
+
+ push RETADDR(%rcx)
+
+ mov G(calling_conventions_fenv)@GOTPCREL(%rip), %rcx
+ fstenv (%rcx)
+ finit
+
+ ret
+
+EPILOGUE()
diff --git a/vendor/gmp-6.3.0/tests/amd64check.c b/vendor/gmp-6.3.0/tests/amd64check.c
new file mode 100644
index 0000000..a8cdbe2
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/amd64check.c
@@ -0,0 +1,111 @@
+/* AMD64 calling conventions checking.
+
+Copyright 2000, 2001, 2004, 2007 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+/* Vector if constants and register values. We use one vector to allow access
+ via a base pointer, very beneficial for the PIC-enabled amd64call.asm. */
+mp_limb_t calling_conventions_values[23] =
+{
+ CNST_LIMB(0x1234567887654321), /* want_rbx */
+ CNST_LIMB(0x89ABCDEFFEDCBA98), /* want_rbp */
+ CNST_LIMB(0xDEADBEEFBADECAFE), /* want_r12 */
+ CNST_LIMB(0xFFEEDDCCBBAA9988), /* want_r13 */
+ CNST_LIMB(0x0011223344556677), /* want_r14 */
+ CNST_LIMB(0x1234432156788765), /* want_r15 */
+
+ CNST_LIMB(0xFEEDABBACAAFBEED), /* JUNK_RAX */
+ CNST_LIMB(0xAB78DE89FF5125BB), /* JUNK_R10 */
+ CNST_LIMB(0x1238901890189031) /* JUNK_R11 */
+
+ /* rest of array used for dynamic values. */
+};
+
+/* Index starts for various regions in above vector. */
+#define WANT 0
+#define JUNK 6
+#define SAVE 9
+#define RETADDR 15
+#define VAL 16
+#define RFLAGS 22
+
+/* values to check */
+#ifdef __cplusplus
+extern "C" {
+#endif
+struct {
+ int control;
+ int status;
+ int tag;
+ int other[4];
+} calling_conventions_fenv;
+#ifdef __cplusplus
+}
+#endif
+
+
+const char *regname[6] = {"rbx", "rbp", "r12", "r13", "r14", "r15"};
+
+#define DIR_BIT(rflags) (((rflags) & (1<<10)) != 0)
+
+
+/* Return 1 if ok, 0 if not */
+
+int
+calling_conventions_check (void)
+{
+ const char *header = "Violated calling conventions:\n";
+ int ret = 1;
+ int i;
+
+#define CHECK(callreg, regstr, value) \
+ if (callreg != value) \
+ { \
+ printf ("%s %s got 0x%016lX want 0x%016lX\n", \
+ header, regstr, callreg, value); \
+ header = ""; \
+ ret = 0; \
+ }
+
+ for (i = 0; i < 6; i++)
+ {
+ CHECK (calling_conventions_values[VAL+i], regname[i], calling_conventions_values[WANT+i]);
+ }
+
+ if (DIR_BIT (calling_conventions_values[RFLAGS]) != 0)
+ {
+ printf ("%s rflags dir bit got %d want 0\n",
+ header, DIR_BIT (calling_conventions_values[RFLAGS]));
+ header = "";
+ ret = 0;
+ }
+
+ if ((calling_conventions_fenv.tag & 0xFFFF) != 0xFFFF)
+ {
+ printf ("%s fpu tags got 0x%X want 0xFFFF\n",
+ header, calling_conventions_fenv.tag & 0xFFFF);
+ header = "";
+ ret = 0;
+ }
+
+ return ret;
+}
diff --git a/vendor/gmp-6.3.0/tests/arm32call.asm b/vendor/gmp-6.3.0/tests/arm32call.asm
new file mode 100644
index 0000000..24d0739
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/arm32call.asm
@@ -0,0 +1,83 @@
+dnl ARM32 calling conventions checking.
+
+dnl Copyright 2000, 2003, 2004, 2006, 2007, 2010, 2013, 2016 Free Software
+dnl Foundation, Inc.
+
+dnl This file is part of the GNU MP Library test suite.
+
+dnl The GNU MP Library test suite is free software; you can redistribute it
+dnl and/or modify it under the terms of the GNU General Public License as
+dnl published by the Free Software Foundation; either version 3 of the
+dnl License, or (at your option) any later version.
+
+dnl The GNU MP Library test suite is distributed in the hope that it will be
+dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+dnl Public License for more details.
+
+dnl You should have received a copy of the GNU General Public License along
+dnl with the GNU MP Library test suite. If not, see
+dnl https://www.gnu.org/licenses/.
+
+
+dnl The current version of the code attempts to keep the call/return
+dnl prediction stack valid, but matching calls and returns.
+
+include(`../config.m4')
+
+
+C int calling_conventions (...);
+C
+C The global variable "calling_conventions_function" is the function to
+C call, with the arguments as passed here.
+
+define(`WANT_CALLEE_SAVES', eval(4*0))
+define(`SAVE_CALLEE_SAVES', eval(4*8))
+define(`RETADDR', eval(4*16))
+define(`GOT_CALLEE_SAVES', eval(4*17))
+define(`JUNK_PARAMS', eval(4*25))
+
+ TEXT
+ ALIGN(32)
+PROLOGUE(calling_conventions)
+ LEA( r12, calling_conventions_values)
+
+ C Preserve callee-saves registers, including the link register r14
+ add r12, r12, #SAVE_CALLEE_SAVES
+ stm r12, {r4-r11,r14}
+ sub r12, r12, #SAVE_CALLEE_SAVES
+
+ C Put chosen junk into callee-saves registers
+ add r12, r12, #WANT_CALLEE_SAVES
+ ldm r12, {r4-r11}
+ sub r12, r12, #WANT_CALLEE_SAVES
+
+ C No callee-saves registers on arm except r12 and parameter registers
+ C
+
+ C Make the actual call
+ LEA( r12, calling_conventions_function)
+ ldr r12, [r12]
+ mov r14, pc
+ return r12
+
+ LEA( r12, calling_conventions_values)
+
+ C Save callee-saves registers after call
+ add r12, r12, #GOT_CALLEE_SAVES
+ stm r12, {r4-r11}
+ sub r12, r12, #GOT_CALLEE_SAVES
+
+ C Restore callee-saves registers, including the link register r14
+ add r12, r12, #SAVE_CALLEE_SAVES
+ ldm r12, {r4-r11,r14}
+ sub r12, r12, #SAVE_CALLEE_SAVES
+
+ C Overwrite parameter registers. Note that we overwrite r1, which
+ C could hold one half of a 64-bit return value, since we don't use that
+ C in GMP.
+ add r12, r12, #JUNK_PARAMS
+ ldm r12, {r1-r3}
+
+ return r14
+EPILOGUE()
diff --git a/vendor/gmp-6.3.0/tests/arm32check.c b/vendor/gmp-6.3.0/tests/arm32check.c
new file mode 100644
index 0000000..0a9f86d
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/arm32check.c
@@ -0,0 +1,95 @@
+/* ARM32 calling conventions checking.
+
+Copyright 2000, 2001, 2004, 2007 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+/* Vector if constants and register values. */
+mp_limb_t calling_conventions_values[29] =
+{
+ 0x12345678, /* 0 want_r4 */
+ 0x87654321, /* 1 want_r5 */
+ 0x89ABCDEF, /* 2 want_r6 */
+ 0xFEDCBA98, /* 3 want_r7 */
+ 0xDEADBEEF, /* 4 want_r8 */
+ 0xBADECAFE, /* 5 want_r9 */
+ 0xFFEEDDCC, /* 6 want_r10 */
+ 0xBBAA9988, /* 7 want_r11 */
+
+ 0x00000000, /* 8 save_r4 */
+ 0x00000000, /* 9 save_r5 */
+ 0x00000000, /* 10 save_r6 */
+ 0x00000000, /* 11 save_r7 */
+ 0x00000000, /* 12 save_r8 */
+ 0x00000000, /* 13 save_r9 */
+ 0x00000000, /* 14 save_r10 */
+ 0x00000000, /* 15 save_r11 */
+ 0x00000000, /* 16 save_r14 */
+
+ 0x00000000, /* 17 got_r4 */
+ 0x00000000, /* 18 got_r5 */
+ 0x00000000, /* 19 got_r6 */
+ 0x00000000, /* 20 got_r7 */
+ 0x00000000, /* 21 got_r8 */
+ 0x00000000, /* 22 got_r9 */
+ 0x00000000, /* 23 got_r10 */
+ 0x00000000, /* 24 got_r11 */
+
+ 0x00112233, /* 25 junk_r0 */
+ 0x44556677, /* 26 junk_r1 */
+ 0x12344321, /* 27 junk_r2 */
+ 0x56788765, /* 28 junk_r3 */
+};
+
+/* Index starts for various regions in above vector. */
+#define WANT_CALLEE_SAVES 0
+#define SAVE_CALLEE_SAVES 8
+#define RETADDR 16
+#define GOT_CALLEE_SAVES 17
+#define JUNK_PARAMS 25
+
+/* Return 1 if ok, 0 if not */
+
+int
+calling_conventions_check (void)
+{
+ const char *header = "Violated calling conventions:\n";
+ int ret = 1;
+ int i;
+
+#define CHECK(callreg, regnum, value) \
+ if (callreg != value) \
+ { \
+ printf ("%s r%d got 0x%08lX want 0x%08lX\n", \
+ header, regnum, callreg, value); \
+ header = ""; \
+ ret = 0; \
+ }
+
+ for (i = 0; i < 8; i++)
+ {
+ CHECK (calling_conventions_values[GOT_CALLEE_SAVES + i],
+ i + 4,
+ calling_conventions_values[WANT_CALLEE_SAVES + i]);
+ }
+
+ return ret;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/Makefile.am b/vendor/gmp-6.3.0/tests/cxx/Makefile.am
new file mode 100644
index 0000000..041bf59
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/Makefile.am
@@ -0,0 +1,87 @@
+## Process this file with automake to generate Makefile.in
+
+# Copyright 2001-2004 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+
+
+# LDADD has an explicit -L of $(top_builddir)/.libs for the benefit of gcc
+# 3.2 on itanium2-hp-hpux11.22. Without this option, the libgmp.sl.6
+# required by libgmpxx.sl (ie. in its NEEDED records) is not found by the
+# linker. FIXME: Presumably libtool should do something about this itself.
+# -lm is needed for t-ops2 which compares the results of trunc and mpf_trunc.
+#
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
+AM_LDFLAGS = -no-install
+LDADD = -L$(top_builddir)/.libs \
+ $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la \
+ $(top_builddir)/libgmp.la \
+ -lm
+
+if WANT_CXX
+check_PROGRAMS = t-binary t-cast t-cxx11 \
+ t-headers t-iostream t-istream t-locale t-misc t-mix \
+ t-ops t-ops2qf t-ops2f t-ops3 t-ostream t-prec \
+ t-ternary t-unary \
+ t-do-exceptions-work-at-all-with-this-compiler \
+ t-ops2z t-assign t-constr t-rand
+
+TESTS = $(check_PROGRAMS)
+endif
+
+EXTRA_DIST = t-ops2.h
+
+t_assign_SOURCES = t-assign.cc
+t_binary_SOURCES = t-binary.cc
+t_cast_SOURCES = t-cast.cc
+t_constr_SOURCES = t-constr.cc
+t_cxx11_SOURCES = t-cxx11.cc
+t_headers_SOURCES = t-headers.cc
+t_iostream_SOURCES= t-iostream.cc
+t_istream_SOURCES = t-istream.cc
+t_locale_SOURCES = t-locale.cc clocale.c
+t_misc_SOURCES = t-misc.cc
+t_mix_SOURCES = t-mix.cc
+t_ops_SOURCES = t-ops.cc
+t_ops2z_SOURCES = t-ops2z.cc
+t_ops2qf_SOURCES = t-ops2qf.cc
+t_ops2f_SOURCES = t-ops2f.cc
+t_ops3_SOURCES = t-ops3.cc
+t_ostream_SOURCES = t-ostream.cc
+t_prec_SOURCES = t-prec.cc
+t_rand_SOURCES = t-rand.cc
+t_ternary_SOURCES = t-ternary.cc
+t_unary_SOURCES = t-unary.cc
+t_do_exceptions_work_at_all_with_this_compiler_SOURCES = \
+ t-do-exceptions-work-at-all-with-this-compiler.cc
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
+
+
+# Libtool (1.5) somehow botches its uninstalled shared library setups on
+# OpenBSD 3.2, making the C++ test programs here fail. libgmpxx.so ends up
+# with a NEEDED record asking for ./.libs/libgmp.so.N, but the loader can't
+# find that unless it exists in the current directory.
+#
+# FIXME: Clearly libtool ought to handle this itself, in which case the hack
+# here can be removed.
+#
+# Note this fix applies only when running "make check". The cp here should
+# be done manually if just one program is to be built and run.
+#
+TESTS_ENVIRONMENT = cp $(top_builddir)/.libs/libgmp.so.* .libs 2>/dev/null || true;
diff --git a/vendor/gmp-6.3.0/tests/cxx/Makefile.in b/vendor/gmp-6.3.0/tests/cxx/Makefile.in
new file mode 100644
index 0000000..94ce352
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/Makefile.in
@@ -0,0 +1,1445 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 2001-2004 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@WANT_CXX_TRUE@check_PROGRAMS = t-binary$(EXEEXT) t-cast$(EXEEXT) \
+@WANT_CXX_TRUE@ t-cxx11$(EXEEXT) t-headers$(EXEEXT) \
+@WANT_CXX_TRUE@ t-iostream$(EXEEXT) t-istream$(EXEEXT) \
+@WANT_CXX_TRUE@ t-locale$(EXEEXT) t-misc$(EXEEXT) \
+@WANT_CXX_TRUE@ t-mix$(EXEEXT) t-ops$(EXEEXT) t-ops2qf$(EXEEXT) \
+@WANT_CXX_TRUE@ t-ops2f$(EXEEXT) t-ops3$(EXEEXT) \
+@WANT_CXX_TRUE@ t-ostream$(EXEEXT) t-prec$(EXEEXT) \
+@WANT_CXX_TRUE@ t-ternary$(EXEEXT) t-unary$(EXEEXT) \
+@WANT_CXX_TRUE@ t-do-exceptions-work-at-all-with-this-compiler$(EXEEXT) \
+@WANT_CXX_TRUE@ t-ops2z$(EXEEXT) t-assign$(EXEEXT) \
+@WANT_CXX_TRUE@ t-constr$(EXEEXT) t-rand$(EXEEXT)
+subdir = tests/cxx
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am_t_assign_OBJECTS = t-assign.$(OBJEXT)
+t_assign_OBJECTS = $(am_t_assign_OBJECTS)
+t_assign_LDADD = $(LDADD)
+t_assign_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+am_t_binary_OBJECTS = t-binary.$(OBJEXT)
+t_binary_OBJECTS = $(am_t_binary_OBJECTS)
+t_binary_LDADD = $(LDADD)
+t_binary_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_cast_OBJECTS = t-cast.$(OBJEXT)
+t_cast_OBJECTS = $(am_t_cast_OBJECTS)
+t_cast_LDADD = $(LDADD)
+t_cast_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_constr_OBJECTS = t-constr.$(OBJEXT)
+t_constr_OBJECTS = $(am_t_constr_OBJECTS)
+t_constr_LDADD = $(LDADD)
+t_constr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_cxx11_OBJECTS = t-cxx11.$(OBJEXT)
+t_cxx11_OBJECTS = $(am_t_cxx11_OBJECTS)
+t_cxx11_LDADD = $(LDADD)
+t_cxx11_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_do_exceptions_work_at_all_with_this_compiler_OBJECTS = \
+ t-do-exceptions-work-at-all-with-this-compiler.$(OBJEXT)
+t_do_exceptions_work_at_all_with_this_compiler_OBJECTS = \
+ $(am_t_do_exceptions_work_at_all_with_this_compiler_OBJECTS)
+t_do_exceptions_work_at_all_with_this_compiler_LDADD = $(LDADD)
+t_do_exceptions_work_at_all_with_this_compiler_DEPENDENCIES = \
+ $(top_builddir)/tests/libtests.la $(top_builddir)/libgmpxx.la \
+ $(top_builddir)/libgmp.la
+am_t_headers_OBJECTS = t-headers.$(OBJEXT)
+t_headers_OBJECTS = $(am_t_headers_OBJECTS)
+t_headers_LDADD = $(LDADD)
+t_headers_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_iostream_OBJECTS = t-iostream.$(OBJEXT)
+t_iostream_OBJECTS = $(am_t_iostream_OBJECTS)
+t_iostream_LDADD = $(LDADD)
+t_iostream_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_istream_OBJECTS = t-istream.$(OBJEXT)
+t_istream_OBJECTS = $(am_t_istream_OBJECTS)
+t_istream_LDADD = $(LDADD)
+t_istream_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_locale_OBJECTS = t-locale.$(OBJEXT) clocale.$(OBJEXT)
+t_locale_OBJECTS = $(am_t_locale_OBJECTS)
+t_locale_LDADD = $(LDADD)
+t_locale_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_misc_OBJECTS = t-misc.$(OBJEXT)
+t_misc_OBJECTS = $(am_t_misc_OBJECTS)
+t_misc_LDADD = $(LDADD)
+t_misc_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_mix_OBJECTS = t-mix.$(OBJEXT)
+t_mix_OBJECTS = $(am_t_mix_OBJECTS)
+t_mix_LDADD = $(LDADD)
+t_mix_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_ops_OBJECTS = t-ops.$(OBJEXT)
+t_ops_OBJECTS = $(am_t_ops_OBJECTS)
+t_ops_LDADD = $(LDADD)
+t_ops_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_ops2f_OBJECTS = t-ops2f.$(OBJEXT)
+t_ops2f_OBJECTS = $(am_t_ops2f_OBJECTS)
+t_ops2f_LDADD = $(LDADD)
+t_ops2f_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_ops2qf_OBJECTS = t-ops2qf.$(OBJEXT)
+t_ops2qf_OBJECTS = $(am_t_ops2qf_OBJECTS)
+t_ops2qf_LDADD = $(LDADD)
+t_ops2qf_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_ops2z_OBJECTS = t-ops2z.$(OBJEXT)
+t_ops2z_OBJECTS = $(am_t_ops2z_OBJECTS)
+t_ops2z_LDADD = $(LDADD)
+t_ops2z_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_ops3_OBJECTS = t-ops3.$(OBJEXT)
+t_ops3_OBJECTS = $(am_t_ops3_OBJECTS)
+t_ops3_LDADD = $(LDADD)
+t_ops3_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_ostream_OBJECTS = t-ostream.$(OBJEXT)
+t_ostream_OBJECTS = $(am_t_ostream_OBJECTS)
+t_ostream_LDADD = $(LDADD)
+t_ostream_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_prec_OBJECTS = t-prec.$(OBJEXT)
+t_prec_OBJECTS = $(am_t_prec_OBJECTS)
+t_prec_LDADD = $(LDADD)
+t_prec_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_rand_OBJECTS = t-rand.$(OBJEXT)
+t_rand_OBJECTS = $(am_t_rand_OBJECTS)
+t_rand_LDADD = $(LDADD)
+t_rand_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_ternary_OBJECTS = t-ternary.$(OBJEXT)
+t_ternary_OBJECTS = $(am_t_ternary_OBJECTS)
+t_ternary_LDADD = $(LDADD)
+t_ternary_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+am_t_unary_OBJECTS = t-unary.$(OBJEXT)
+t_unary_OBJECTS = $(am_t_unary_OBJECTS)
+t_unary_LDADD = $(LDADD)
+t_unary_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
+am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_1 =
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_1 =
+SOURCES = $(t_assign_SOURCES) $(t_binary_SOURCES) $(t_cast_SOURCES) \
+ $(t_constr_SOURCES) $(t_cxx11_SOURCES) \
+ $(t_do_exceptions_work_at_all_with_this_compiler_SOURCES) \
+ $(t_headers_SOURCES) $(t_iostream_SOURCES) \
+ $(t_istream_SOURCES) $(t_locale_SOURCES) $(t_misc_SOURCES) \
+ $(t_mix_SOURCES) $(t_ops_SOURCES) $(t_ops2f_SOURCES) \
+ $(t_ops2qf_SOURCES) $(t_ops2z_SOURCES) $(t_ops3_SOURCES) \
+ $(t_ostream_SOURCES) $(t_prec_SOURCES) $(t_rand_SOURCES) \
+ $(t_ternary_SOURCES) $(t_unary_SOURCES)
+DIST_SOURCES = $(t_assign_SOURCES) $(t_binary_SOURCES) \
+ $(t_cast_SOURCES) $(t_constr_SOURCES) $(t_cxx11_SOURCES) \
+ $(t_do_exceptions_work_at_all_with_this_compiler_SOURCES) \
+ $(t_headers_SOURCES) $(t_iostream_SOURCES) \
+ $(t_istream_SOURCES) $(t_locale_SOURCES) $(t_misc_SOURCES) \
+ $(t_mix_SOURCES) $(t_ops_SOURCES) $(t_ops2f_SOURCES) \
+ $(t_ops2qf_SOURCES) $(t_ops2z_SOURCES) $(t_ops3_SOURCES) \
+ $(t_ostream_SOURCES) $(t_prec_SOURCES) $(t_rand_SOURCES) \
+ $(t_ternary_SOURCES) $(t_unary_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = { \
+ $(am__tty_colors_dummy); \
+ if test "X$(AM_COLOR_TESTS)" = Xno; then \
+ am__color_tests=no; \
+ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+ am__color_tests=yes; \
+ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+ am__color_tests=yes; \
+ fi; \
+ if test $$am__color_tests = yes; then \
+ red=''; \
+ grn=''; \
+ lgn=''; \
+ blu=''; \
+ mgn=''; \
+ brg=''; \
+ std=''; \
+ fi; \
+}
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__recheck_rx = ^[ ]*:recheck:[ ]*
+am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
+am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+ recheck = 1; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ { \
+ if ((getline line2 < ($$0 ".log")) < 0) \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+ { \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+ { \
+ break; \
+ } \
+ }; \
+ if (recheck) \
+ print $$0; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+ print "fatal: making $@: " msg | "cat >&2"; \
+ exit 1; \
+} \
+function rst_section(header) \
+{ \
+ print header; \
+ len = length(header); \
+ for (i = 1; i <= len; i = i + 1) \
+ printf "="; \
+ printf "\n\n"; \
+} \
+{ \
+ copy_in_global_log = 1; \
+ global_test_result = "RUN"; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".trs"); \
+ if (line ~ /$(am__global_test_result_rx)/) \
+ { \
+ sub("$(am__global_test_result_rx)", "", line); \
+ sub("[ ]*$$", "", line); \
+ global_test_result = line; \
+ } \
+ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+ copy_in_global_log = 0; \
+ }; \
+ if (copy_in_global_log) \
+ { \
+ rst_section(global_test_result ": " $$0); \
+ while ((rc = (getline line < ($$0 ".log"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".log"); \
+ print line; \
+ }; \
+ printf "\n"; \
+ }; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+ --color-tests "$$am__color_tests" \
+ --enable-hard-errors "$$am__enable_hard_errors" \
+ --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test. Creates the
+# directory for the log if needed. Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log. Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT. Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup); \
+$(am__vpath_adj_setup) $(am__vpath_adj) \
+$(am__tty_colors); \
+srcdir=$(srcdir); export srcdir; \
+case "$@" in \
+ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \
+ *) am__odir=.;; \
+esac; \
+test "x$$am__odir" = x"." || test -d "$$am__odir" \
+ || $(MKDIR_P) "$$am__odir" || exit $$?; \
+if test -f "./$$f"; then dir=./; \
+elif test -f "$$f"; then dir=; \
+else dir="$(srcdir)/"; fi; \
+tst=$$dir$$f; log='$@'; \
+if test -n '$(DISABLE_HARD_ERRORS)'; then \
+ am__enable_hard_errors=no; \
+else \
+ am__enable_hard_errors=yes; \
+fi; \
+case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
+ am__expect_failure=yes;; \
+ *) \
+ am__expect_failure=no;; \
+esac; \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed). The result is saved in the shell variable
+# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+ bases='$(TEST_LOGS)'; \
+ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+ bases=`echo $$bases`
+RECHECK_LOGS = $(TEST_LOGS)
+AM_RECURSIVE_TARGETS = check recheck
+TEST_SUITE_LOG = test-suite.log
+TEST_EXTENSIONS = @EXEEXT@ .test
+LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
+am__set_b = \
+ case '$@' in \
+ */*) \
+ case '$*' in \
+ */*) b='$*';; \
+ *) b=`echo '$@' | sed 's/\.log$$//'`; \
+ esac;; \
+ *) \
+ b='$*';; \
+ esac
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+ $(TEST_LOG_FLAGS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/test-driver
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ABI = @ABI@
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+ASMFLAGS = @ASMFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
+CC = @CC@
+CCAS = @CCAS@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPP_FOR_BUILD = @CPP_FOR_BUILD@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
+DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
+FGREP = @FGREP@
+GMP_LDFLAGS = @GMP_LDFLAGS@
+GMP_LIMB_BITS = @GMP_LIMB_BITS@
+GMP_NAIL_BITS = @GMP_NAIL_BITS@
+GREP = @GREP@
+HAVE_CLOCK_01 = @HAVE_CLOCK_01@
+HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@
+HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@
+HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@
+HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@
+HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@
+HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@
+HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
+HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
+HAVE_STACK_T_01 = @HAVE_STACK_T_01@
+HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBCURSES = @LIBCURSES@
+LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@
+LIBGMP_DLL = @LIBGMP_DLL@
+LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@
+LIBM = @LIBM@
+LIBM_FOR_BUILD = @LIBM_FOR_BUILD@
+LIBOBJS = @LIBOBJS@
+LIBREADLINE = @LIBREADLINE@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+M4 = @M4@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
+STRIP = @STRIP@
+TAL_OBJECT = @TAL_OBJECT@
+TUNE_LIBS = @TUNE_LIBS@
+TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U_FOR_BUILD = @U_FOR_BUILD@
+VERSION = @VERSION@
+WITH_READLINE_01 = @WITH_READLINE_01@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gmp_srclinks = @gmp_srclinks@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mpn_objects = @mpn_objects@
+mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# LDADD has an explicit -L of $(top_builddir)/.libs for the benefit of gcc
+# 3.2 on itanium2-hp-hpux11.22. Without this option, the libgmp.sl.6
+# required by libgmpxx.sl (ie. in its NEEDED records) is not found by the
+# linker. FIXME: Presumably libtool should do something about this itself.
+# -lm is needed for t-ops2 which compares the results of trunc and mpf_trunc.
+#
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
+AM_LDFLAGS = -no-install
+LDADD = -L$(top_builddir)/.libs \
+ $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmpxx.la \
+ $(top_builddir)/libgmp.la \
+ -lm
+
+@WANT_CXX_TRUE@TESTS = $(check_PROGRAMS)
+EXTRA_DIST = t-ops2.h
+t_assign_SOURCES = t-assign.cc
+t_binary_SOURCES = t-binary.cc
+t_cast_SOURCES = t-cast.cc
+t_constr_SOURCES = t-constr.cc
+t_cxx11_SOURCES = t-cxx11.cc
+t_headers_SOURCES = t-headers.cc
+t_iostream_SOURCES = t-iostream.cc
+t_istream_SOURCES = t-istream.cc
+t_locale_SOURCES = t-locale.cc clocale.c
+t_misc_SOURCES = t-misc.cc
+t_mix_SOURCES = t-mix.cc
+t_ops_SOURCES = t-ops.cc
+t_ops2z_SOURCES = t-ops2z.cc
+t_ops2qf_SOURCES = t-ops2qf.cc
+t_ops2f_SOURCES = t-ops2f.cc
+t_ops3_SOURCES = t-ops3.cc
+t_ostream_SOURCES = t-ostream.cc
+t_prec_SOURCES = t-prec.cc
+t_rand_SOURCES = t-rand.cc
+t_ternary_SOURCES = t-ternary.cc
+t_unary_SOURCES = t-unary.cc
+t_do_exceptions_work_at_all_with_this_compiler_SOURCES = \
+ t-do-exceptions-work-at-all-with-this-compiler.cc
+
+
+# Libtool (1.5) somehow botches its uninstalled shared library setups on
+# OpenBSD 3.2, making the C++ test programs here fail. libgmpxx.so ends up
+# with a NEEDED record asking for ./.libs/libgmp.so.N, but the loader can't
+# find that unless it exists in the current directory.
+#
+# FIXME: Clearly libtool ought to handle this itself, in which case the hack
+# here can be removed.
+#
+# Note this fix applies only when running "make check". The cp here should
+# be done manually if just one program is to be built and run.
+#
+TESTS_ENVIRONMENT = cp $(top_builddir)/.libs/libgmp.so.* .libs 2>/dev/null || true;
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .cc .lo .log .o .obj .test .test$(EXEEXT) .trs
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/cxx/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/cxx/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+t-assign$(EXEEXT): $(t_assign_OBJECTS) $(t_assign_DEPENDENCIES) $(EXTRA_t_assign_DEPENDENCIES)
+ @rm -f t-assign$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_assign_OBJECTS) $(t_assign_LDADD) $(LIBS)
+
+t-binary$(EXEEXT): $(t_binary_OBJECTS) $(t_binary_DEPENDENCIES) $(EXTRA_t_binary_DEPENDENCIES)
+ @rm -f t-binary$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_binary_OBJECTS) $(t_binary_LDADD) $(LIBS)
+
+t-cast$(EXEEXT): $(t_cast_OBJECTS) $(t_cast_DEPENDENCIES) $(EXTRA_t_cast_DEPENDENCIES)
+ @rm -f t-cast$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_cast_OBJECTS) $(t_cast_LDADD) $(LIBS)
+
+t-constr$(EXEEXT): $(t_constr_OBJECTS) $(t_constr_DEPENDENCIES) $(EXTRA_t_constr_DEPENDENCIES)
+ @rm -f t-constr$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_constr_OBJECTS) $(t_constr_LDADD) $(LIBS)
+
+t-cxx11$(EXEEXT): $(t_cxx11_OBJECTS) $(t_cxx11_DEPENDENCIES) $(EXTRA_t_cxx11_DEPENDENCIES)
+ @rm -f t-cxx11$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_cxx11_OBJECTS) $(t_cxx11_LDADD) $(LIBS)
+
+t-do-exceptions-work-at-all-with-this-compiler$(EXEEXT): $(t_do_exceptions_work_at_all_with_this_compiler_OBJECTS) $(t_do_exceptions_work_at_all_with_this_compiler_DEPENDENCIES) $(EXTRA_t_do_exceptions_work_at_all_with_this_compiler_DEPENDENCIES)
+ @rm -f t-do-exceptions-work-at-all-with-this-compiler$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_do_exceptions_work_at_all_with_this_compiler_OBJECTS) $(t_do_exceptions_work_at_all_with_this_compiler_LDADD) $(LIBS)
+
+t-headers$(EXEEXT): $(t_headers_OBJECTS) $(t_headers_DEPENDENCIES) $(EXTRA_t_headers_DEPENDENCIES)
+ @rm -f t-headers$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_headers_OBJECTS) $(t_headers_LDADD) $(LIBS)
+
+t-iostream$(EXEEXT): $(t_iostream_OBJECTS) $(t_iostream_DEPENDENCIES) $(EXTRA_t_iostream_DEPENDENCIES)
+ @rm -f t-iostream$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_iostream_OBJECTS) $(t_iostream_LDADD) $(LIBS)
+
+t-istream$(EXEEXT): $(t_istream_OBJECTS) $(t_istream_DEPENDENCIES) $(EXTRA_t_istream_DEPENDENCIES)
+ @rm -f t-istream$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_istream_OBJECTS) $(t_istream_LDADD) $(LIBS)
+
+t-locale$(EXEEXT): $(t_locale_OBJECTS) $(t_locale_DEPENDENCIES) $(EXTRA_t_locale_DEPENDENCIES)
+ @rm -f t-locale$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_locale_OBJECTS) $(t_locale_LDADD) $(LIBS)
+
+t-misc$(EXEEXT): $(t_misc_OBJECTS) $(t_misc_DEPENDENCIES) $(EXTRA_t_misc_DEPENDENCIES)
+ @rm -f t-misc$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_misc_OBJECTS) $(t_misc_LDADD) $(LIBS)
+
+t-mix$(EXEEXT): $(t_mix_OBJECTS) $(t_mix_DEPENDENCIES) $(EXTRA_t_mix_DEPENDENCIES)
+ @rm -f t-mix$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_mix_OBJECTS) $(t_mix_LDADD) $(LIBS)
+
+t-ops$(EXEEXT): $(t_ops_OBJECTS) $(t_ops_DEPENDENCIES) $(EXTRA_t_ops_DEPENDENCIES)
+ @rm -f t-ops$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_ops_OBJECTS) $(t_ops_LDADD) $(LIBS)
+
+t-ops2f$(EXEEXT): $(t_ops2f_OBJECTS) $(t_ops2f_DEPENDENCIES) $(EXTRA_t_ops2f_DEPENDENCIES)
+ @rm -f t-ops2f$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_ops2f_OBJECTS) $(t_ops2f_LDADD) $(LIBS)
+
+t-ops2qf$(EXEEXT): $(t_ops2qf_OBJECTS) $(t_ops2qf_DEPENDENCIES) $(EXTRA_t_ops2qf_DEPENDENCIES)
+ @rm -f t-ops2qf$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_ops2qf_OBJECTS) $(t_ops2qf_LDADD) $(LIBS)
+
+t-ops2z$(EXEEXT): $(t_ops2z_OBJECTS) $(t_ops2z_DEPENDENCIES) $(EXTRA_t_ops2z_DEPENDENCIES)
+ @rm -f t-ops2z$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_ops2z_OBJECTS) $(t_ops2z_LDADD) $(LIBS)
+
+t-ops3$(EXEEXT): $(t_ops3_OBJECTS) $(t_ops3_DEPENDENCIES) $(EXTRA_t_ops3_DEPENDENCIES)
+ @rm -f t-ops3$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_ops3_OBJECTS) $(t_ops3_LDADD) $(LIBS)
+
+t-ostream$(EXEEXT): $(t_ostream_OBJECTS) $(t_ostream_DEPENDENCIES) $(EXTRA_t_ostream_DEPENDENCIES)
+ @rm -f t-ostream$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_ostream_OBJECTS) $(t_ostream_LDADD) $(LIBS)
+
+t-prec$(EXEEXT): $(t_prec_OBJECTS) $(t_prec_DEPENDENCIES) $(EXTRA_t_prec_DEPENDENCIES)
+ @rm -f t-prec$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_prec_OBJECTS) $(t_prec_LDADD) $(LIBS)
+
+t-rand$(EXEEXT): $(t_rand_OBJECTS) $(t_rand_DEPENDENCIES) $(EXTRA_t_rand_DEPENDENCIES)
+ @rm -f t-rand$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_rand_OBJECTS) $(t_rand_LDADD) $(LIBS)
+
+t-ternary$(EXEEXT): $(t_ternary_OBJECTS) $(t_ternary_DEPENDENCIES) $(EXTRA_t_ternary_DEPENDENCIES)
+ @rm -f t-ternary$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_ternary_OBJECTS) $(t_ternary_LDADD) $(LIBS)
+
+t-unary$(EXEEXT): $(t_unary_OBJECTS) $(t_unary_DEPENDENCIES) $(EXTRA_t_unary_DEPENDENCIES)
+ @rm -f t-unary$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_unary_OBJECTS) $(t_unary_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+.c.o:
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+ $(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
+
+.cc.o:
+ $(AM_V_CXX)$(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+ $(AM_V_CXX)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cc.lo:
+ $(AM_V_CXX)$(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+ rm -f $< $@
+ $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+ @:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+ @$(am__set_TESTS_bases); \
+ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+ redo_bases=`for i in $$bases; do \
+ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+ done`; \
+ if test -n "$$redo_bases"; then \
+ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+ if $(am__make_dryrun); then :; else \
+ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+ fi; \
+ fi; \
+ if test -n "$$am__remaking_logs"; then \
+ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+ "recursion detected" >&2; \
+ elif test -n "$$redo_logs"; then \
+ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+ fi; \
+ if $(am__make_dryrun); then :; else \
+ st=0; \
+ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+ for i in $$redo_bases; do \
+ test -f $$i.trs && test -r $$i.trs \
+ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+ test -f $$i.log && test -r $$i.log \
+ || { echo "$$errmsg $$i.log" >&2; st=1; }; \
+ done; \
+ test $$st -eq 0 || exit 1; \
+ fi
+ @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+ ws='[ ]'; \
+ results=`for b in $$bases; do echo $$b.trs; done`; \
+ test -n "$$results" || results=/dev/null; \
+ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
+ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \
+ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \
+ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \
+ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+ if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+ success=true; \
+ else \
+ success=false; \
+ fi; \
+ br='==================='; br=$$br$$br$$br$$br; \
+ result_count () \
+ { \
+ if test x"$$1" = x"--maybe-color"; then \
+ maybe_colorize=yes; \
+ elif test x"$$1" = x"--no-color"; then \
+ maybe_colorize=no; \
+ else \
+ echo "$@: invalid 'result_count' usage" >&2; exit 4; \
+ fi; \
+ shift; \
+ desc=$$1 count=$$2; \
+ if test $$maybe_colorize = yes && test $$count -gt 0; then \
+ color_start=$$3 color_end=$$std; \
+ else \
+ color_start= color_end=; \
+ fi; \
+ echo "$${color_start}# $$desc $$count$${color_end}"; \
+ }; \
+ create_testsuite_report () \
+ { \
+ result_count $$1 "TOTAL:" $$all "$$brg"; \
+ result_count $$1 "PASS: " $$pass "$$grn"; \
+ result_count $$1 "SKIP: " $$skip "$$blu"; \
+ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+ result_count $$1 "FAIL: " $$fail "$$red"; \
+ result_count $$1 "XPASS:" $$xpass "$$red"; \
+ result_count $$1 "ERROR:" $$error "$$mgn"; \
+ }; \
+ { \
+ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
+ $(am__rst_title); \
+ create_testsuite_report --no-color; \
+ echo; \
+ echo ".. contents:: :depth: 2"; \
+ echo; \
+ for b in $$bases; do echo $$b; done \
+ | $(am__create_global_log); \
+ } >$(TEST_SUITE_LOG).tmp || exit 1; \
+ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
+ if $$success; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
+ fi; \
+ echo "$${col}$$br$${std}"; \
+ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \
+ echo "$${col}$$br$${std}"; \
+ create_testsuite_report --maybe-color; \
+ echo "$$col$$br$$std"; \
+ if $$success; then :; else \
+ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \
+ if test -n "$(PACKAGE_BUGREPORT)"; then \
+ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+ fi; \
+ echo "$$col$$br$$std"; \
+ fi; \
+ $$success || exit 1
+
+check-TESTS:
+ @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
+ @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+ exit $$?;
+recheck: all $(check_PROGRAMS)
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ bases=`for i in $$bases; do echo $$i; done \
+ | $(am__list_recheck_tests)` || exit 1; \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ log_list=`echo $$log_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+ am__force_recheck=am--force-recheck \
+ TEST_LOGS="$$log_list"; \
+ exit $$?
+t-binary.log: t-binary$(EXEEXT)
+ @p='t-binary$(EXEEXT)'; \
+ b='t-binary'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-cast.log: t-cast$(EXEEXT)
+ @p='t-cast$(EXEEXT)'; \
+ b='t-cast'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-cxx11.log: t-cxx11$(EXEEXT)
+ @p='t-cxx11$(EXEEXT)'; \
+ b='t-cxx11'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-headers.log: t-headers$(EXEEXT)
+ @p='t-headers$(EXEEXT)'; \
+ b='t-headers'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-iostream.log: t-iostream$(EXEEXT)
+ @p='t-iostream$(EXEEXT)'; \
+ b='t-iostream'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-istream.log: t-istream$(EXEEXT)
+ @p='t-istream$(EXEEXT)'; \
+ b='t-istream'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-locale.log: t-locale$(EXEEXT)
+ @p='t-locale$(EXEEXT)'; \
+ b='t-locale'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-misc.log: t-misc$(EXEEXT)
+ @p='t-misc$(EXEEXT)'; \
+ b='t-misc'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-mix.log: t-mix$(EXEEXT)
+ @p='t-mix$(EXEEXT)'; \
+ b='t-mix'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-ops.log: t-ops$(EXEEXT)
+ @p='t-ops$(EXEEXT)'; \
+ b='t-ops'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-ops2qf.log: t-ops2qf$(EXEEXT)
+ @p='t-ops2qf$(EXEEXT)'; \
+ b='t-ops2qf'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-ops2f.log: t-ops2f$(EXEEXT)
+ @p='t-ops2f$(EXEEXT)'; \
+ b='t-ops2f'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-ops3.log: t-ops3$(EXEEXT)
+ @p='t-ops3$(EXEEXT)'; \
+ b='t-ops3'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-ostream.log: t-ostream$(EXEEXT)
+ @p='t-ostream$(EXEEXT)'; \
+ b='t-ostream'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-prec.log: t-prec$(EXEEXT)
+ @p='t-prec$(EXEEXT)'; \
+ b='t-prec'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-ternary.log: t-ternary$(EXEEXT)
+ @p='t-ternary$(EXEEXT)'; \
+ b='t-ternary'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-unary.log: t-unary$(EXEEXT)
+ @p='t-unary$(EXEEXT)'; \
+ b='t-unary'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-do-exceptions-work-at-all-with-this-compiler.log: t-do-exceptions-work-at-all-with-this-compiler$(EXEEXT)
+ @p='t-do-exceptions-work-at-all-with-this-compiler$(EXEEXT)'; \
+ b='t-do-exceptions-work-at-all-with-this-compiler'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-ops2z.log: t-ops2z$(EXEEXT)
+ @p='t-ops2z$(EXEEXT)'; \
+ b='t-ops2z'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-assign.log: t-assign$(EXEEXT)
+ @p='t-assign$(EXEEXT)'; \
+ b='t-assign'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-constr.log: t-constr$(EXEEXT)
+ @p='t-constr$(EXEEXT)'; \
+ b='t-constr'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-rand.log: t-rand$(EXEEXT)
+ @p='t-rand$(EXEEXT)'; \
+ b='t-rand'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+.test.log:
+ @p='$<'; \
+ $(am__set_b); \
+ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+@am__EXEEXT_TRUE@.test$(EXEEXT).log:
+@am__EXEEXT_TRUE@ @p='$<'; \
+@am__EXEEXT_TRUE@ $(am__set_b); \
+@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
+@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+ -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+ -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+ -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
+ ctags ctags-am distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ recheck tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/vendor/gmp-6.3.0/tests/cxx/clocale.c b/vendor/gmp-6.3.0/tests/cxx/clocale.c
new file mode 100644
index 0000000..7f7c36e
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/clocale.c
@@ -0,0 +1,66 @@
+/* Manipulable localeconv and nl_langinfo.
+
+Copyright 2001, 2002, 2014 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#if HAVE_NL_TYPES_H
+#include <nl_types.h> /* for nl_item */
+#endif
+
+#if HAVE_LANGINFO_H
+#include <langinfo.h> /* for nl_langinfo */
+#endif
+
+#if HAVE_LOCALE_H
+#include <locale.h> /* for lconv */
+#endif
+
+
+/* Replace the libc localeconv and nl_langinfo with ones we can manipulate.
+
+ This is done in a C file since if it was in a C++ file then we'd have to
+ match the "throw" or lack thereof declared for localeconv in <locale.h>.
+ g++ 3.2 gives an error about mismatched throws under "-pedantic", other
+ C++ compilers may very possibly do so too. */
+
+extern char point_string[];
+
+#if HAVE_LOCALECONV && ! defined __MINGW32__
+struct lconv *
+localeconv (void)
+#if defined __cplusplus && defined __GLIBC__
+ throw()
+#endif
+{
+ static struct lconv l;
+ l.decimal_point = point_string;
+ return &l;
+}
+#endif
+
+#if HAVE_NL_LANGINFO
+char *
+nl_langinfo (nl_item n)
+#if defined __cplusplus && defined __GLIBC__
+ throw()
+#endif
+{
+ return point_string;
+}
+#endif
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-assign.cc b/vendor/gmp-6.3.0/tests/cxx/t-assign.cc
new file mode 100644
index 0000000..a11b0d9
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-assign.cc
@@ -0,0 +1,603 @@
+/* Test mp*_class assignment operators.
+
+Copyright 2001-2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <iostream>
+#include <string>
+
+#include "gmpxx.h"
+#include "gmp-impl.h"
+#include "tests.h"
+
+using std::string;
+using std::invalid_argument;
+
+
+void
+check_mpz (void)
+{
+ // operator=(const mpz_class &)
+ {
+ mpz_class a(123), b;
+ b = a; ASSERT_ALWAYS(b == 123);
+ }
+
+ // template <class T, class U> operator=(const __gmp_expr<T, U> &)
+ // not tested here, see t-unary.cc, t-binary.cc
+
+ // operator=(signed char)
+ {
+ signed char a = -127;
+ mpz_class b;
+ b = a; ASSERT_ALWAYS(b == -127);
+ }
+
+ // operator=(unsigned char)
+ {
+ unsigned char a = 255;
+ mpz_class b;
+ b = a; ASSERT_ALWAYS(b == 255);
+ }
+
+ // either signed or unsigned char, machine dependent
+ {
+ mpz_class a;
+ a = 'A'; ASSERT_ALWAYS(a == 65);
+ }
+ {
+ mpz_class a;
+ a = 'z'; ASSERT_ALWAYS(a == 122);
+ }
+
+ // operator=(signed int)
+ {
+ signed int a = 0;
+ mpz_class b;
+ b = a; ASSERT_ALWAYS(b == 0);
+ }
+ {
+ signed int a = -123;
+ mpz_class b;
+ b = a; ASSERT_ALWAYS(b == -123);
+ }
+ {
+ signed int a = 32767;
+ mpz_class b;
+ b = a; ASSERT_ALWAYS(b == 32767);
+ }
+
+ // operator=(unsigned int)
+ {
+ unsigned int a = 65535u;
+ mpz_class b;
+ b = a; ASSERT_ALWAYS(b == 65535u);
+ }
+
+ // operator=(signed short int)
+ {
+ signed short int a = -12345;
+ mpz_class b;
+ b = a; ASSERT_ALWAYS(b == -12345);
+ }
+
+ // operator=(unsigned short int)
+ {
+ unsigned short int a = 54321u;
+ mpz_class b;
+ b = a; ASSERT_ALWAYS(b == 54321u);
+ }
+
+ // operator=(signed long int)
+ {
+ signed long int a = -1234567890L;
+ mpz_class b;
+ b = a; ASSERT_ALWAYS(b == -1234567890L);
+ }
+
+ // operator=(unsigned long int)
+ {
+ unsigned long int a = 3456789012UL;
+ mpz_class b;
+ b = a; ASSERT_ALWAYS(b == 3456789012UL);
+ }
+
+ // operator=(float)
+ {
+ float a = 123.0;
+ mpz_class b;
+ b = a; ASSERT_ALWAYS(b == 123);
+ }
+
+ // operator=(double)
+ {
+ double a = 0.0;
+ mpz_class b;
+ b = a; ASSERT_ALWAYS(b == 0);
+ }
+ {
+ double a = -12.375;
+ mpz_class b;
+ b = a; ASSERT_ALWAYS(b == -12);
+ }
+ {
+ double a = 6.789e+3;
+ mpz_class b;
+ b = a; ASSERT_ALWAYS(b == 6789);
+ }
+ {
+ double a = 9.375e-1;
+ mpz_class b;
+ b = a; ASSERT_ALWAYS(b == 0);
+ }
+
+ // operator=(long double)
+ // currently not implemented
+
+ // operator=(const char *)
+ {
+ const char *a = "1234567890";
+ mpz_class b;
+ b = a; ASSERT_ALWAYS(b == 1234567890L);
+ }
+
+ // operator=(const std::string &)
+ {
+ string a("1234567890");
+ mpz_class b;
+ b = a; ASSERT_ALWAYS(b == 1234567890L);
+ }
+
+ // operator=(const char *) with invalid
+ {
+ try {
+ const char *a = "abc";
+ mpz_class b;
+ b = a;
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+
+ // operator=(const std::string &) with invalid
+ {
+ try {
+ string a("def");
+ mpz_class b;
+ b = a;
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+
+ // swap(mpz_class &)
+ {
+ mpz_class a(123);
+ mpz_class b(456);
+ a.swap(b);
+ a.swap(a);
+ ASSERT_ALWAYS(a == 456);
+ ASSERT_ALWAYS(b == 123);
+ }
+
+ // swap(mpz_class &, mpz_class &)
+ {
+ mpz_class a(123);
+ mpz_class b(456);
+ ::swap(a, b);
+ ::swap(a, a);
+ ASSERT_ALWAYS(a == 456);
+ ASSERT_ALWAYS(b == 123);
+ }
+ {
+ using std::swap;
+ mpz_class a(123);
+ mpz_class b(456);
+ swap(a, b);
+ swap(a, a);
+ ASSERT_ALWAYS(a == 456);
+ ASSERT_ALWAYS(b == 123);
+ }
+}
+
+void
+check_mpq (void)
+{
+ // operator=(const mpq_class &)
+ {
+ mpq_class a(1, 2), b;
+ b = a; ASSERT_ALWAYS(b == 0.5);
+ }
+
+ // template <class T, class U> operator=(const __gmp_expr<T, U> &)
+ // not tested here, see t-unary.cc, t-binary.cc
+
+ // operator=(signed char)
+ {
+ signed char a = -127;
+ mpq_class b;
+ b = a; ASSERT_ALWAYS(b == -127);
+ }
+
+ // operator=(unsigned char)
+ {
+ unsigned char a = 255;
+ mpq_class b;
+ b = a; ASSERT_ALWAYS(b == 255);
+ }
+
+ // either signed or unsigned char, machine dependent
+ {
+ mpq_class a;
+ a = 'A'; ASSERT_ALWAYS(a == 65);
+ }
+ {
+ mpq_class a;
+ a = 'z'; ASSERT_ALWAYS(a == 122);
+ }
+
+ // operator=(signed int)
+ {
+ signed int a = 0;
+ mpq_class b;
+ b = a; ASSERT_ALWAYS(b == 0);
+ }
+ {
+ signed int a = -123;
+ mpq_class b;
+ b = a; ASSERT_ALWAYS(b == -123);
+ }
+ {
+ signed int a = 32767;
+ mpq_class b;
+ b = a; ASSERT_ALWAYS(b == 32767);
+ }
+
+ // operator=(unsigned int)
+ {
+ unsigned int a = 65535u;
+ mpq_class b;
+ b = a; ASSERT_ALWAYS(b == 65535u);
+ }
+
+ // operator=(signed short int)
+ {
+ signed short int a = -12345;
+ mpq_class b;
+ b = a; ASSERT_ALWAYS(b == -12345);
+ }
+
+ // operator=(unsigned short int)
+ {
+ unsigned short int a = 54321u;
+ mpq_class b;
+ b = a; ASSERT_ALWAYS(b == 54321u);
+ }
+
+ // operator=(signed long int)
+ {
+ signed long int a = -1234567890L;
+ mpq_class b;
+ b = a; ASSERT_ALWAYS(b == -1234567890L);
+ }
+
+ // operator=(unsigned long int)
+ {
+ unsigned long int a = 3456789012UL;
+ mpq_class b;
+ b = a; ASSERT_ALWAYS(b == 3456789012UL);
+ }
+
+ // operator=(float)
+ {
+ float a = 123.0;
+ mpq_class b;
+ b = a; ASSERT_ALWAYS(b == 123);
+ }
+
+ // operator=(double)
+ {
+ double a = 0.0;
+ mpq_class b;
+ b = a; ASSERT_ALWAYS(b == 0);
+ }
+ {
+ double a = -12.375;
+ mpq_class b;
+ b = a; ASSERT_ALWAYS(b == -12.375);
+ }
+ {
+ double a = 6.789e+3;
+ mpq_class b;
+ b = a; ASSERT_ALWAYS(b == 6789);
+ }
+ {
+ double a = 9.375e-1;
+ mpq_class b;
+ b = a; ASSERT_ALWAYS(b == 0.9375);
+ }
+
+ // operator=(long double)
+ // currently not implemented
+
+ // operator=(const char *)
+ {
+ const char *a = "1234567890";
+ mpq_class b;
+ b = a; ASSERT_ALWAYS(b == 1234567890L);
+ }
+
+ // operator=(const std::string &)
+ {
+ string a("1234567890");
+ mpq_class b;
+ b = a; ASSERT_ALWAYS(b == 1234567890L);
+ }
+
+ // operator=(const char *) with invalid
+ {
+ try {
+ const char *a = "abc";
+ mpq_class b;
+ b = a;
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+
+ // operator=(const std::string &) with invalid
+ {
+ try {
+ string a("def");
+ mpq_class b;
+ b = a;
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+
+ // swap(mpq_class &)
+ {
+ mpq_class a(3, 2);
+ mpq_class b(-1, 4);
+ a.swap(b);
+ a.swap(a);
+ ASSERT_ALWAYS(a == -.25);
+ ASSERT_ALWAYS(b == 1.5);
+ }
+
+ // swap(mpq_class &, mpq_class &)
+ {
+ mpq_class a(3, 2);
+ mpq_class b(-1, 4);
+ ::swap(a, b);
+ ::swap(a, a);
+ ASSERT_ALWAYS(a == -.25);
+ ASSERT_ALWAYS(b == 1.5);
+ }
+ {
+ using std::swap;
+ mpq_class a(3, 2);
+ mpq_class b(-1, 4);
+ swap(a, b);
+ swap(a, a);
+ ASSERT_ALWAYS(a == -.25);
+ ASSERT_ALWAYS(b == 1.5);
+ }
+}
+
+void
+check_mpf (void)
+{
+ // operator=(const mpf_class &)
+ {
+ mpf_class a(123), b;
+ b = a; ASSERT_ALWAYS(b == 123);
+ }
+
+ // template <class T, class U> operator=(const __gmp_expr<T, U> &)
+ // not tested here, see t-unary.cc, t-binary.cc
+
+ // operator=(signed char)
+ {
+ signed char a = -127;
+ mpf_class b;
+ b = a; ASSERT_ALWAYS(b == -127);
+ }
+
+ // operator=(unsigned char)
+ {
+ unsigned char a = 255;
+ mpf_class b;
+ b = a; ASSERT_ALWAYS(b == 255);
+ }
+
+ // either signed or unsigned char, machine dependent
+ {
+ mpf_class a;
+ a = 'A'; ASSERT_ALWAYS(a == 65);
+ }
+ {
+ mpf_class a;
+ a = 'z'; ASSERT_ALWAYS(a == 122);
+ }
+
+ // operator=(signed int)
+ {
+ signed int a = 0;
+ mpf_class b;
+ b = a; ASSERT_ALWAYS(b == 0);
+ }
+ {
+ signed int a = -123;
+ mpf_class b;
+ b = a; ASSERT_ALWAYS(b == -123);
+ }
+ {
+ signed int a = 32767;
+ mpf_class b;
+ b = a; ASSERT_ALWAYS(b == 32767);
+ }
+
+ // operator=(unsigned int)
+ {
+ unsigned int a = 65535u;
+ mpf_class b;
+ b = a; ASSERT_ALWAYS(b == 65535u);
+ }
+
+ // operator=(signed short int)
+ {
+ signed short int a = -12345;
+ mpf_class b;
+ b = a; ASSERT_ALWAYS(b == -12345);
+ }
+
+ // operator=(unsigned short int)
+ {
+ unsigned short int a = 54321u;
+ mpf_class b;
+ b = a; ASSERT_ALWAYS(b == 54321u);
+ }
+
+ // operator=(signed long int)
+ {
+ signed long int a = -1234567890L;
+ mpf_class b;
+ b = a; ASSERT_ALWAYS(b == -1234567890L);
+ }
+
+ // operator=(unsigned long int)
+ {
+ unsigned long int a = 3456789012UL;
+ mpf_class b;
+ b = a; ASSERT_ALWAYS(b == 3456789012UL);
+ }
+
+ // operator=(float)
+ {
+ float a = 123.0;
+ mpf_class b;
+ b = a; ASSERT_ALWAYS(b == 123);
+ }
+
+ // operator=(double)
+ {
+ double a = 0.0;
+ mpf_class b;
+ b = a; ASSERT_ALWAYS(b == 0);
+ }
+ {
+ double a = -12.375;
+ mpf_class b;
+ b = a; ASSERT_ALWAYS(b == -12.375);
+ }
+ {
+ double a = 6.789e+3;
+ mpf_class b;
+ b = a; ASSERT_ALWAYS(b == 6789);
+ }
+ {
+ double a = 9.375e-1;
+ mpf_class b;
+ b = a; ASSERT_ALWAYS(b == 0.9375);
+ }
+
+ // operator=(long double)
+ // currently not implemented
+
+ // operator=(const char *)
+ {
+ const char *a = "1234567890";
+ mpf_class b;
+ b = a; ASSERT_ALWAYS(b == 1234567890L);
+ }
+
+ // operator=(const std::string &)
+ {
+ string a("1234567890");
+ mpf_class b;
+ b = a; ASSERT_ALWAYS(b == 1234567890L);
+ }
+
+ // operator=(const char *) with invalid
+ {
+ try {
+ const char *a = "abc";
+ mpf_class b;
+ b = a;
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+
+ // operator=(const std::string &) with invalid
+ {
+ try {
+ string a("def");
+ mpf_class b;
+ b = a;
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+
+ // swap(mpf_class &)
+ {
+ mpf_class a(123);
+ mpf_class b(456);
+ a.swap(b);
+ a.swap(a);
+ ASSERT_ALWAYS(a == 456);
+ ASSERT_ALWAYS(b == 123);
+ }
+
+ // swap(mpf_class &, mpf_class &)
+ {
+ mpf_class a(123);
+ mpf_class b(456);
+ ::swap(a, b);
+ ::swap(a, a);
+ ASSERT_ALWAYS(a == 456);
+ ASSERT_ALWAYS(b == 123);
+ }
+ {
+ using std::swap;
+ mpf_class a(123);
+ mpf_class b(456);
+ swap(a, b);
+ swap(a, a);
+ ASSERT_ALWAYS(a == 456);
+ ASSERT_ALWAYS(b == 123);
+ }
+}
+
+
+int
+main (void)
+{
+ tests_start();
+
+ check_mpz();
+ check_mpq();
+ check_mpf();
+
+ tests_end();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-binary.cc b/vendor/gmp-6.3.0/tests/cxx/t-binary.cc
new file mode 100644
index 0000000..697adfa
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-binary.cc
@@ -0,0 +1,465 @@
+/* Test mp*_class binary expressions.
+
+Copyright 2001-2003, 2008, 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <iostream>
+
+#include "gmpxx.h"
+#include "gmp-impl.h"
+#include "tests.h"
+
+using namespace std;
+
+
+void
+check_mpz (void)
+{
+ // template <class T, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, T>, __gmp_expr<T, T>, Op> >
+ {
+ mpz_class a(1), b(2);
+ mpz_class c(a + b); ASSERT_ALWAYS(c == 3);
+ }
+ {
+ mpz_class a(3), b(4);
+ mpz_class c;
+ c = a * b; ASSERT_ALWAYS(c == 12);
+ }
+ {
+ mpz_class a(5), b(3);
+ mpz_class c;
+ c = a % b; ASSERT_ALWAYS(c == 2);
+ }
+
+ // template <class T, class U, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, T>, U, Op> >
+ {
+ mpz_class a(1);
+ signed int b = 3;
+ mpz_class c(a - b); ASSERT_ALWAYS(c == -2);
+ }
+ {
+ mpz_class a(-8);
+ unsigned int b = 2;
+ mpz_class c;
+ c = a / b; ASSERT_ALWAYS(c == -4);
+ }
+ {
+ mpz_class a(2);
+ double b = 3.0;
+ mpz_class c(a + b); ASSERT_ALWAYS(c == 5);
+ }
+ {
+ mpz_class a(4);
+ mpz_class b;
+ b = a + 0; ASSERT_ALWAYS(b == 4);
+ }
+
+ // template <class T, class U, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<U, __gmp_expr<T, T>, Op> >
+ {
+ mpz_class a(3);
+ signed int b = 9;
+ mpz_class c(b / a); ASSERT_ALWAYS(c == 3);
+ }
+
+ // template <class T, class U, class V, class W, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, U>, __gmp_expr<V, W>, Op> >
+ // type of result can't be mpz
+
+ // template <class T, class U, class V, class W, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<U, V>, __gmp_expr<T, W>, Op> >
+ // type of result can't be mpz
+
+ // template <class T, class U, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, T>, __gmp_expr<T, U>, Op> >
+ {
+ mpz_class a(3), b(4);
+ mpz_class c(a * (-b)); ASSERT_ALWAYS(c == -12);
+ c = c * (-b); ASSERT_ALWAYS(c == 48);
+ }
+
+ // template <class T, class U, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, U>, __gmp_expr<T, T>, Op> >
+ {
+ mpz_class a(3), b(2), c(1);
+ mpz_class d;
+ d = (a % b) + c; ASSERT_ALWAYS(d == 2);
+ d = (a % b) + d; ASSERT_ALWAYS(d == 3);
+ }
+
+ // template <class T, class U, class V, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, U>, V, Op> >
+ {
+ mpz_class a(-5);
+ unsigned int b = 2;
+ mpz_class c((-a) << b); ASSERT_ALWAYS(c == 20);
+ }
+ {
+ mpz_class a(5), b(-4);
+ signed int c = 3;
+ mpz_class d;
+ d = (a * b) >> c; ASSERT_ALWAYS(d == -3);
+ }
+
+ // template <class T, class U, class V, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<U, __gmp_expr<T, V>, Op> >
+ {
+ mpz_class a(2), b(4);
+ double c = 6;
+ mpz_class d(c / (a - b)); ASSERT_ALWAYS(d == -3);
+ }
+ {
+ mpz_class a(3), b(2);
+ double c = 1;
+ mpz_class d;
+ d = c + (a + b); ASSERT_ALWAYS(d == 6);
+ }
+
+ // template <class T, class U, class V, class W, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, U>, __gmp_expr<V, W>, Op> >
+ // type of result can't be mpz
+
+ // template <class T, class U, class V, class W, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<U, V>, __gmp_expr<T, W>, Op> >
+ // type of result can't be mpz
+
+ // template <class T, class U, class V, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, U>, __gmp_expr<T, V>, Op> >
+ {
+ mpz_class a(3), b(5), c(7);
+ mpz_class d;
+ d = (a - b) * (-c); ASSERT_ALWAYS(d == 14);
+ d = (b - d) * (-a); ASSERT_ALWAYS(d == 27);
+ d = (a - b) * (-d); ASSERT_ALWAYS(d == 54);
+ }
+
+ {
+ mpz_class a(0xcafe), b(0xbeef), c, want;
+ c = a & b; ASSERT_ALWAYS (c == 0x8aee);
+ c = a | b; ASSERT_ALWAYS (c == 0xfeff);
+ c = a ^ b; ASSERT_ALWAYS (c == 0x7411);
+ c = a & 0xbeef; ASSERT_ALWAYS (c == 0x8aee);
+ c = a | 0xbeef; ASSERT_ALWAYS (c == 0xfeff);
+ c = a ^ 0xbeef; ASSERT_ALWAYS (c == 0x7411);
+ c = a & -0xbeef; ASSERT_ALWAYS (c == 0x4010);
+ c = a | -0xbeef; ASSERT_ALWAYS (c == -0x3401);
+ c = a ^ -0xbeef; ASSERT_ALWAYS (c == -0x7411);
+ c = a & 48879.0; ASSERT_ALWAYS (c == 0x8aee);
+ c = a | 48879.0; ASSERT_ALWAYS (c == 0xfeff);
+ c = a ^ 48879.0; ASSERT_ALWAYS (c == 0x7411);
+
+ c = a | 1267650600228229401496703205376.0; // 2^100
+ want = "0x1000000000000000000000cafe";
+ ASSERT_ALWAYS (c == want);
+ }
+
+}
+
+void
+check_mpq (void)
+{
+ // template <class T, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, T>, __gmp_expr<T, T>, Op> >
+ {
+ mpq_class a(1, 2), b(3, 4);
+ mpq_class c(a + b); ASSERT_ALWAYS(c == 1.25);
+ }
+
+ // template <class T, class U, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, T>, U, Op> >
+ {
+ mpq_class a(1, 2);
+ signed int b = 3;
+ mpq_class c(a - b); ASSERT_ALWAYS(c == -2.5);
+ }
+ {
+ mpq_class a(1, 2);
+ mpq_class b;
+ b = a + 0; ASSERT_ALWAYS(b == 0.5);
+ }
+
+ // template <class T, class U, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<U, __gmp_expr<T, T>, Op> >
+ {
+ mpq_class a(2, 3);
+ signed int b = 4;
+ mpq_class c;
+ c = b / a; ASSERT_ALWAYS(c == 6);
+ }
+
+ // template <class T, class U, class V, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, T>, __gmp_expr<U, V>, Op> >
+ {
+ mpq_class a(1, 2);
+ mpz_class b(1);
+ mpq_class c(a + b); ASSERT_ALWAYS(c == 1.5);
+ }
+ {
+ mpq_class a(2, 3);
+ mpz_class b(1);
+ double c = 2.0;
+ mpq_class d;
+ d = a * (b + c); ASSERT_ALWAYS(d == 2);
+ d = d * (b + c); ASSERT_ALWAYS(d == 6);
+ }
+
+ // template <class T, class U, class V, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<U, V>, __gmp_expr<T, T>, Op> >
+ {
+ mpq_class a(2, 3);
+ mpz_class b(4);
+ mpq_class c(b / a); ASSERT_ALWAYS(c == 6);
+ }
+ {
+ mpq_class a(2, 3);
+ mpz_class b(1), c(4);
+ mpq_class d;
+ d = (b - c) * a; ASSERT_ALWAYS(d == -2);
+ d = (b - c) * d; ASSERT_ALWAYS(d == 6);
+ }
+
+ // template <class T, class U, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, T>, __gmp_expr<T, U>, Op> >
+ {
+ mpq_class a(1, 3), b(3, 4);
+ mpq_class c;
+ c = a * (-b); ASSERT_ALWAYS(c == -0.25);
+ a = a * (-b); ASSERT_ALWAYS(a == -0.25);
+ }
+
+ // template <class T, class U, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, U>, __gmp_expr<T, T>, Op> >
+ {
+ mpq_class a(1, 3), b(2, 3), c(1, 4);
+ mpq_class d((a / b) + c); ASSERT_ALWAYS(d == 0.75);
+ c = (a / b) + c; ASSERT_ALWAYS(c == 0.75);
+ }
+
+ // template <class T, class U, class V, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, U>, V, Op> >
+ {
+ mpq_class a(3, 8);
+ unsigned int b = 4;
+ mpq_class c((-a) << b); ASSERT_ALWAYS(c == -6);
+ }
+
+ // template <class T, class U, class V, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<U, __gmp_expr<T, V>, Op> >
+ {
+ mpq_class a(1, 2), b(1, 4);
+ double c = 6.0;
+ mpq_class d;
+ d = c / (a + b); ASSERT_ALWAYS(d == 8);
+ }
+
+ // template <class T, class U, class V, class W, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, U>, __gmp_expr<V, W>, Op> >
+ {
+ mpq_class a(1, 2), b(1, 4);
+ mpz_class c(1);
+ mpq_class d((a + b) - c); ASSERT_ALWAYS(d == -0.25);
+ d = (a + d) - c; ASSERT_ALWAYS(d == -0.75);
+ d = (a + d) - d.get_num(); ASSERT_ALWAYS(d == 2.75);
+ d = (2 * d) * d.get_den(); ASSERT_ALWAYS(d == 22);
+ d = (b * d) / -d.get_num(); ASSERT_ALWAYS(d == -0.25);
+ }
+ {
+ mpq_class a(1, 3), b(3, 2);
+ mpz_class c(2), d(4);
+ mpq_class e;
+ e = (a * b) / (c - d); ASSERT_ALWAYS(e == -0.25);
+ e = (2 * e) / (c - d); ASSERT_ALWAYS(e == 0.25);
+ }
+
+ // template <class T, class U, class V, class W, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<U, V>, __gmp_expr<T, W>, Op> >
+ {
+ mpq_class a(1, 3), b(3, 4);
+ mpz_class c(-3);
+ mpq_class d(c * (a * b)); ASSERT_ALWAYS(d == -0.75);
+ }
+ {
+ mpq_class a(1, 3), b(3, 5);
+ mpz_class c(6);
+ signed int d = 4;
+ mpq_class e;
+ e = (c % d) / (a * b); ASSERT_ALWAYS(e == 10);
+ e = (e.get_num() % d) / (2 / e); ASSERT_ALWAYS(e == 10);
+ }
+
+ // template <class T, class U, class V, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, U>, __gmp_expr<T, V>, Op> >
+ {
+ mpq_class a(1, 3), b(3, 4), c(2, 5);
+ mpq_class d;
+ d = (a * b) / (-c); ASSERT_ALWAYS(d == -0.625);
+ d = (c * d) / (-b); ASSERT_ALWAYS(3 * d == 1);
+ d = (a * c) / (-d); ASSERT_ALWAYS(5 * d == -2);
+ }
+}
+
+void
+check_mpf (void)
+{
+ // template <class T, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, T>, __gmp_expr<T, T>, Op> >
+ {
+ mpf_class a(1), b(2);
+ mpf_class c(a + b); ASSERT_ALWAYS(c == 3);
+ }
+ {
+ mpf_class a(1.5), b(6);
+ mpf_class c;
+ c = a / b; ASSERT_ALWAYS(c == 0.25);
+ }
+
+ // template <class T, class U, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, T>, U, Op> >
+ {
+ mpf_class a(1);
+ signed int b = -2;
+ mpf_class c(a - b); ASSERT_ALWAYS(c == 3);
+ }
+ {
+ mpf_class a(2);
+ mpf_class b;
+ b = a + 0; ASSERT_ALWAYS(b == 2);
+ }
+
+ // template <class T, class U, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<U, __gmp_expr<T, T>, Op> >
+ {
+ mpf_class a(2);
+ unsigned int b = 3;
+ mpf_class c;
+ c = b / a; ASSERT_ALWAYS(c == 1.5);
+ }
+
+ // template <class T, class U, class V, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, T>, __gmp_expr<U, V>, Op> >
+ {
+ mpf_class a(2);
+ mpz_class b(3);
+ mpf_class c(a - b); ASSERT_ALWAYS(c == -1);
+ }
+ {
+ mpf_class a(3);
+ mpz_class b(2), c(1);
+ mpf_class d;
+ d = a * (b + c); ASSERT_ALWAYS(d == 9);
+ a = a * (b + c); ASSERT_ALWAYS(a == 9);
+ }
+
+ // template <class T, class U, class V, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<U, V>, __gmp_expr<T, T>, Op> >
+ {
+ mpf_class a(6);
+ mpq_class b(3, 4);
+ mpf_class c(a * b); ASSERT_ALWAYS(c == 4.5);
+ }
+
+ // template <class T, class U, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, T>, __gmp_expr<T, U>, Op> >
+ {
+ mpf_class a(2), b(-3);
+ mpf_class c;
+ c = a * (-b); ASSERT_ALWAYS(c == 6);
+ c = c * (-b); ASSERT_ALWAYS(c == 18);
+ }
+
+ // template <class T, class U, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, U>, __gmp_expr<T, T>, Op> >
+ {
+ mpf_class a(3), b(4), c(5);
+ mpf_class d;
+ d = (a / b) - c; ASSERT_ALWAYS(d == -4.25);
+ c = (a / b) - c; ASSERT_ALWAYS(c == -4.25);
+ }
+
+ // template <class T, class U, class V, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, U>, V, Op> >
+ {
+ mpf_class a(3);
+ unsigned int b = 2;
+ mpf_class c((-a) >> b); ASSERT_ALWAYS(c == -0.75);
+ }
+
+ // template <class T, class U, class V, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<U, __gmp_expr<T, V>, Op> >
+ {
+ mpf_class a(2), b(3);
+ double c = 5.0;
+ mpf_class d;
+ d = c / (a + b); ASSERT_ALWAYS(d == 1);
+ }
+
+ // template <class T, class U, class V, class W, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, U>, __gmp_expr<V, W>, Op> >
+ {
+ mpf_class a(2), b(3);
+ mpz_class c(4);
+ mpf_class d;
+ d = (a + b) * c; ASSERT_ALWAYS(d == 20);
+ }
+ {
+ mpf_class a(2), b(3);
+ mpq_class c(1, 2), d(1, 4);
+ mpf_class e;
+ e = (a * b) / (c + d); ASSERT_ALWAYS(e == 8);
+ }
+
+ // template <class T, class U, class V, class W, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<U, V>, __gmp_expr<T, W>, Op> >
+ {
+ mpf_class a(1), b(2);
+ mpq_class c(3);
+ mpf_class d(c / (a + b)); ASSERT_ALWAYS(d == 1);
+ }
+ {
+ mpf_class a(1);
+ mpz_class b(2);
+ mpq_class c(3, 4);
+ mpf_class d;
+ d = (-c) + (a + b); ASSERT_ALWAYS(d == 2.25);
+ }
+
+ // template <class T, class U, class V, class Op>
+ // __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, U>, __gmp_expr<T, V>, Op> >
+ {
+ mpf_class a(1), b(2), c(3);
+ mpf_class d;
+ d = (a + b) * (-c); ASSERT_ALWAYS(d == -9);
+ }
+}
+
+
+int
+main (void)
+{
+ tests_start();
+
+ check_mpz();
+ check_mpq();
+ check_mpf();
+
+ tests_end();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-cast.cc b/vendor/gmp-6.3.0/tests/cxx/t-cast.cc
new file mode 100644
index 0000000..983b3b8
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-cast.cc
@@ -0,0 +1,56 @@
+/* Test g++ -Wold-style-cast cleanliness.
+
+Copyright 2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "gmpxx.h"
+
+
+/* This code doesn't do anything when run, it just expands various C macros
+ to see that they don't trigger compile-time warnings from g++
+ -Wold-style-cast. This option isn't used in a normal build, it has to be
+ added manually to make this test worthwhile. */
+
+void
+check_macros (void)
+{
+ mpz_t z;
+ long l = 123;
+ unsigned long u = 456;
+ int i;
+ mp_limb_t limb;
+
+ mpz_init_set_ui (z, 0L);
+ i = mpz_odd_p (z);
+ i = mpz_even_p (z);
+ i = mpz_cmp_si (z, l);
+ i = mpz_cmp_ui (z, u);
+ mpz_clear (z);
+
+ limb = GMP_NUMB_MASK;
+ limb = GMP_NUMB_MAX;
+ limb = GMP_NAIL_MASK;
+
+ mpn_divmod (&limb, &limb, 1, &limb, 1);
+ mpn_divexact_by3 (&limb, &limb, 1);
+}
+
+int
+main (void)
+{
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-constr.cc b/vendor/gmp-6.3.0/tests/cxx/t-constr.cc
new file mode 100644
index 0000000..500878e
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-constr.cc
@@ -0,0 +1,755 @@
+/* Test mp*_class constructors.
+
+Copyright 2001-2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <iostream>
+#include <string>
+
+#include "gmpxx.h"
+#include "gmp-impl.h"
+#include "tests.h"
+
+using namespace std;
+
+
+void
+check_mpz (void)
+{
+ // mpz_class()
+ {
+ mpz_class a; ASSERT_ALWAYS(a == 0);
+ }
+
+ // mpz_class(const mpz_class &)
+ // see below
+
+ // template <class T, class U> mpz_class(const __gmp_expr<T, U> &)
+ // not tested here, see t-unary.cc, t-binary.cc
+
+ // mpz_class(signed char)
+ {
+ signed char a = -127;
+ mpz_class b(a); ASSERT_ALWAYS(b == -127);
+ }
+
+ // mpz_class(unsigned char)
+ {
+ unsigned char a = 255;
+ mpz_class b(a); ASSERT_ALWAYS(b == 255);
+ }
+
+ // either signed or unsigned char, machine dependent
+ {
+ mpz_class a('A'); ASSERT_ALWAYS(a == 65);
+ }
+ {
+ mpz_class a('z'); ASSERT_ALWAYS(a == 122);
+ }
+
+ // mpz_class(signed int)
+ {
+ signed int a = 0;
+ mpz_class b(a); ASSERT_ALWAYS(b == 0);
+ }
+ {
+ signed int a = -123;
+ mpz_class b(a); ASSERT_ALWAYS(b == -123);
+ }
+ {
+ signed int a = 4567;
+ mpz_class b(a); ASSERT_ALWAYS(b == 4567);
+ }
+
+ // mpz_class(unsigned int)
+ {
+ unsigned int a = 890;
+ mpz_class b(a); ASSERT_ALWAYS(b == 890);
+ }
+
+ // mpz_class(signed short int)
+ {
+ signed short int a = -12345;
+ mpz_class b(a); ASSERT_ALWAYS(b == -12345);
+ }
+
+ // mpz_class(unsigned short int)
+ {
+ unsigned short int a = 54321u;
+ mpz_class b(a); ASSERT_ALWAYS(b == 54321u);
+ }
+
+ // mpz_class(signed long int)
+ {
+ signed long int a = -1234567890L;
+ mpz_class b(a); ASSERT_ALWAYS(b == -1234567890L);
+ }
+
+ // mpz_class(unsigned long int)
+ {
+ unsigned long int a = 1UL << 30;
+ mpz_class b(a); ASSERT_ALWAYS(b == 1073741824L);
+ }
+
+ // mpz_class(float)
+ {
+ float a = 123.45;
+ mpz_class b(a); ASSERT_ALWAYS(b == 123);
+ }
+
+ // mpz_class(double)
+ {
+ double a = 3.141592653589793238;
+ mpz_class b(a); ASSERT_ALWAYS(b == 3);
+ }
+
+ // mpz_class(long double)
+ // currently not implemented
+
+ // mpz_class(const char *)
+ {
+ const char *a = "1234567890";
+ mpz_class b(a); ASSERT_ALWAYS(b == 1234567890L);
+ }
+
+ // mpz_class(const char *, int)
+ {
+ const char *a = "FFFF";
+ int base = 16;
+ mpz_class b(a, base); ASSERT_ALWAYS(b == 65535u);
+ }
+
+ // mpz_class(const std::string &)
+ {
+ string a("1234567890");
+ mpz_class b(a); ASSERT_ALWAYS(b == 1234567890L);
+ }
+
+ // mpz_class(const std::string &, int)
+ {
+ string a("7777");
+ int base = 8;
+ mpz_class b(a, base); ASSERT_ALWAYS(b == 4095);
+ }
+
+ // mpz_class(const char *) with invalid
+ {
+ try {
+ const char *a = "ABC";
+ mpz_class b(a);
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+
+ // mpz_class(const char *, int) with invalid
+ {
+ try {
+ const char *a = "GHI";
+ int base = 16;
+ mpz_class b(a, base);
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+
+ // mpz_class(const std::string &) with invalid
+ {
+ try {
+ string a("abc");
+ mpz_class b(a);
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+
+ // mpz_class(const std::string &, int) with invalid
+ {
+ try {
+ string a("ZZZ");
+ int base = 8;
+ mpz_class b(a, base);
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+
+ // mpz_class(mpz_srcptr)
+ {
+ mpz_t a;
+ mpz_init_set_ui(a, 100);
+ mpz_class b(a); ASSERT_ALWAYS(b == 100);
+ mpz_clear(a);
+ }
+
+ // mpz_class(const mpz_class &)
+ {
+ mpz_class a(12345); // tested above, assume it works
+ mpz_class b(a); ASSERT_ALWAYS(b == 12345);
+ }
+
+ // no constructor for bool, but it gets casted to int
+ {
+ bool a = true;
+ mpz_class b(a); ASSERT_ALWAYS(b == 1);
+ }
+ {
+ bool a = false;
+ mpz_class b(a); ASSERT_ALWAYS(b == 0);
+ }
+}
+
+void
+check_mpq (void)
+{
+ // mpq_class()
+ {
+ mpq_class a; ASSERT_ALWAYS(a == 0);
+ }
+
+ // mpq_class(const mpq_class &)
+ // see below
+
+ // template <class T, class U> mpq_class(const __gmp_expr<T, U> &)
+ // not tested here, see t-unary.cc, t-binary.cc
+
+ // mpq_class(signed char)
+ {
+ signed char a = -127;
+ mpq_class b(a); ASSERT_ALWAYS(b == -127);
+ }
+
+ // mpq_class(unsigned char)
+ {
+ unsigned char a = 255;
+ mpq_class b(a); ASSERT_ALWAYS(b == 255);
+ }
+
+ // either signed or unsigned char, machine dependent
+ {
+ mpq_class a('A'); ASSERT_ALWAYS(a == 65);
+ }
+ {
+ mpq_class a('z'); ASSERT_ALWAYS(a == 122);
+ }
+
+ // mpq_class(signed int)
+ {
+ signed int a = 0;
+ mpq_class b(a); ASSERT_ALWAYS(b == 0);
+ }
+ {
+ signed int a = -123;
+ mpq_class b(a); ASSERT_ALWAYS(b == -123);
+ }
+ {
+ signed int a = 4567;
+ mpq_class b(a); ASSERT_ALWAYS(b == 4567);
+ }
+
+ // mpq_class(unsigned int)
+ {
+ unsigned int a = 890;
+ mpq_class b(a); ASSERT_ALWAYS(b == 890);
+ }
+
+ // mpq_class(signed short int)
+ {
+ signed short int a = -12345;
+ mpq_class b(a); ASSERT_ALWAYS(b == -12345);
+ }
+
+ // mpq_class(unsigned short int)
+ {
+ unsigned short int a = 54321u;
+ mpq_class b(a); ASSERT_ALWAYS(b == 54321u);
+ }
+
+ // mpq_class(signed long int)
+ {
+ signed long int a = -1234567890L;
+ mpq_class b(a); ASSERT_ALWAYS(b == -1234567890L);
+ }
+
+ // mpq_class(unsigned long int)
+ {
+ unsigned long int a = 1UL << 30;
+ mpq_class b(a); ASSERT_ALWAYS(b == 1073741824L);
+ }
+
+ // mpq_class(float)
+ {
+ float a = 0.625;
+ mpq_class b(a); ASSERT_ALWAYS(b == 0.625);
+ }
+
+ // mpq_class(double)
+ {
+ double a = 1.25;
+ mpq_class b(a); ASSERT_ALWAYS(b == 1.25);
+ }
+
+ // mpq_class(long double)
+ // currently not implemented
+
+ // mpq_class(const char *)
+ {
+ const char *a = "1234567890";
+ mpq_class b(a); ASSERT_ALWAYS(b == 1234567890L);
+ }
+
+ // mpq_class(const char *, int)
+ {
+ const char *a = "FFFF";
+ int base = 16;
+ mpq_class b(a, base); ASSERT_ALWAYS(b == 65535u);
+ mpq_class c(0, 1); ASSERT_ALWAYS(c == 0);
+ }
+
+ // mpq_class(const std::string &)
+ {
+ string a("1234567890");
+ mpq_class b(a); ASSERT_ALWAYS(b == 1234567890L);
+ }
+
+ // mpq_class(const std::string &, int)
+ {
+ string a("7777");
+ int base = 8;
+ mpq_class b(a, base); ASSERT_ALWAYS(b == 4095);
+ }
+
+ // mpq_class(const char *) with invalid
+ {
+ try {
+ const char *a = "abc";
+ mpq_class b(a);
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+
+ // mpq_class(const char *, int) with invalid
+ {
+ try {
+ const char *a = "ZZZ";
+ int base = 16;
+ mpq_class b (a, base);
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+
+ // mpq_class(const std::string &) with invalid
+ {
+ try {
+ string a("abc");
+ mpq_class b(a);
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+
+ // mpq_class(const std::string &, int) with invalid
+ {
+ try {
+ string a("ZZZ");
+ int base = 8;
+ mpq_class b (a, base);
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+
+ // mpq_class(mpq_srcptr)
+ {
+ mpq_t a;
+ mpq_init(a);
+ mpq_set_ui(a, 100, 1);
+ mpq_class b(a); ASSERT_ALWAYS(b == 100);
+ mpq_clear(a);
+ }
+
+ // mpq_class(const mpz_class &, const mpz_class &)
+ {
+ mpz_class a(123), b(4); // tested above, assume it works
+ mpq_class c(a, b); ASSERT_ALWAYS(c == 30.75);
+ }
+ {
+ mpz_class a(-1), b(2); // tested above, assume it works
+ mpq_class c(a, b); ASSERT_ALWAYS(c == -0.5);
+ }
+ {
+ mpz_class a(5), b(4); // tested above, assume it works
+ mpq_class c(a, b); ASSERT_ALWAYS(c == 1.25);
+ }
+
+ // mpq_class(const mpz_class &)
+ {
+ mpq_class a(12345); // tested above, assume it works
+ mpq_class b(a); ASSERT_ALWAYS(b == 12345);
+ }
+
+ // no constructor for bool, but it gets casted to int
+ {
+ bool a = true;
+ mpq_class b(a); ASSERT_ALWAYS(b == 1);
+ }
+ {
+ bool a = false;
+ mpq_class b(a); ASSERT_ALWAYS(b == 0);
+ }
+}
+
+void
+check_mpf (void)
+{
+ // mpf_class()
+ {
+ mpf_class a; ASSERT_ALWAYS(a == 0);
+ }
+
+ // mpf_class(const mpf_class &)
+ // mpf_class(const mpf_class &, unsigned long int)
+ // see below
+
+ // template <class T, class U> mpf_class(const __gmp_expr<T, U> &)
+ // template <class T, class U> mpf_class(const __gmp_expr<T, U> &,
+ // unsigned long int)
+ // not tested here, see t-unary.cc, t-binary.cc
+
+ // mpf_class(signed char)
+ {
+ signed char a = -127;
+ mpf_class b(a); ASSERT_ALWAYS(b == -127);
+ }
+
+ // mpf_class(signed char, unsigned long int)
+ {
+ signed char a = -1;
+ int prec = 64;
+ mpf_class b(a, prec); ASSERT_ALWAYS(b == -1);
+ }
+
+ // mpf_class(unsigned char)
+ {
+ unsigned char a = 255;
+ mpf_class b(a); ASSERT_ALWAYS(b == 255);
+ }
+
+ // mpf_class(unsigned char, unsigned long int)
+ {
+ unsigned char a = 128;
+ int prec = 128;
+ mpf_class b(a, prec); ASSERT_ALWAYS(b == 128);
+ }
+
+ // either signed or unsigned char, machine dependent
+ {
+ mpf_class a('A'); ASSERT_ALWAYS(a == 65);
+ }
+ {
+ int prec = 256;
+ mpf_class a('z', prec); ASSERT_ALWAYS(a == 122);
+ }
+
+ // mpf_class(signed int)
+ {
+ signed int a = 0;
+ mpf_class b(a); ASSERT_ALWAYS(b == 0);
+ }
+ {
+ signed int a = -123;
+ mpf_class b(a); ASSERT_ALWAYS(b == -123);
+ }
+ {
+ signed int a = 4567;
+ mpf_class b(a); ASSERT_ALWAYS(b == 4567);
+ }
+
+ // mpf_class(signed int, unsigned long int)
+ {
+ signed int a = -123;
+ int prec = 64;
+ mpf_class b(a, prec); ASSERT_ALWAYS(b == -123);
+ }
+
+ // mpf_class(unsigned int)
+ {
+ unsigned int a = 890;
+ mpf_class b(a); ASSERT_ALWAYS(b == 890);
+ }
+
+ // mpf_class(unsigned int, unsigned long int)
+ {
+ unsigned int a = 890;
+ int prec = 128;
+ mpf_class b(a, prec); ASSERT_ALWAYS(b == 890);
+ }
+
+ // mpf_class(signed short int)
+ {
+ signed short int a = -12345;
+ mpf_class b(a); ASSERT_ALWAYS(b == -12345);
+ }
+
+ // mpf_class(signed short int, unsigned long int)
+ {
+ signed short int a = 6789;
+ int prec = 256;
+ mpf_class b(a, prec); ASSERT_ALWAYS(b == 6789);
+ }
+
+ // mpf_class(unsigned short int)
+ {
+ unsigned short int a = 54321u;
+ mpf_class b(a); ASSERT_ALWAYS(b == 54321u);
+ }
+
+ // mpf_class(unsigned short int, unsigned long int)
+ {
+ unsigned short int a = 54321u;
+ int prec = 64;
+ mpf_class b(a, prec); ASSERT_ALWAYS(b == 54321u);
+ }
+
+ // mpf_class(signed long int)
+ {
+ signed long int a = -1234567890L;
+ mpf_class b(a); ASSERT_ALWAYS(b == -1234567890L);
+ }
+
+ // mpf_class(signed long int, unsigned long int)
+ {
+ signed long int a = -1234567890L;
+ int prec = 128;
+ mpf_class b(a, prec); ASSERT_ALWAYS(b == -1234567890L);
+ }
+
+ // mpf_class(unsigned long int)
+ {
+ unsigned long int a = 3456789012UL;
+ mpf_class b(a); ASSERT_ALWAYS(b == 3456789012UL);
+ }
+
+ // mpf_class(unsigned long int, unsigned long int)
+ {
+ unsigned long int a = 3456789012UL;
+ int prec = 256;
+ mpf_class b(a, prec); ASSERT_ALWAYS(b == 3456789012UL);
+ }
+
+ // mpf_class(float)
+ {
+ float a = 1234.5;
+ mpf_class b(a); ASSERT_ALWAYS(b == 1234.5);
+ }
+
+ // mpf_class(float, unsigned long int)
+ {
+ float a = 1234.5;
+ int prec = 64;
+ mpf_class b(a, prec); ASSERT_ALWAYS(b == 1234.5);
+ }
+
+ // mpf_class(double)
+ {
+ double a = 12345.0;
+ mpf_class b(a); ASSERT_ALWAYS(b == 12345);
+ }
+ {
+ double a = 1.2345e+4;
+ mpf_class b(a); ASSERT_ALWAYS(b == 12345);
+ }
+ {
+ double a = 312.5e-2;
+ mpf_class b(a); ASSERT_ALWAYS(b == 3.125);
+ }
+
+ // mpf_class(double, unsigned long int)
+ {
+ double a = 5.4321e+4;
+ int prec = 128;
+ mpf_class b(a, prec); ASSERT_ALWAYS(b == 54321L);
+ }
+
+ // mpf_class(long double)
+ // mpf_class(long double, unsigned long int)
+ // currently not implemented
+
+ // mpf_class(const char *)
+ {
+ const char *a = "1234567890";
+ mpf_class b(a); ASSERT_ALWAYS(b == 1234567890L);
+ }
+
+ // mpf_class(const char *, unsigned long int, int = 0)
+ {
+ const char *a = "1234567890";
+ int prec = 256;
+ mpf_class b(a, prec); ASSERT_ALWAYS(b == 1234567890L);
+ }
+ {
+ const char *a = "777777";
+ int prec = 64, base = 8;
+ mpf_class b(a, prec, base); ASSERT_ALWAYS(b == 262143L);
+ }
+
+ // mpf_class(const std::string &)
+ {
+ string a("1234567890");
+ mpf_class b(a); ASSERT_ALWAYS(b == 1234567890L);
+ }
+
+ // mpf_class(const std::string &, unsigned long int, int = 0)
+ {
+ string a("1234567890");
+ int prec = 128;
+ mpf_class b(a, prec); ASSERT_ALWAYS(b == 1234567890L);
+ }
+ {
+ string a("FFFF");
+ int prec = 256, base = 16;
+ mpf_class b(a, prec, base); ASSERT_ALWAYS(b == 65535u);
+ }
+
+ // mpf_class(const char *) with invalid
+ {
+ try {
+ const char *a = "abc";
+ mpf_class b(a);
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+
+ // mpf_class(const char *, unsigned long int, int = 0) with invalid
+ {
+ try {
+ const char *a = "def";
+ int prec = 256;
+ mpf_class b(a, prec); ASSERT_ALWAYS(b == 1234567890L);
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+ {
+ try {
+ const char *a = "ghi";
+ int prec = 64, base = 8;
+ mpf_class b(a, prec, base); ASSERT_ALWAYS(b == 262143L);
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+
+ // mpf_class(const std::string &) with invalid
+ {
+ try {
+ string a("abc");
+ mpf_class b(a); ASSERT_ALWAYS(b == 1234567890L);
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+
+ // mpf_class(const std::string &, unsigned long int, int = 0) with invalid
+ {
+ try {
+ string a("def");
+ int prec = 128;
+ mpf_class b(a, prec); ASSERT_ALWAYS(b == 1234567890L);
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+ {
+ try {
+ string a("ghi");
+ int prec = 256, base = 16;
+ mpf_class b(a, prec, base); ASSERT_ALWAYS(b == 65535u);
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (invalid_argument&) {
+ }
+ }
+
+ // mpf_class(mpf_srcptr)
+ {
+ mpf_t a;
+ mpf_init_set_ui(a, 100);
+ mpf_class b(a); ASSERT_ALWAYS(b == 100);
+ mpf_clear(a);
+ }
+
+ // mpf_class(mpf_srcptr, unsigned long int)
+ {
+ mpf_t a;
+ int prec = 64;
+ mpf_init_set_ui(a, 100);
+ mpf_class b(a, prec); ASSERT_ALWAYS(b == 100);
+ mpf_clear(a);
+ }
+
+ // mpf_class(const mpf_class &)
+ {
+ mpf_class a(12345); // tested above, assume it works
+ mpf_class b(a); ASSERT_ALWAYS(b == 12345);
+ }
+
+ // mpf_class(const mpf_class &, unsigned long int)
+ {
+ mpf_class a(12345); // tested above, assume it works
+ int prec = 64;
+ mpf_class b(a, prec); ASSERT_ALWAYS(b == 12345);
+ }
+
+ // no constructors for bool, but it gets casted to int
+ {
+ bool a = true;
+ mpf_class b(a); ASSERT_ALWAYS(b == 1);
+ }
+ {
+ bool a = false;
+ mpf_class b(a); ASSERT_ALWAYS(b == 0);
+ }
+ {
+ bool a = true;
+ int prec = 128;
+ mpf_class b(a, prec); ASSERT_ALWAYS(b == 1);
+ }
+ {
+ bool a = false;
+ int prec = 256;
+ mpf_class b(a, prec); ASSERT_ALWAYS(b == 0);
+ }
+}
+
+
+int
+main (void)
+{
+ tests_start();
+
+ check_mpz();
+ check_mpq();
+ check_mpf();
+
+ tests_end();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-cxx11.cc b/vendor/gmp-6.3.0/tests/cxx/t-cxx11.cc
new file mode 100644
index 0000000..8d6fccb
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-cxx11.cc
@@ -0,0 +1,232 @@
+/* Test C++11 features
+
+Copyright 2011, 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include "gmpxx.h"
+#include "gmp-impl.h"
+#include "tests.h"
+
+#if __GMPXX_USE_CXX11
+
+#include <utility>
+#include <type_traits>
+
+void check_noexcept ()
+{
+ mpz_class z1, z2;
+ mpq_class q1, q2;
+ mpf_class f1, f2;
+ static_assert(noexcept(z1 = std::move(z2)), "sorry");
+ static_assert(noexcept(q1 = std::move(q2)), "sorry");
+ static_assert(noexcept(f1 = std::move(f2)), "sorry");
+ static_assert(noexcept(q1 = std::move(z1)), "sorry");
+
+ // Only mpz has lazy allocation for now
+ static_assert(std::is_nothrow_default_constructible<mpz_class>::value, "sorry");
+ static_assert(std::is_nothrow_move_constructible<mpz_class>::value, "sorry");
+ static_assert(!std::is_nothrow_default_constructible<mpq_class>::value, "sorry");
+ static_assert(!std::is_nothrow_move_constructible<mpq_class>::value, "sorry");
+ static_assert(!std::is_nothrow_default_constructible<mpf_class>::value, "sorry");
+ static_assert(!std::is_nothrow_move_constructible<mpf_class>::value, "sorry");
+}
+
+void check_common_type ()
+{
+#define CHECK_COMMON_TYPE1(T, Res) \
+ static_assert(std::is_same<std::common_type<T>::type, Res>::value, "sorry")
+#define CHECK_COMMON_TYPE(T, U, Res) \
+ static_assert(std::is_same<std::common_type<T, U>::type, Res>::value, "sorry")
+#define CHECK_COMMON_TYPE_BUILTIN1(T, Res) \
+ CHECK_COMMON_TYPE( signed char , T, Res); \
+ CHECK_COMMON_TYPE(unsigned char , T, Res); \
+ CHECK_COMMON_TYPE( signed short, T, Res); \
+ CHECK_COMMON_TYPE(unsigned short, T, Res); \
+ CHECK_COMMON_TYPE( signed int , T, Res); \
+ CHECK_COMMON_TYPE(unsigned int , T, Res); \
+ CHECK_COMMON_TYPE( signed long , T, Res); \
+ CHECK_COMMON_TYPE(unsigned long , T, Res); \
+ CHECK_COMMON_TYPE(float , T, Res); \
+ CHECK_COMMON_TYPE(double, T, Res)
+#define CHECK_COMMON_TYPE_BUILTIN2(T, Res) \
+ CHECK_COMMON_TYPE(T, signed char , Res); \
+ CHECK_COMMON_TYPE(T, unsigned char , Res); \
+ CHECK_COMMON_TYPE(T, signed short, Res); \
+ CHECK_COMMON_TYPE(T, unsigned short, Res); \
+ CHECK_COMMON_TYPE(T, signed int , Res); \
+ CHECK_COMMON_TYPE(T, unsigned int , Res); \
+ CHECK_COMMON_TYPE(T, signed long , Res); \
+ CHECK_COMMON_TYPE(T, unsigned long , Res); \
+ CHECK_COMMON_TYPE(T, float , Res); \
+ CHECK_COMMON_TYPE(T, double, Res)
+#define CHECK_COMMON_TYPE_BUILTIN(T, Res) \
+ CHECK_COMMON_TYPE_BUILTIN1(T, Res); \
+ CHECK_COMMON_TYPE_BUILTIN2(T, Res)
+ /* These would just work with implicit conversions */
+ CHECK_COMMON_TYPE (mpz_class, mpq_class, mpq_class);
+ CHECK_COMMON_TYPE (mpz_class, mpf_class, mpf_class);
+ CHECK_COMMON_TYPE (mpf_class, mpq_class, mpf_class);
+
+ CHECK_COMMON_TYPE_BUILTIN (mpz_class, mpz_class);
+ CHECK_COMMON_TYPE_BUILTIN (mpq_class, mpq_class);
+ CHECK_COMMON_TYPE_BUILTIN (mpf_class, mpf_class);
+
+ mpz_class z; mpq_class q; mpf_class f;
+
+ CHECK_COMMON_TYPE (decltype(-z), mpz_class, mpz_class);
+ CHECK_COMMON_TYPE (decltype(-q), mpq_class, mpq_class);
+ CHECK_COMMON_TYPE (decltype(-f), mpf_class, mpf_class);
+
+ CHECK_COMMON_TYPE (decltype(-z), mpq_class, mpq_class);
+ CHECK_COMMON_TYPE (decltype(-z), mpf_class, mpf_class);
+ CHECK_COMMON_TYPE (decltype(-q), mpf_class, mpf_class);
+
+ /* These require a common_type specialization */
+ CHECK_COMMON_TYPE (decltype(-z), decltype(z+z), mpz_class);
+ CHECK_COMMON_TYPE (decltype(-q), decltype(q+q), mpq_class);
+ CHECK_COMMON_TYPE (decltype(-f), decltype(f+f), mpf_class);
+
+ CHECK_COMMON_TYPE (decltype(-q), mpz_class, mpq_class);
+ CHECK_COMMON_TYPE (decltype(-f), mpz_class, mpf_class);
+ CHECK_COMMON_TYPE (decltype(-f), mpq_class, mpf_class);
+
+ CHECK_COMMON_TYPE (decltype(-z), decltype(-q), mpq_class);
+ CHECK_COMMON_TYPE (decltype(-z), decltype(-f), mpf_class);
+ CHECK_COMMON_TYPE (decltype(-q), decltype(-f), mpf_class);
+
+ /* common_type now decays */
+ CHECK_COMMON_TYPE (decltype(-z), decltype(-z), mpz_class);
+ CHECK_COMMON_TYPE (decltype(-q), decltype(-q), mpq_class);
+ CHECK_COMMON_TYPE (decltype(-f), decltype(-f), mpf_class);
+ CHECK_COMMON_TYPE1 (decltype(-z), mpz_class);
+ CHECK_COMMON_TYPE1 (decltype(-q), mpq_class);
+ CHECK_COMMON_TYPE1 (decltype(-f), mpf_class);
+
+ /* Painful */
+ CHECK_COMMON_TYPE_BUILTIN (decltype(-z), mpz_class);
+ CHECK_COMMON_TYPE_BUILTIN (decltype(-q), mpq_class);
+ CHECK_COMMON_TYPE_BUILTIN (decltype(-f), mpf_class);
+}
+
+template<class T, class U = T>
+void check_move_init ()
+{
+ {
+ // Delete moved-from x1
+ T x1 = 3;
+ U x2 = std::move(x1);
+ ASSERT_ALWAYS (x2 == 3);
+ }
+ {
+ // Assign to moved-from x1
+ T x1 = 2;
+ U x2 = std::move(x1);
+ x1 = -7;
+ ASSERT_ALWAYS (x1 == -7);
+ ASSERT_ALWAYS (x2 == 2);
+ }
+}
+
+template<class T, class U = T>
+void check_move_assign ()
+{
+ {
+ // Delete moved-from x1
+ T x1 = 3; U x2;
+ x2 = std::move(x1);
+ ASSERT_ALWAYS (x2 == 3);
+ }
+ {
+ // Assign to moved-from x1
+ T x1 = 2; U x2;
+ x2 = std::move(x1);
+ x1 = -7;
+ ASSERT_ALWAYS (x1 == -7);
+ ASSERT_ALWAYS (x2 == 2);
+ }
+ {
+ // Self move-assign (not necessary, but it happens to work...)
+ T x = 4;
+ x = std::move(x);
+ ASSERT_ALWAYS (x == 4);
+ }
+}
+
+void check_user_defined_literal ()
+{
+ ASSERT_ALWAYS (123_mpz % 5 == 3);
+ ASSERT_ALWAYS (-11_mpq / 22 == -.5);
+ ASSERT_ALWAYS (112.5e-1_mpf * 4 == 45);
+ {
+ mpz_class ref ( "123456789abcdef0123456789abcdef0123", 16);
+ ASSERT_ALWAYS (0x123456789abcdef0123456789abcdef0123_mpz == ref);
+ }
+}
+
+// Check for explicit conversion to bool
+void implicit_bool(bool);
+int implicit_bool(...);
+
+void check_bool_conversion ()
+{
+ const mpz_class zn = -2;
+ const mpq_class qn = -2;
+ const mpf_class fn = -2;
+ const mpz_class z0 = 0;
+ const mpq_class q0 = 0;
+ const mpf_class f0 = 0;
+ const mpz_class zp = +2;
+ const mpq_class qp = +2;
+ const mpf_class fp = +2;
+ if (zn && qn && fn && zp && qp && fp && !z0 && !q0 && !f0)
+ {
+ if (z0 || q0 || f0) ASSERT_ALWAYS(false);
+ }
+ else ASSERT_ALWAYS(false);
+ decltype(implicit_bool(zn)) zi = 1;
+ decltype(implicit_bool(qn)) qi = 1;
+ decltype(implicit_bool(fn)) fi = 1;
+ (void)(zi+qi+fi);
+}
+
+int
+main (void)
+{
+ tests_start();
+
+ check_noexcept();
+ check_common_type();
+ check_move_init<mpz_class>();
+ check_move_init<mpq_class>();
+ check_move_init<mpf_class>();
+ check_move_assign<mpz_class>();
+ check_move_assign<mpq_class>();
+ check_move_assign<mpf_class>();
+ check_move_init<mpz_class,mpq_class>();
+ check_move_assign<mpz_class,mpq_class>();
+ check_user_defined_literal();
+ check_bool_conversion();
+
+ tests_end();
+ return 0;
+}
+
+#else
+int main () { return 0; }
+#endif
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc b/vendor/gmp-6.3.0/tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc
new file mode 100644
index 0000000..014eb75
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc
@@ -0,0 +1,38 @@
+/* Test if the compiler has working try / throw / catch.
+
+Copyright 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdexcept>
+
+inline void
+throw_expr ()
+{
+ throw std::invalid_argument ("Test");
+}
+
+using namespace std;
+
+int
+main ()
+{
+ try
+ {
+ throw_expr();
+ }
+ catch (invalid_argument&) { }
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-headers.cc b/vendor/gmp-6.3.0/tests/cxx/t-headers.cc
new file mode 100644
index 0000000..35f7a25
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-headers.cc
@@ -0,0 +1,26 @@
+/* Test that gmpxx.h compiles correctly.
+
+Copyright 2001, 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "gmpxx.h"
+
+int
+main (void)
+{
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-iostream.cc b/vendor/gmp-6.3.0/tests/cxx/t-iostream.cc
new file mode 100644
index 0000000..76e280b
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-iostream.cc
@@ -0,0 +1,106 @@
+/* Test stream formatted input and output on mp*_class
+
+Copyright 2011 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <sstream>
+
+#include "gmpxx.h"
+#include "gmp-impl.h"
+#include "tests.h"
+
+using namespace std;
+
+// The tests are extremely basic. These functions just forward to the
+// ones tested in t-istream.cc and t-ostream.cc; we rely on those for
+// advanced tests and only check the syntax here.
+
+void
+checki ()
+{
+ {
+ istringstream i("123");
+ mpz_class x;
+ i >> x;
+ ASSERT_ALWAYS (x == 123);
+ }
+ {
+ istringstream i("3/4");
+ mpq_class x;
+ i >> x;
+ ASSERT_ALWAYS (x == .75);
+ }
+ {
+ istringstream i("1.5");
+ mpf_class x;
+ i >> x;
+ ASSERT_ALWAYS (x == 1.5);
+ }
+}
+
+void
+checko ()
+{
+ {
+ ostringstream o;
+ mpz_class x=123;
+ o << x;
+ ASSERT_ALWAYS (o.str() == "123");
+ }
+ {
+ ostringstream o;
+ mpz_class x=123;
+ o << (x+1);
+ ASSERT_ALWAYS (o.str() == "124");
+ }
+ {
+ ostringstream o;
+ mpq_class x(3,4);
+ o << x;
+ ASSERT_ALWAYS (o.str() == "3/4");
+ }
+ {
+ ostringstream o;
+ mpq_class x(3,4);
+ o << (x+1);
+ ASSERT_ALWAYS (o.str() == "7/4");
+ }
+ {
+ ostringstream o;
+ mpf_class x=1.5;
+ o << x;
+ ASSERT_ALWAYS (o.str() == "1.5");
+ }
+ {
+ ostringstream o;
+ mpf_class x=1.5;
+ o << (x+1);
+ ASSERT_ALWAYS (o.str() == "2.5");
+ }
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+
+ checki ();
+ checko ();
+
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-istream.cc b/vendor/gmp-6.3.0/tests/cxx/t-istream.cc
new file mode 100644
index 0000000..76bcbab
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-istream.cc
@@ -0,0 +1,598 @@
+/* Test istream formatted input.
+
+Copyright 2001-2004 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <iostream>
+#include <cstdlib>
+#include <cstring>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+using namespace std;
+
+
+// Under option_check_standard, the various test cases for mpz operator>>
+// are put through the standard operator>> for long, and likewise mpf
+// operator>> is put through double.
+//
+// In g++ 3.3 this results in some printouts about the final position
+// indicated for something like ".e123". Our mpf code stops at the "e"
+// since there's no mantissa digits, but g++ reads the whole thing and only
+// then decides it's bad.
+
+bool option_check_standard = false;
+
+
+// On some versions of g++ 2.96 it's been observed that putback() may leave
+// tellg() unchanged. We believe this is incorrect and presumably the
+// result of a bug, since for instance it's ok in g++ 2.95 and g++ 3.3. We
+// detect the problem at runtime and disable affected checks.
+
+bool putback_tellg_works = true;
+
+void
+check_putback_tellg (void)
+{
+ istringstream input ("hello");
+ streampos old_pos, new_pos;
+ char c;
+
+ input.get(c);
+ old_pos = input.tellg();
+ input.putback(c);
+ new_pos = input.tellg();
+
+ if (old_pos == new_pos)
+ {
+ cout << "Warning, istringstream has a bug: putback() doesn't update tellg().\n";;
+ cout << "Tests on tellg() will be skipped.\n";
+ putback_tellg_works = false;
+ }
+}
+
+
+#define WRONG(str) \
+ do { \
+ cout << str ", data[" << i << "]\n"; \
+ cout << " input: \"" << data[i].input << "\"\n"; \
+ cout << " flags: " << hex << input.flags() << dec << "\n"; \
+ } while (0)
+
+void
+check_mpz (void)
+{
+ static const struct {
+ const char *input;
+ int want_pos;
+ const char *want;
+ ios::fmtflags flags;
+
+ } data[] = {
+
+ { "0", -1, "0", (ios::fmtflags) 0 },
+ { "123", -1, "123", (ios::fmtflags) 0 },
+ { "0123", -1, "83", (ios::fmtflags) 0 },
+ { "0x123", -1, "291", (ios::fmtflags) 0 },
+ { "-123", -1, "-123", (ios::fmtflags) 0 },
+ { "-0123", -1, "-83", (ios::fmtflags) 0 },
+ { "-0x123", -1, "-291", (ios::fmtflags) 0 },
+ { "+123", -1, "123", (ios::fmtflags) 0 },
+ { "+0123", -1, "83", (ios::fmtflags) 0 },
+ { "+0x123", -1, "291", (ios::fmtflags) 0 },
+
+ { "0", -1, "0", ios::dec },
+ { "1f", 1, "1", ios::dec },
+ { "011f", 3, "11", ios::dec },
+ { "123", -1, "123", ios::dec },
+ { "-1f", 2, "-1", ios::dec },
+ { "-011f", 4, "-11", ios::dec },
+ { "-123", -1, "-123", ios::dec },
+ { "+1f", 2, "1", ios::dec },
+ { "+011f", 4, "11", ios::dec },
+ { "+123", -1, "123", ios::dec },
+
+ { "0", -1, "0", ios::oct },
+ { "123", -1, "83", ios::oct },
+ { "-123", -1, "-83", ios::oct },
+ { "+123", -1, "83", ios::oct },
+
+ { "0", -1, "0", ios::hex },
+ { "123", -1, "291", ios::hex },
+ { "ff", -1, "255", ios::hex },
+ { "FF", -1, "255", ios::hex },
+ { "-123", -1, "-291", ios::hex },
+ { "-ff", -1, "-255", ios::hex },
+ { "-FF", -1, "-255", ios::hex },
+ { "+123", -1, "291", ios::hex },
+ { "+ff", -1, "255", ios::hex },
+ { "+FF", -1, "255", ios::hex },
+ { "ab", -1, "171", ios::hex },
+ { "cd", -1, "205", ios::hex },
+ { "ef", -1, "239", ios::hex },
+
+ { " 123", 0, NULL, (ios::fmtflags) 0 }, // not without skipws
+ { " 123", -1, "123", ios::skipws },
+ };
+
+ mpz_t got, want;
+ bool got_ok, want_ok;
+ bool got_eof, want_eof;
+ long got_si, want_si;
+ streampos init_tellg, got_pos, want_pos;
+
+ mpz_init (got);
+ mpz_init (want);
+
+ for (size_t i = 0; i < numberof (data); i++)
+ {
+ size_t input_length = strlen (data[i].input);
+ want_pos = (data[i].want_pos == -1
+ ? input_length : data[i].want_pos);
+ want_eof = (want_pos == streampos(input_length));
+
+ want_ok = (data[i].want != NULL);
+
+ if (data[i].want != NULL)
+ mpz_set_str_or_abort (want, data[i].want, 0);
+ else
+ mpz_set_ui (want, 0L);
+
+ if (option_check_standard && mpz_fits_slong_p (want))
+ {
+ istringstream input (data[i].input);
+ input.flags (data[i].flags);
+ init_tellg = input.tellg();
+ want_si = mpz_get_si (want);
+
+ input >> got_si;
+ got_ok = !input.fail();
+ got_eof = input.eof();
+ input.clear();
+ got_pos = input.tellg() - init_tellg;
+
+ if (got_ok != want_ok)
+ {
+ WRONG ("stdc++ operator>> wrong status, check_mpz");
+ cout << " want_ok: " << want_ok << "\n";
+ cout << " got_ok: " << got_ok << "\n";
+ }
+ if (want_ok && got_si != want_si)
+ {
+ WRONG ("stdc++ operator>> wrong result, check_mpz");
+ cout << " got_si: " << got_si << "\n";
+ cout << " want_si: " << want_si << "\n";
+ }
+ if (want_ok && got_eof != want_eof)
+ {
+ WRONG ("stdc++ operator>> wrong EOF state, check_mpz");
+ cout << " got_eof: " << got_eof << "\n";
+ cout << " want_eof: " << want_eof << "\n";
+ }
+ if (putback_tellg_works && got_pos != want_pos)
+ {
+ WRONG ("stdc++ operator>> wrong position, check_mpz");
+ cout << " want_pos: " << want_pos << "\n";
+ cout << " got_pos: " << got_pos << "\n";
+ }
+ }
+
+ {
+ istringstream input (data[i].input);
+ input.flags (data[i].flags);
+ init_tellg = input.tellg();
+
+ mpz_set_ui (got, 0xDEAD);
+ input >> got;
+ got_ok = !input.fail();
+ got_eof = input.eof();
+ input.clear();
+ got_pos = input.tellg() - init_tellg;
+
+ if (got_ok != want_ok)
+ {
+ WRONG ("mpz operator>> wrong status");
+ cout << " want_ok: " << want_ok << "\n";
+ cout << " got_ok: " << got_ok << "\n";
+ abort ();
+ }
+ if (want_ok && mpz_cmp (got, want) != 0)
+ {
+ WRONG ("mpz operator>> wrong result");
+ mpz_trace (" got ", got);
+ mpz_trace (" want", want);
+ abort ();
+ }
+ if (want_ok && got_eof != want_eof)
+ {
+ WRONG ("mpz operator>> wrong EOF state");
+ cout << " want_eof: " << want_eof << "\n";
+ cout << " got_eof: " << got_eof << "\n";
+ abort ();
+ }
+ if (putback_tellg_works && got_pos != want_pos)
+ {
+ WRONG ("mpz operator>> wrong position");
+ cout << " want_pos: " << want_pos << "\n";
+ cout << " got_pos: " << got_pos << "\n";
+ abort ();
+ }
+ }
+ }
+
+ mpz_clear (got);
+ mpz_clear (want);
+}
+
+void
+check_mpq (void)
+{
+ static const struct {
+ const char *input;
+ int want_pos;
+ const char *want;
+ ios::fmtflags flags;
+
+ } data[] = {
+
+ { "0", -1, "0", (ios::fmtflags) 0 },
+ { "00", -1, "0", (ios::fmtflags) 0 },
+ { "0x0", -1, "0", (ios::fmtflags) 0 },
+
+ { "123/456", -1, "123/456", ios::dec },
+ { "0123/456", -1, "123/456", ios::dec },
+ { "123/0456", -1, "123/456", ios::dec },
+ { "0123/0456", -1, "123/456", ios::dec },
+
+ { "123/456", -1, "83/302", ios::oct },
+ { "0123/456", -1, "83/302", ios::oct },
+ { "123/0456", -1, "83/302", ios::oct },
+ { "0123/0456", -1, "83/302", ios::oct },
+
+ { "ab", -1, "171", ios::hex },
+ { "cd", -1, "205", ios::hex },
+ { "ef", -1, "239", ios::hex },
+
+ { "0/0", -1, "0/0", (ios::fmtflags) 0 },
+ { "5/8", -1, "5/8", (ios::fmtflags) 0 },
+ { "0x5/0x8", -1, "5/8", (ios::fmtflags) 0 },
+
+ { "123/456", -1, "123/456", (ios::fmtflags) 0 },
+ { "123/0456", -1, "123/302", (ios::fmtflags) 0 },
+ { "123/0x456", -1, "123/1110", (ios::fmtflags) 0 },
+ { "123/0X456", -1, "123/1110", (ios::fmtflags) 0 },
+
+ { "0123/123", -1, "83/123", (ios::fmtflags) 0 },
+ { "0123/0123", -1, "83/83", (ios::fmtflags) 0 },
+ { "0123/0x123", -1, "83/291", (ios::fmtflags) 0 },
+ { "0123/0X123", -1, "83/291", (ios::fmtflags) 0 },
+
+ { "0x123/123", -1, "291/123", (ios::fmtflags) 0 },
+ { "0X123/0123", -1, "291/83", (ios::fmtflags) 0 },
+ { "0x123/0x123", -1, "291/291", (ios::fmtflags) 0 },
+
+ { " 123", 0, NULL, (ios::fmtflags) 0 }, // not without skipws
+ { " 123", -1, "123", ios::skipws },
+
+ { "123 /456", 3, "123", (ios::fmtflags) 0 },
+ { "123/ 456", 4, NULL, (ios::fmtflags) 0 },
+ { "123/" , -1, NULL, (ios::fmtflags) 0 },
+ { "123 /456", 3, "123", ios::skipws },
+ { "123/ 456", 4, NULL, ios::skipws },
+ };
+
+ mpq_t got, want;
+ bool got_ok, want_ok;
+ bool got_eof, want_eof;
+ long got_si, want_si;
+ streampos init_tellg, got_pos, want_pos;
+
+ mpq_init (got);
+ mpq_init (want);
+
+ for (size_t i = 0; i < numberof (data); i++)
+ {
+ size_t input_length = strlen (data[i].input);
+ want_pos = (data[i].want_pos == -1
+ ? input_length : data[i].want_pos);
+ want_eof = (want_pos == streampos(input_length));
+
+ want_ok = (data[i].want != NULL);
+
+ if (data[i].want != NULL)
+ mpq_set_str_or_abort (want, data[i].want, 0);
+ else
+ mpq_set_ui (want, 0L, 1L);
+
+ if (option_check_standard
+ && mpz_fits_slong_p (mpq_numref(want))
+ && mpz_cmp_ui (mpq_denref(want), 1L) == 0
+ && strchr (data[i].input, '/') == NULL)
+ {
+ istringstream input (data[i].input);
+ input.flags (data[i].flags);
+ init_tellg = input.tellg();
+ want_si = mpz_get_si (mpq_numref(want));
+
+ input >> got_si;
+ got_ok = !input.fail();
+ got_eof = input.eof();
+ input.clear();
+ got_pos = input.tellg() - init_tellg;
+
+ if (got_ok != want_ok)
+ {
+ WRONG ("stdc++ operator>> wrong status, check_mpq");
+ cout << " want_ok: " << want_ok << "\n";
+ cout << " got_ok: " << got_ok << "\n";
+ }
+ if (want_ok && want_si != got_si)
+ {
+ WRONG ("stdc++ operator>> wrong result, check_mpq");
+ cout << " got_si: " << got_si << "\n";
+ cout << " want_si: " << want_si << "\n";
+ }
+ if (want_ok && got_eof != want_eof)
+ {
+ WRONG ("stdc++ operator>> wrong EOF state, check_mpq");
+ cout << " got_eof: " << got_eof << "\n";
+ cout << " want_eof: " << want_eof << "\n";
+ }
+ if (putback_tellg_works && got_pos != want_pos)
+ {
+ WRONG ("stdc++ operator>> wrong position, check_mpq");
+ cout << " want_pos: " << want_pos << "\n";
+ cout << " got_pos: " << got_pos << "\n";
+ }
+ }
+
+ {
+ istringstream input (data[i].input);
+ input.flags (data[i].flags);
+ init_tellg = input.tellg();
+ mpq_set_si (got, 0xDEAD, 0xBEEF);
+
+ input >> got;
+ got_ok = !input.fail();
+ got_eof = input.eof();
+ input.clear();
+ got_pos = input.tellg() - init_tellg;
+
+ if (got_ok != want_ok)
+ {
+ WRONG ("mpq operator>> wrong status");
+ cout << " want_ok: " << want_ok << "\n";
+ cout << " got_ok: " << got_ok << "\n";
+ abort ();
+ }
+ // don't use mpq_equal, since we allow non-normalized values to be
+ // read, which can trigger ASSERTs in mpq_equal
+ if (want_ok && (mpz_cmp (mpq_numref (got), mpq_numref(want)) != 0
+ || mpz_cmp (mpq_denref (got), mpq_denref(want)) != 0))
+ {
+ WRONG ("mpq operator>> wrong result");
+ mpq_trace (" got ", got);
+ mpq_trace (" want", want);
+ abort ();
+ }
+ if (want_ok && got_eof != want_eof)
+ {
+ WRONG ("mpq operator>> wrong EOF state");
+ cout << " want_eof: " << want_eof << "\n";
+ cout << " got_eof: " << got_eof << "\n";
+ abort ();
+ }
+ if (putback_tellg_works && got_pos != want_pos)
+ {
+ WRONG ("mpq operator>> wrong position");
+ cout << " want_pos: " << want_pos << "\n";
+ cout << " got_pos: " << got_pos << "\n";
+ abort ();
+ }
+ }
+ }
+
+ mpq_clear (got);
+ mpq_clear (want);
+}
+
+
+void
+check_mpf (void)
+{
+ static const struct {
+ const char *input;
+ int want_pos;
+ const char *want;
+ ios::fmtflags flags;
+
+ } data[] = {
+
+ { "0", -1, "0", (ios::fmtflags) 0 },
+ { "+0", -1, "0", (ios::fmtflags) 0 },
+ { "-0", -1, "0", (ios::fmtflags) 0 },
+ { "0.0", -1, "0", (ios::fmtflags) 0 },
+ { "0.", -1, "0", (ios::fmtflags) 0 },
+ { ".0", -1, "0", (ios::fmtflags) 0 },
+ { "+.0", -1, "0", (ios::fmtflags) 0 },
+ { "-.0", -1, "0", (ios::fmtflags) 0 },
+ { "+0.00", -1, "0", (ios::fmtflags) 0 },
+ { "-0.000", -1, "0", (ios::fmtflags) 0 },
+ { "+0.00", -1, "0", (ios::fmtflags) 0 },
+ { "-0.000", -1, "0", (ios::fmtflags) 0 },
+ { "0.0e0", -1, "0", (ios::fmtflags) 0 },
+ { "0.e0", -1, "0", (ios::fmtflags) 0 },
+ { ".0e0", -1, "0", (ios::fmtflags) 0 },
+ { "0.0e-0", -1, "0", (ios::fmtflags) 0 },
+ { "0.e-0", -1, "0", (ios::fmtflags) 0 },
+ { ".0e-0", -1, "0", (ios::fmtflags) 0 },
+ { "0.0e+0", -1, "0", (ios::fmtflags) 0 },
+ { "0.e+0", -1, "0", (ios::fmtflags) 0 },
+ { ".0e+0", -1, "0", (ios::fmtflags) 0 },
+
+ { "1", -1, "1", (ios::fmtflags) 0 },
+ { "+1", -1, "1", (ios::fmtflags) 0 },
+ { "-1", -1, "-1", (ios::fmtflags) 0 },
+
+ { " 0", 0, NULL, (ios::fmtflags) 0 }, // not without skipws
+ { " 0", -1, "0", ios::skipws },
+ { " +0", -1, "0", ios::skipws },
+ { " -0", -1, "0", ios::skipws },
+
+ { "+-123", 1, NULL, (ios::fmtflags) 0 },
+ { "-+123", 1, NULL, (ios::fmtflags) 0 },
+ { "1e+-123", 3, NULL, (ios::fmtflags) 0 },
+ { "1e-+123", 3, NULL, (ios::fmtflags) 0 },
+
+ { "e123", 0, NULL, (ios::fmtflags) 0 }, // at least one mantissa digit
+ { ".e123", 1, NULL, (ios::fmtflags) 0 },
+ { "+.e123", 2, NULL, (ios::fmtflags) 0 },
+ { "-.e123", 2, NULL, (ios::fmtflags) 0 },
+
+ { "123e", 4, NULL, (ios::fmtflags) 0 }, // at least one exponent digit
+ { "123e-", 5, NULL, (ios::fmtflags) 0 },
+ { "123e+", 5, NULL, (ios::fmtflags) 0 },
+ };
+
+ mpf_t got, want;
+ bool got_ok, want_ok;
+ bool got_eof, want_eof;
+ double got_d, want_d;
+ streampos init_tellg, got_pos, want_pos;
+
+ mpf_init (got);
+ mpf_init (want);
+
+ for (size_t i = 0; i < numberof (data); i++)
+ {
+ size_t input_length = strlen (data[i].input);
+ want_pos = (data[i].want_pos == -1
+ ? input_length : data[i].want_pos);
+ want_eof = (want_pos == streampos(input_length));
+
+ want_ok = (data[i].want != NULL);
+
+ if (data[i].want != NULL)
+ mpf_set_str_or_abort (want, data[i].want, 0);
+ else
+ mpf_set_ui (want, 0L);
+
+ want_d = mpf_get_d (want);
+ if (option_check_standard && mpf_cmp_d (want, want_d) == 0)
+ {
+ istringstream input (data[i].input);
+ input.flags (data[i].flags);
+ init_tellg = input.tellg();
+
+ input >> got_d;
+ got_ok = !input.fail();
+ got_eof = input.eof();
+ input.clear();
+ got_pos = input.tellg() - init_tellg;
+
+ if (got_ok != want_ok)
+ {
+ WRONG ("stdc++ operator>> wrong status, check_mpf");
+ cout << " want_ok: " << want_ok << "\n";
+ cout << " got_ok: " << got_ok << "\n";
+ }
+ if (want_ok && want_d != got_d)
+ {
+ WRONG ("stdc++ operator>> wrong result, check_mpf");
+ cout << " got: " << got_d << "\n";
+ cout << " want: " << want_d << "\n";
+ }
+ if (want_ok && got_eof != want_eof)
+ {
+ WRONG ("stdc++ operator>> wrong EOF state, check_mpf");
+ cout << " got_eof: " << got_eof << "\n";
+ cout << " want_eof: " << want_eof << "\n";
+ }
+ if (putback_tellg_works && got_pos != want_pos)
+ {
+ WRONG ("stdc++ operator>> wrong position, check_mpf");
+ cout << " want_pos: " << want_pos << "\n";
+ cout << " got_pos: " << got_pos << "\n";
+ }
+ }
+
+ {
+ istringstream input (data[i].input);
+ input.flags (data[i].flags);
+ init_tellg = input.tellg();
+
+ mpf_set_ui (got, 0xDEAD);
+ input >> got;
+ got_ok = !input.fail();
+ got_eof = input.eof();
+ input.clear();
+ got_pos = input.tellg() - init_tellg;
+
+ if (got_ok != want_ok)
+ {
+ WRONG ("mpf operator>> wrong status");
+ cout << " want_ok: " << want_ok << "\n";
+ cout << " got_ok: " << got_ok << "\n";
+ abort ();
+ }
+ if (want_ok && mpf_cmp (got, want) != 0)
+ {
+ WRONG ("mpf operator>> wrong result");
+ mpf_trace (" got ", got);
+ mpf_trace (" want", want);
+ abort ();
+ }
+ if (want_ok && got_eof != want_eof)
+ {
+ WRONG ("mpf operator>> wrong EOF state");
+ cout << " want_eof: " << want_eof << "\n";
+ cout << " got_eof: " << got_eof << "\n";
+ abort ();
+ }
+ if (putback_tellg_works && got_pos != want_pos)
+ {
+ WRONG ("mpf operator>> wrong position");
+ cout << " want_pos: " << want_pos << "\n";
+ cout << " got_pos: " << got_pos << "\n";
+ abort ();
+ }
+ }
+ }
+
+ mpf_clear (got);
+ mpf_clear (want);
+}
+
+
+
+int
+main (int argc, char *argv[])
+{
+ if (argc > 1 && strcmp (argv[1], "-s") == 0)
+ option_check_standard = true;
+
+ tests_start ();
+
+ check_putback_tellg ();
+ check_mpz ();
+ check_mpq ();
+ check_mpf ();
+
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-locale.cc b/vendor/gmp-6.3.0/tests/cxx/t-locale.cc
new file mode 100644
index 0000000..14e95e0
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-locale.cc
@@ -0,0 +1,194 @@
+/* Test locale support in C++ functions.
+
+Copyright 2001-2003, 2007 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <clocale>
+#include <iostream>
+#include <cstdlib>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+using namespace std;
+
+
+extern "C" {
+ char point_string[2];
+}
+
+#if HAVE_STD__LOCALE
+// Like std::numpunct, but with decimal_point coming from point_string[].
+class my_numpunct : public numpunct<char> {
+ public:
+ explicit my_numpunct (size_t r = 0) : numpunct<char>(r) { }
+ protected:
+ char do_decimal_point() const { return point_string[0]; }
+};
+#endif
+
+void
+set_point (char c)
+{
+ point_string[0] = c;
+
+#if HAVE_STD__LOCALE
+ locale loc (locale::classic(), new my_numpunct ());
+ locale::global (loc);
+#endif
+}
+
+
+void
+check_input (void)
+{
+ static const struct {
+ const char *str1;
+ const char *str2;
+ double want;
+ } data[] = {
+
+ { "1","", 1.0 },
+ { "1","0", 1.0 },
+ { "1","00", 1.0 },
+
+ { "","5", 0.5 },
+ { "0","5", 0.5 },
+ { "00","5", 0.5 },
+ { "00","50", 0.5 },
+
+ { "1","5", 1.5 },
+ { "1","5e1", 15.0 },
+ };
+
+ static char point[] = {
+ '.', ',', 'x', '\xFF'
+ };
+
+ mpf_t got;
+ mpf_init (got);
+
+ for (size_t i = 0; i < numberof (point); i++)
+ {
+ set_point (point[i]);
+
+ for (int neg = 0; neg <= 1; neg++)
+ {
+ for (size_t j = 0; j < numberof (data); j++)
+ {
+ string str = string(data[j].str1)+point[i]+string(data[j].str2);
+ if (neg)
+ str = "-" + str;
+
+ istringstream is (str.c_str());
+
+ mpf_set_ui (got, 123); // dummy initial value
+
+ if (! (is >> got))
+ {
+ cout << "istream mpf_t operator>> error\n";
+ cout << " point " << point[i] << "\n";
+ cout << " str \"" << str << "\"\n";
+ cout << " localeconv point \""
+ << GMP_DECIMAL_POINT << "\"\n";
+ abort ();
+ }
+
+ double want = data[j].want;
+ if (neg)
+ want = -want;
+ if (mpf_cmp_d (got, want) != 0)
+ {
+ cout << "istream mpf_t operator>> wrong\n";
+ cout << " point " << point[i] << "\n";
+ cout << " str \"" << str << "\"\n";
+ cout << " got " << got << "\n";
+ cout << " want " << want << "\n";
+ cout << " localeconv point \""
+ << GMP_DECIMAL_POINT << "\"\n";
+ abort ();
+ }
+ }
+ }
+ }
+
+ mpf_clear (got);
+}
+
+void
+check_output (void)
+{
+ static char point[] = {
+ '.', ',', 'x', '\xFF'
+ };
+
+ for (size_t i = 0; i < numberof (point); i++)
+ {
+ set_point (point[i]);
+ ostringstream got;
+
+ mpf_t f;
+ mpf_init (f);
+ mpf_set_d (f, 1.5);
+ got << f;
+ mpf_clear (f);
+
+ string want = string("1") + point[i] + string("5");
+
+ if (want.compare (got.str()) != 0)
+ {
+ cout << "ostream mpf_t operator<< doesn't respect locale\n";
+ cout << " point " << point[i] << "\n";
+ cout << " got \"" << got.str() << "\"\n";
+ cout << " want \"" << want << "\"\n";
+ abort ();
+ }
+ }
+}
+
+int
+replacement_works (void)
+{
+ set_point ('x');
+ mpf_t f;
+ mpf_init (f);
+ mpf_set_d (f, 1.5);
+ ostringstream s;
+ s << f;
+ mpf_clear (f);
+
+ return (s.str().compare("1x5") == 0);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ if (replacement_works())
+ {
+ check_input ();
+ check_output ();
+ }
+ else
+ {
+ cout << "Replacing decimal point didn't work, tests skipped\n";
+ }
+
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-misc.cc b/vendor/gmp-6.3.0/tests/cxx/t-misc.cc
new file mode 100644
index 0000000..1143e84
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-misc.cc
@@ -0,0 +1,397 @@
+/* Test mp*_class functions.
+
+Copyright 2002, 2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+/* Note that we don't use <climits> for LONG_MIN, but instead our own
+ definitions in gmp-impl.h. In g++ 2.95.4 (debian 3.0) under
+ -mcpu=ultrasparc, limits.h sees __sparc_v9__ defined and assumes that
+ means long is 64-bit long, but it's only 32-bits, causing fatal compile
+ errors. */
+
+#include "config.h"
+
+#include <string>
+
+#include "gmpxx.h"
+#include "gmp-impl.h"
+#include "tests.h"
+
+using namespace std;
+
+
+void
+check_mpz (void)
+{
+ // mpz_class::fits_sint_p
+ {
+ bool fits;
+ mpz_class z;
+ z = INT_MIN; fits = z.fits_sint_p(); ASSERT_ALWAYS (fits);
+ z--; fits = z.fits_sint_p(); ASSERT_ALWAYS (! fits);
+ z = INT_MAX; fits = z.fits_sint_p(); ASSERT_ALWAYS (fits);
+ z++; fits = z.fits_sint_p(); ASSERT_ALWAYS (! fits);
+ }
+
+ // mpz_class::fits_uint_p
+ {
+ bool fits;
+ mpz_class z;
+ z = 0; fits = z.fits_uint_p(); ASSERT_ALWAYS (fits);
+ z--; fits = z.fits_uint_p(); ASSERT_ALWAYS (! fits);
+ z = UINT_MAX; fits = z.fits_uint_p(); ASSERT_ALWAYS (fits);
+ z++; fits = z.fits_uint_p(); ASSERT_ALWAYS (! fits);
+ }
+
+ // mpz_class::fits_slong_p
+ {
+ bool fits;
+ mpz_class z;
+ z = LONG_MIN; fits = z.fits_slong_p(); ASSERT_ALWAYS (fits);
+ z--; fits = z.fits_slong_p(); ASSERT_ALWAYS (! fits);
+ z = LONG_MAX; fits = z.fits_slong_p(); ASSERT_ALWAYS (fits);
+ z++; fits = z.fits_slong_p(); ASSERT_ALWAYS (! fits);
+ }
+
+ // mpz_class::fits_ulong_p
+ {
+ bool fits;
+ mpz_class z;
+ z = 0; fits = z.fits_ulong_p(); ASSERT_ALWAYS (fits);
+ z--; fits = z.fits_ulong_p(); ASSERT_ALWAYS (! fits);
+ z = ULONG_MAX; fits = z.fits_ulong_p(); ASSERT_ALWAYS (fits);
+ z++; fits = z.fits_ulong_p(); ASSERT_ALWAYS (! fits);
+ }
+
+ // mpz_class::fits_sshort_p
+ {
+ bool fits;
+ mpz_class z;
+ z = SHRT_MIN; fits = z.fits_sshort_p(); ASSERT_ALWAYS (fits);
+ z--; fits = z.fits_sshort_p(); ASSERT_ALWAYS (! fits);
+ z = SHRT_MAX; fits = z.fits_sshort_p(); ASSERT_ALWAYS (fits);
+ z++; fits = z.fits_sshort_p(); ASSERT_ALWAYS (! fits);
+ }
+
+ // mpz_class::fits_ushort_p
+ {
+ bool fits;
+ mpz_class z;
+ z = 0; fits = z.fits_ushort_p(); ASSERT_ALWAYS (fits);
+ z--; fits = z.fits_ushort_p(); ASSERT_ALWAYS (! fits);
+ z = USHRT_MAX; fits = z.fits_ushort_p(); ASSERT_ALWAYS (fits);
+ z++; fits = z.fits_ushort_p(); ASSERT_ALWAYS (! fits);
+ }
+
+ // mpz_class::get_mpz_t
+ {
+ mpz_class z(0);
+ mpz_ptr p = z.get_mpz_t();
+ ASSERT_ALWAYS (mpz_cmp_ui (p, 0) == 0);
+ }
+ {
+ mpz_class z(0);
+ mpz_srcptr p = z.get_mpz_t();
+ ASSERT_ALWAYS (mpz_cmp_ui (p, 0) == 0);
+ }
+
+ // mpz_class::get_d
+ // mpz_class::get_si
+ // mpz_class::get_ui
+ {
+ mpz_class z(123);
+ { double d = z.get_d(); ASSERT_ALWAYS (d == 123.0); }
+ { long l = z.get_si(); ASSERT_ALWAYS (l == 123L); }
+ { long u = z.get_ui(); ASSERT_ALWAYS (u == 123L); }
+ }
+ {
+ mpz_class z(-123);
+ { double d = z.get_d(); ASSERT_ALWAYS (d == -123.0); }
+ { long l = z.get_si(); ASSERT_ALWAYS (l == -123L); }
+ }
+
+ // mpz_class::get_str
+ {
+ mpz_class z(123);
+ string s;
+ s = z.get_str(); ASSERT_ALWAYS (s == "123");
+ s = z.get_str(16); ASSERT_ALWAYS (s == "7b");
+ s = z.get_str(-16); ASSERT_ALWAYS (s == "7B");
+ }
+
+ // mpz_class::set_str
+ {
+ mpz_class z;
+ int ret;
+ ret = z.set_str ("123", 10); ASSERT_ALWAYS (ret == 0 && z == 123);
+ ret = z.set_str ("7b", 16); ASSERT_ALWAYS (ret == 0 && z == 123);
+ ret = z.set_str ("7B", 16); ASSERT_ALWAYS (ret == 0 && z == 123);
+ ret = z.set_str ("0x7B", 0); ASSERT_ALWAYS (ret == 0 && z == 123);
+
+ ret = z.set_str (string("123"), 10); ASSERT_ALWAYS (ret == 0 && z == 123);
+ ret = z.set_str (string("7b"), 16); ASSERT_ALWAYS (ret == 0 && z == 123);
+ ret = z.set_str (string("7B"), 16); ASSERT_ALWAYS (ret == 0 && z == 123);
+ ret = z.set_str (string("0x7B"), 0); ASSERT_ALWAYS (ret == 0 && z == 123);
+ }
+}
+
+void
+check_mpq (void)
+{
+ // mpq_class::canonicalize
+ {
+ mpq_class q(12,9);
+ q.canonicalize();
+ ASSERT_ALWAYS (q.get_num() == 4);
+ ASSERT_ALWAYS (q.get_den() == 3);
+ }
+
+ // mpq_class::get_d
+ {
+ mpq_class q(123);
+ { double d = q.get_d(); ASSERT_ALWAYS (d == 123.0); }
+ }
+ {
+ mpq_class q(-123);
+ { double d = q.get_d(); ASSERT_ALWAYS (d == -123.0); }
+ }
+
+ // mpq_class::get_mpq_t
+ {
+ mpq_class q(0);
+ mpq_ptr p = q.get_mpq_t();
+ ASSERT_ALWAYS (mpq_cmp_ui (p, 0, 1) == 0);
+ }
+ {
+ mpq_class q(0);
+ mpq_srcptr p = q.get_mpq_t();
+ ASSERT_ALWAYS (mpq_cmp_ui (p, 0, 1) == 0);
+ }
+
+ // mpq_class::get_num, mpq_class::get_den
+ {
+ const mpq_class q(4,5);
+ mpz_class z;
+ z = q.get_num(); ASSERT_ALWAYS (z == 4);
+ z = q.get_den(); ASSERT_ALWAYS (z == 5);
+ }
+
+ // mpq_class::get_num_mpz_t, mpq_class::get_den_mpz_t
+ {
+ mpq_class q(4,5);
+ mpz_ptr p;
+ p = q.get_num_mpz_t(); ASSERT_ALWAYS (mpz_cmp_ui (p, 4) == 0);
+ p = q.get_den_mpz_t(); ASSERT_ALWAYS (mpz_cmp_ui (p, 5) == 0);
+ }
+ {
+ const mpq_class q(4,5);
+ mpz_srcptr p;
+ p = q.get_num_mpz_t(); ASSERT_ALWAYS (mpz_cmp_ui (p, 4) == 0);
+ p = q.get_den_mpz_t(); ASSERT_ALWAYS (mpz_cmp_ui (p, 5) == 0);
+ }
+
+ // mpq_class::get_str
+ {
+ mpq_class q(17,11);
+ string s;
+ s = q.get_str(); ASSERT_ALWAYS (s == "17/11");
+ s = q.get_str(10); ASSERT_ALWAYS (s == "17/11");
+ s = q.get_str(16); ASSERT_ALWAYS (s == "11/b");
+ s = q.get_str(-16); ASSERT_ALWAYS (s == "11/B");
+ }
+
+ // mpq_class::set_str
+ {
+ mpq_class q;
+ int ret;
+ ret = q.set_str ("123", 10); ASSERT_ALWAYS (ret == 0 && q == 123);
+ ret = q.set_str ("4/5", 10); ASSERT_ALWAYS (ret == 0 && q == mpq_class(4,5));
+ ret = q.set_str ("7b", 16); ASSERT_ALWAYS (ret == 0 && q == 123);
+ ret = q.set_str ("7B", 16); ASSERT_ALWAYS (ret == 0 && q == 123);
+ ret = q.set_str ("0x7B", 0); ASSERT_ALWAYS (ret == 0 && q == 123);
+ ret = q.set_str ("0x10/17", 0); ASSERT_ALWAYS (ret == 0 && q == mpq_class(16,17));
+
+ ret = q.set_str (string("4/5"), 10); ASSERT_ALWAYS (ret == 0 && q == mpq_class(4,5));
+ ret = q.set_str (string("123"), 10); ASSERT_ALWAYS (ret == 0 && q == 123);
+ ret = q.set_str (string("7b"), 16); ASSERT_ALWAYS (ret == 0 && q == 123);
+ ret = q.set_str (string("7B"), 16); ASSERT_ALWAYS (ret == 0 && q == 123);
+ ret = q.set_str (string("0x7B"), 0); ASSERT_ALWAYS (ret == 0 && q == 123);
+ ret = q.set_str (string("0x10/17"), 0); ASSERT_ALWAYS (ret == 0 && q == mpq_class(16,17));
+ }
+}
+
+void
+check_mpf (void)
+{
+ // mpf_class::fits_sint_p
+ {
+ bool fits;
+ mpf_class f (0, 2*8*sizeof(int));
+ f = INT_MIN; fits = f.fits_sint_p(); ASSERT_ALWAYS (fits);
+ f--; fits = f.fits_sint_p(); ASSERT_ALWAYS (! fits);
+ f = INT_MAX; fits = f.fits_sint_p(); ASSERT_ALWAYS (fits);
+ f++; fits = f.fits_sint_p(); ASSERT_ALWAYS (! fits);
+ }
+
+ // mpf_class::fits_uint_p
+ {
+ bool fits;
+ mpf_class f (0, 2*8*sizeof(int));
+ f = 0; fits = f.fits_uint_p(); ASSERT_ALWAYS (fits);
+ f--; fits = f.fits_uint_p(); ASSERT_ALWAYS (! fits);
+ f = UINT_MAX; fits = f.fits_uint_p(); ASSERT_ALWAYS (fits);
+ f++; fits = f.fits_uint_p(); ASSERT_ALWAYS (! fits);
+ }
+
+ // mpf_class::fits_slong_p
+ {
+ bool fits;
+ mpf_class f (0, 2*8*sizeof(long));
+ f = LONG_MIN; fits = f.fits_slong_p(); ASSERT_ALWAYS (fits);
+ f--; fits = f.fits_slong_p(); ASSERT_ALWAYS (! fits);
+ f = LONG_MAX; fits = f.fits_slong_p(); ASSERT_ALWAYS (fits);
+ f++; fits = f.fits_slong_p(); ASSERT_ALWAYS (! fits);
+ }
+
+ // mpf_class::fits_ulong_p
+ {
+ bool fits;
+ mpf_class f (0, 2*8*sizeof(long));
+ f = 0; fits = f.fits_ulong_p(); ASSERT_ALWAYS (fits);
+ f--; fits = f.fits_ulong_p(); ASSERT_ALWAYS (! fits);
+ f = ULONG_MAX; fits = f.fits_ulong_p(); ASSERT_ALWAYS (fits);
+ f++; fits = f.fits_ulong_p(); ASSERT_ALWAYS (! fits);
+ }
+
+ // mpf_class::fits_sshort_p
+ {
+ bool fits;
+ mpf_class f (0, 2*8*sizeof(short));
+ f = SHRT_MIN; fits = f.fits_sshort_p(); ASSERT_ALWAYS (fits);
+ f--; fits = f.fits_sshort_p(); ASSERT_ALWAYS (! fits);
+ f = SHRT_MAX; fits = f.fits_sshort_p(); ASSERT_ALWAYS (fits);
+ f++; fits = f.fits_sshort_p(); ASSERT_ALWAYS (! fits);
+ }
+
+ // mpf_class::fits_ushort_p
+ {
+ bool fits;
+ mpf_class f (0, 2*8*sizeof(short));
+ f = 0; fits = f.fits_ushort_p(); ASSERT_ALWAYS (fits);
+ f--; fits = f.fits_ushort_p(); ASSERT_ALWAYS (! fits);
+ f = USHRT_MAX; fits = f.fits_ushort_p(); ASSERT_ALWAYS (fits);
+ f++; fits = f.fits_ushort_p(); ASSERT_ALWAYS (! fits);
+ }
+
+ // mpf_class::get_d
+ // mpf_class::get_si
+ // mpf_class::get_ui
+ {
+ mpf_class f(123);
+ { double d = f.get_d(); ASSERT_ALWAYS (d == 123.0); }
+ { long l = f.get_si(); ASSERT_ALWAYS (l == 123L); }
+ { long u = f.get_ui(); ASSERT_ALWAYS (u == 123L); }
+ }
+ {
+ mpf_class f(-123);
+ { double d = f.get_d(); ASSERT_ALWAYS (d == -123.0); }
+ { long l = f.get_si(); ASSERT_ALWAYS (l == -123L); }
+ }
+
+ // mpf_class::get_prec
+ {
+ mpf_class f;
+ ASSERT_ALWAYS (f.get_prec() == mpf_get_default_prec());
+ }
+
+ // mpf_class::get_str
+ {
+ mpf_class f(123);
+ string s;
+ mp_exp_t e;
+ s = f.get_str(e); ASSERT_ALWAYS (s == "123" && e == 3);
+ s = f.get_str(e, 16); ASSERT_ALWAYS (s == "7b" && e == 2);
+ s = f.get_str(e, -16); ASSERT_ALWAYS (s == "7B" && e == 2);
+ s = f.get_str(e, 10, 2); ASSERT_ALWAYS (s == "12" && e == 3);
+ s = f.get_str(e, 10, 1); ASSERT_ALWAYS (s == "1" && e == 3);
+ }
+
+ // mpf_class::set_str
+ {
+ mpf_class f;
+ int ret;
+ ret = f.set_str ("123", 10); ASSERT_ALWAYS (ret == 0 && f == 123);
+ ret = f.set_str ("123e1", 10); ASSERT_ALWAYS (ret == 0 && f == 1230);
+ ret = f.set_str ("1230e-1", 10); ASSERT_ALWAYS (ret == 0 && f == 123);
+ ret = f.set_str ("7b", 16); ASSERT_ALWAYS (ret == 0 && f == 123);
+ ret = f.set_str ("7B", 16); ASSERT_ALWAYS (ret == 0 && f == 123);
+ ret = f.set_str ("7B@1", 16); ASSERT_ALWAYS (ret == 0 && f == 1968);
+ ret = f.set_str ("7B0@-1", 16); ASSERT_ALWAYS (ret == 0 && f == 123);
+
+ ret = f.set_str (string("123"), 10); ASSERT_ALWAYS (ret == 0 && f == 123);
+ ret = f.set_str (string("123e1"), 10); ASSERT_ALWAYS (ret == 0 && f == 1230);
+ ret = f.set_str (string("1230e-1"), 10); ASSERT_ALWAYS (ret == 0 && f == 123);
+ ret = f.set_str (string("7b"), 16); ASSERT_ALWAYS (ret == 0 && f == 123);
+ ret = f.set_str (string("7B"), 16); ASSERT_ALWAYS (ret == 0 && f == 123);
+ ret = f.set_str (string("7B@1"), 16); ASSERT_ALWAYS (ret == 0 && f == 1968);
+ ret = f.set_str (string("7B0@-1"), 16); ASSERT_ALWAYS (ret == 0 && f == 123);
+ }
+
+ // mpf_class::set_prec
+ {
+ mpf_class f;
+ f.set_prec (256);
+ ASSERT_ALWAYS (f.get_prec () >= 256);
+ }
+
+ // mpf_class::set_prec_raw
+ {
+ mpf_class f (0, 100 * GMP_NUMB_BITS);
+ f.set_prec_raw (5 * GMP_NUMB_BITS);
+ ASSERT_ALWAYS (f.get_prec () >= 5 * GMP_NUMB_BITS);
+ ASSERT_ALWAYS (f.get_prec () < 100 * GMP_NUMB_BITS);
+ f.set_prec_raw (100 * GMP_NUMB_BITS);
+ }
+}
+
+// std::numeric_limits
+void
+check_limits (void)
+{
+ // Check that the content is not private.
+ ASSERT_ALWAYS ( std::numeric_limits<mpz_class>::is_integer);
+ ASSERT_ALWAYS (!std::numeric_limits<mpf_class>::is_integer);
+
+ // Check that symbols are emitted.
+ ASSERT_ALWAYS (&std::numeric_limits<mpz_class>::is_integer
+ != &std::numeric_limits<mpq_class>::is_integer);
+}
+
+int
+main (void)
+{
+ tests_start();
+
+ check_mpz();
+ check_mpq();
+ check_mpf();
+ check_limits();
+
+ tests_end();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-mix.cc b/vendor/gmp-6.3.0/tests/cxx/t-mix.cc
new file mode 100644
index 0000000..cb6733b
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-mix.cc
@@ -0,0 +1,82 @@
+/* Test legality of conversion between the different mp*_class
+
+Copyright 2011 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include "gmpxx.h"
+#include "gmp-impl.h"
+#include "tests.h"
+
+int f_z (mpz_class){return 0;}
+int f_q (mpq_class){return 1;}
+int f_f (mpf_class){return 2;}
+int f_zq (mpz_class){return 0;}
+int f_zq (mpq_class){return 1;}
+int f_zf (mpz_class){return 0;}
+int f_zf (mpf_class){return 2;}
+int f_qf (mpq_class){return 1;}
+int f_qf (mpf_class){return 2;}
+int f_zqf(mpz_class){return 0;}
+int f_zqf(mpq_class){return 1;}
+int f_zqf(mpf_class){return 2;}
+
+void
+check (void)
+{
+ mpz_class z=42;
+ mpq_class q=33;
+ mpf_class f=18;
+
+ ASSERT_ALWAYS(f_z (z)==0); ASSERT_ALWAYS(f_z (-z)==0);
+ ASSERT_ALWAYS(f_q (z)==1); ASSERT_ALWAYS(f_q (-z)==1);
+ ASSERT_ALWAYS(f_q (q)==1); ASSERT_ALWAYS(f_q (-q)==1);
+ ASSERT_ALWAYS(f_f (z)==2); ASSERT_ALWAYS(f_f (-z)==2);
+ ASSERT_ALWAYS(f_f (q)==2); ASSERT_ALWAYS(f_f (-q)==2);
+ ASSERT_ALWAYS(f_f (f)==2); ASSERT_ALWAYS(f_f (-f)==2);
+ ASSERT_ALWAYS(f_zq (z)==0);
+ ASSERT_ALWAYS(f_zq (q)==1); ASSERT_ALWAYS(f_zq (-q)==1);
+ ASSERT_ALWAYS(f_zf (z)==0);
+ ASSERT_ALWAYS(f_zf (f)==2); ASSERT_ALWAYS(f_zf (-f)==2);
+ ASSERT_ALWAYS(f_qf (q)==1);
+ ASSERT_ALWAYS(f_qf (f)==2); ASSERT_ALWAYS(f_qf (-f)==2);
+ ASSERT_ALWAYS(f_zqf(z)==0);
+ ASSERT_ALWAYS(f_zqf(q)==1);
+ ASSERT_ALWAYS(f_zqf(f)==2); ASSERT_ALWAYS(f_zqf(-f)==2);
+
+ ASSERT_ALWAYS(f_zqf(mpz_class(z))==0); ASSERT_ALWAYS(f_zqf(mpz_class(-z))==0);
+ ASSERT_ALWAYS(f_zqf(mpz_class(q))==0); ASSERT_ALWAYS(f_zqf(mpz_class(-q))==0);
+ ASSERT_ALWAYS(f_zqf(mpz_class(f))==0); ASSERT_ALWAYS(f_zqf(mpz_class(-f))==0);
+ ASSERT_ALWAYS(f_zqf(mpq_class(z))==1); ASSERT_ALWAYS(f_zqf(mpq_class(-z))==1);
+ ASSERT_ALWAYS(f_zqf(mpq_class(q))==1); ASSERT_ALWAYS(f_zqf(mpq_class(-q))==1);
+ ASSERT_ALWAYS(f_zqf(mpq_class(f))==1); ASSERT_ALWAYS(f_zqf(mpq_class(-f))==1);
+ ASSERT_ALWAYS(f_zqf(mpf_class(z))==2); ASSERT_ALWAYS(f_zqf(mpf_class(-z))==2);
+ ASSERT_ALWAYS(f_zqf(mpf_class(q))==2); ASSERT_ALWAYS(f_zqf(mpf_class(-q))==2);
+ ASSERT_ALWAYS(f_zqf(mpf_class(f))==2); ASSERT_ALWAYS(f_zqf(mpf_class(-f))==2);
+}
+
+int
+main (void)
+{
+ tests_start();
+
+ check();
+
+ tests_end();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-ops.cc b/vendor/gmp-6.3.0/tests/cxx/t-ops.cc
new file mode 100644
index 0000000..ecc6bd0
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-ops.cc
@@ -0,0 +1,753 @@
+/* Test mp*_class operators and functions.
+
+Copyright 2001-2003, 2015 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <iostream>
+
+#include "gmpxx.h"
+#include "gmp-impl.h"
+#include "tests.h"
+
+using namespace std;
+
+
+void
+check_mpz (void)
+{
+ // unary operators and functions
+
+ // operator+
+ {
+ mpz_class a(1);
+ mpz_class b;
+ b = +a; ASSERT_ALWAYS(b == 1);
+ }
+
+ // operator-
+ {
+ mpz_class a(2);
+ mpz_class b;
+ b = -a; ASSERT_ALWAYS(b == -2);
+ }
+
+ // operator~
+ {
+ mpz_class a(3);
+ mpz_class b;
+ b = ~a; ASSERT_ALWAYS(b == -4);
+ }
+
+ // abs
+ {
+ mpz_class a(-123);
+ mpz_class b;
+ b = abs(a); ASSERT_ALWAYS(b == 123);
+ a <<= 300;
+ b = abs(a); ASSERT_ALWAYS(a + b == 0);
+ }
+
+ // sqrt
+ {
+ mpz_class a(25);
+ mpz_class b;
+ b = sqrt(a); ASSERT_ALWAYS(b == 5);
+ }
+ {
+ mpz_class a(125);
+ mpz_class b;
+ b = sqrt(a); ASSERT_ALWAYS(b == 11); // round toward zero
+ }
+
+ // sgn
+ {
+ mpz_class a(123);
+ int b = sgn(a); ASSERT_ALWAYS(b == 1);
+ }
+ {
+ mpz_class a(0);
+ int b = sgn(a); ASSERT_ALWAYS(b == 0);
+ }
+ {
+ mpz_class a(-123);
+ int b = sgn(a); ASSERT_ALWAYS(b == -1);
+ }
+
+
+ // binary operators and functions
+
+ // operator+
+ {
+ mpz_class a(1), b(2);
+ mpz_class c;
+ c = a + b; ASSERT_ALWAYS(c == 3);
+ }
+ {
+ mpz_class a(3);
+ signed int b = 4;
+ mpz_class c;
+ c = a + b; ASSERT_ALWAYS(c == 7);
+ }
+ {
+ mpz_class a(5);
+ double b = 6.0;
+ mpz_class c;
+ c = b + a; ASSERT_ALWAYS(c == 11);
+ }
+
+ // operator-
+ {
+ mpz_class a(3), b(6);
+ mpz_class c;
+ c = a - b; ASSERT_ALWAYS(c == -3);
+ }
+
+ // operator*
+ {
+ mpz_class a(-2), b(4);
+ mpz_class c;
+ c = a * b; ASSERT_ALWAYS(c == -8);
+ }
+ {
+ mpz_class a(2);
+ long b = -4;
+ mpz_class c;
+ c = a * b; ASSERT_ALWAYS(c == -8);
+ c = b * a; ASSERT_ALWAYS(c == -8);
+ }
+ {
+ mpz_class a(-2);
+ unsigned long b = 4;
+ mpz_class c;
+ c = a * b; ASSERT_ALWAYS(c == -8);
+ c = b * a; ASSERT_ALWAYS(c == -8);
+ }
+
+ // operator/ and operator%
+ {
+ mpz_class a(12), b(4);
+ mpz_class c;
+ c = a / b; ASSERT_ALWAYS(c == 3);
+ c = a % b; ASSERT_ALWAYS(c == 0);
+ }
+ {
+ mpz_class a(7), b(5);
+ mpz_class c;
+ c = a / b; ASSERT_ALWAYS(c == 1);
+ c = a % b; ASSERT_ALWAYS(c == 2);
+ }
+ {
+ mpz_class a(-10);
+ signed int ai = -10;
+ mpz_class b(3);
+ signed int bi = 3;
+ mpz_class c;
+ c = a / b; ASSERT_ALWAYS(c == -3);
+ c = a % b; ASSERT_ALWAYS(c == -1);
+ c = a / bi; ASSERT_ALWAYS(c == -3);
+ c = a % bi; ASSERT_ALWAYS(c == -1);
+ c = ai / b; ASSERT_ALWAYS(c == -3);
+ c = ai % b; ASSERT_ALWAYS(c == -1);
+ }
+ {
+ mpz_class a(-10);
+ signed int ai = -10;
+ mpz_class b(-3);
+ signed int bi = -3;
+ mpz_class c;
+ c = a / b; ASSERT_ALWAYS(c == 3);
+ c = a % b; ASSERT_ALWAYS(c == -1);
+ c = a / bi; ASSERT_ALWAYS(c == 3);
+ c = a % bi; ASSERT_ALWAYS(c == -1);
+ c = ai / b; ASSERT_ALWAYS(c == 3);
+ c = ai % b; ASSERT_ALWAYS(c == -1);
+ }
+ {
+ mpz_class a (LONG_MIN);
+ signed long ai = LONG_MIN;
+ mpz_class b = - mpz_class (LONG_MIN);
+ mpz_class c;
+ c = a / b; ASSERT_ALWAYS(c == -1);
+ c = a % b; ASSERT_ALWAYS(c == 0);
+ c = ai / b; ASSERT_ALWAYS(c == -1);
+ c = ai % b; ASSERT_ALWAYS(c == 0);
+ }
+
+ // operator&
+ // operator|
+ // operator^
+
+ // operator<<
+ {
+ mpz_class a(3);
+ unsigned int b = 4;
+ mpz_class c;
+ c = a << b; ASSERT_ALWAYS(c == 48);
+ }
+
+ // operator>>
+ {
+ mpz_class a(127);
+ unsigned int b = 4;
+ mpz_class c;
+ c = a >> b; ASSERT_ALWAYS(c == 7);
+ }
+
+ // operator==
+ // operator!=
+ // operator<
+ // operator<=
+ // operator>
+ // operator>=
+
+ // cmp
+ {
+ mpz_class a(123), b(45);
+ int c;
+ c = cmp(a, b); ASSERT_ALWAYS(c > 0);
+ c = cmp(b, a); ASSERT_ALWAYS(c < 0);
+ }
+ {
+ mpz_class a(123);
+ unsigned long b = 45;
+ int c;
+ c = cmp(a, b); ASSERT_ALWAYS(c > 0);
+ c = cmp(b, a); ASSERT_ALWAYS(c < 0);
+ }
+ {
+ mpz_class a(123);
+ long b = 45;
+ int c;
+ c = cmp(a, b); ASSERT_ALWAYS(c > 0);
+ c = cmp(b, a); ASSERT_ALWAYS(c < 0);
+ }
+ {
+ mpz_class a(123);
+ double b = 45;
+ int c;
+ c = cmp(a, b); ASSERT_ALWAYS(c > 0);
+ c = cmp(b, a); ASSERT_ALWAYS(c < 0);
+ }
+
+
+ // ternary operators
+
+ // mpz_addmul
+ {
+ mpz_class a(1), b(2), c(3);
+ mpz_class d;
+ d = a + b * c; ASSERT_ALWAYS(d == 7);
+ }
+ {
+ mpz_class a(1), b(2);
+ unsigned int c = 3;
+ mpz_class d;
+ d = a + b * c; ASSERT_ALWAYS(d == 7);
+ }
+ {
+ mpz_class a(1), b(3);
+ unsigned int c = 2;
+ mpz_class d;
+ d = a + c * b; ASSERT_ALWAYS(d == 7);
+ }
+ {
+ mpz_class a(1), b(2);
+ signed int c = 3;
+ mpz_class d;
+ d = a + b * c; ASSERT_ALWAYS(d == 7);
+ }
+ {
+ mpz_class a(1), b(3);
+ signed int c = 2;
+ mpz_class d;
+ d = a + c * b; ASSERT_ALWAYS(d == 7);
+ }
+ {
+ mpz_class a(1), b(2);
+ double c = 3.0;
+ mpz_class d;
+ d = a + b * c; ASSERT_ALWAYS(d == 7);
+ }
+ {
+ mpz_class a(1), b(3);
+ double c = 2.0;
+ mpz_class d;
+ d = a + c * b; ASSERT_ALWAYS(d == 7);
+ }
+
+ {
+ mpz_class a(2), b(3), c(4);
+ mpz_class d;
+ d = a * b + c; ASSERT_ALWAYS(d == 10);
+ }
+ {
+ mpz_class a(2), b(4);
+ unsigned int c = 3;
+ mpz_class d;
+ d = a * c + b; ASSERT_ALWAYS(d == 10);
+ }
+ {
+ mpz_class a(3), b(4);
+ unsigned int c = 2;
+ mpz_class d;
+ d = c * a + b; ASSERT_ALWAYS(d == 10);
+ }
+ {
+ mpz_class a(2), b(4);
+ signed int c = 3;
+ mpz_class d;
+ d = a * c + b; ASSERT_ALWAYS(d == 10);
+ }
+ {
+ mpz_class a(3), b(4);
+ signed int c = 2;
+ mpz_class d;
+ d = c * a + b; ASSERT_ALWAYS(d == 10);
+ }
+ {
+ mpz_class a(2), b(4);
+ double c = 3.0;
+ mpz_class d;
+ d = a * c + b; ASSERT_ALWAYS(d == 10);
+ }
+ {
+ mpz_class a(3), b(4);
+ double c = 2.0;
+ mpz_class d;
+ d = c * a + b; ASSERT_ALWAYS(d == 10);
+ }
+
+ // mpz_submul
+ {
+ mpz_class a(1), b(2), c(3);
+ mpz_class d;
+ d = a - b * c; ASSERT_ALWAYS(d == -5);
+ }
+ {
+ mpz_class a(1), b(2);
+ unsigned int c = 3;
+ mpz_class d;
+ d = a - b * c; ASSERT_ALWAYS(d == -5);
+ }
+ {
+ mpz_class a(1), b(3);
+ unsigned int c = 2;
+ mpz_class d;
+ d = a - c * b; ASSERT_ALWAYS(d == -5);
+ }
+ {
+ mpz_class a(1), b(2);
+ signed int c = 3;
+ mpz_class d;
+ d = a - b * c; ASSERT_ALWAYS(d == -5);
+ }
+ {
+ mpz_class a(1), b(3);
+ signed int c = 2;
+ mpz_class d;
+ d = a - c * b; ASSERT_ALWAYS(d == -5);
+ }
+ {
+ mpz_class a(1), b(2);
+ double c = 3.0;
+ mpz_class d;
+ d = a - b * c; ASSERT_ALWAYS(d == -5);
+ }
+ {
+ mpz_class a(1), b(3);
+ double c = 2.0;
+ mpz_class d;
+ d = a - c * b; ASSERT_ALWAYS(d == -5);
+ }
+
+ {
+ mpz_class a(2), b(3), c(4);
+ mpz_class d;
+ d = a * b - c; ASSERT_ALWAYS(d == 2);
+ }
+ {
+ mpz_class a(2), b(4);
+ unsigned int c = 3;
+ mpz_class d;
+ d = a * c - b; ASSERT_ALWAYS(d == 2);
+ }
+ {
+ mpz_class a(3), b(4);
+ unsigned int c = 2;
+ mpz_class d;
+ d = c * a - b; ASSERT_ALWAYS(d == 2);
+ }
+ {
+ mpz_class a(2), b(4);
+ signed int c = 3;
+ mpz_class d;
+ d = a * c - b; ASSERT_ALWAYS(d == 2);
+ }
+ {
+ mpz_class a(3), b(4);
+ signed int c = 2;
+ mpz_class d;
+ d = c * a - b; ASSERT_ALWAYS(d == 2);
+ }
+ {
+ mpz_class a(2), b(4);
+ double c = 3.0;
+ mpz_class d;
+ d = a * c - b; ASSERT_ALWAYS(d == 2);
+ }
+ {
+ mpz_class a(3), b(4);
+ double c = 2.0;
+ mpz_class d;
+ d = c * a - b; ASSERT_ALWAYS(d == 2);
+ }
+}
+
+void
+check_mpq (void)
+{
+ // unary operators and functions
+
+ // operator+
+ {
+ mpq_class a(1, 2);
+ mpq_class b;
+ b = +a; ASSERT_ALWAYS(b == 0.5);
+ }
+
+ // operator-
+ {
+ mpq_class a(3, 4);
+ mpq_class b;
+ b = -a; ASSERT_ALWAYS(b == -0.75);
+ }
+
+ // abs
+ {
+ mpq_class a(-123);
+ mpq_class b;
+ b = abs(a); ASSERT_ALWAYS(b == 123);
+ }
+
+ // sgn
+ {
+ mpq_class a(123);
+ int b = sgn(a); ASSERT_ALWAYS(b == 1);
+ }
+ {
+ mpq_class a(0);
+ int b = sgn(a); ASSERT_ALWAYS(b == 0);
+ }
+ {
+ mpq_class a(-123);
+ int b = sgn(a); ASSERT_ALWAYS(b == -1);
+ }
+
+
+ // binary operators and functions
+
+ // operator+
+ {
+ mpq_class a(1, 2), b(3, 4);
+ mpq_class c;
+ c = a + b; ASSERT_ALWAYS(c == 1.25);
+ }
+ {
+ mpq_class a(1, 2);
+ signed int b = 2;
+ mpq_class c;
+ c = a + b; ASSERT_ALWAYS(c == 2.5);
+ }
+ {
+ mpq_class a(1, 2);
+ double b = 1.5;
+ mpq_class c;
+ c = b + a; ASSERT_ALWAYS(c == 2);
+ }
+
+ // operator-
+ {
+ mpq_class a(1, 2), b(3, 4);
+ mpq_class c;
+ c = a - b; ASSERT_ALWAYS(c == -0.25);
+ }
+
+ // operator*
+ {
+ mpq_class a(1, 3), b(3, 4);
+ mpq_class c;
+ c = a * b; ASSERT_ALWAYS(c == 0.25);
+ c = b * b; ASSERT_ALWAYS(c == 0.5625);
+ }
+
+ // operator/
+ {
+ mpq_class a(1, 2), b(2, 3);
+ mpq_class c;
+ c = a / b; ASSERT_ALWAYS(c == 0.75);
+ }
+ {
+ mpq_class one = 1;
+ mpq_class x(2, 5);
+ ASSERT_ALWAYS(1 / x == one / x);
+ ASSERT_ALWAYS(1u / x == one / x);
+ x = (-1) / x;
+ ASSERT_ALWAYS(x == -2.5);
+ ASSERT_ALWAYS(0 / x == 0);
+ ASSERT_ALWAYS(0u / x == 0);
+ }
+
+ // operator<<
+ // operator>>
+ // operator==
+ // operator!=
+ // operator<
+ // operator<=
+ // operator>
+ // operator>=
+
+ // cmp
+ {
+ mpq_class a(123), b(45);
+ int c;
+ c = cmp(a, b); ASSERT_ALWAYS(c > 0);
+ c = cmp(b, a); ASSERT_ALWAYS(c < 0);
+ }
+ {
+ mpq_class a(123);
+ unsigned long b = 45;
+ int c;
+ c = cmp(a, b); ASSERT_ALWAYS(c > 0);
+ c = cmp(b, a); ASSERT_ALWAYS(c < 0);
+ }
+ {
+ mpq_class a(123);
+ long b = 45;
+ int c;
+ c = cmp(a, b); ASSERT_ALWAYS(c > 0);
+ c = cmp(b, a); ASSERT_ALWAYS(c < 0);
+ }
+ {
+ mpq_class a(123);
+ double b = 45;
+ int c;
+ c = cmp(a, b); ASSERT_ALWAYS(c > 0);
+ c = cmp(b, a); ASSERT_ALWAYS(c < 0);
+ }
+ {
+ mpq_class a(123);
+ mpz_class b(45);
+ int c;
+ c = cmp(a, b); ASSERT_ALWAYS(c > 0);
+ c = cmp(b, a); ASSERT_ALWAYS(c < 0);
+ }
+}
+
+void
+check_mpf (void)
+{
+ // unary operators and functions
+
+ // operator+
+ {
+ mpf_class a(1);
+ mpf_class b;
+ b = +a; ASSERT_ALWAYS(b == 1);
+ }
+
+ // operator-
+ {
+ mpf_class a(2);
+ mpf_class b;
+ b = -a; ASSERT_ALWAYS(b == -2);
+ }
+
+ // abs
+ {
+ mpf_class a(-123);
+ mpf_class b;
+ b = abs(a); ASSERT_ALWAYS(b == 123);
+ }
+
+ // trunc
+ {
+ mpf_class a(1.5);
+ mpf_class b;
+ b = trunc(a); ASSERT_ALWAYS(b == 1);
+ }
+ {
+ mpf_class a(-1.5);
+ mpf_class b;
+ b = trunc(a); ASSERT_ALWAYS(b == -1);
+ }
+
+ // floor
+ {
+ mpf_class a(1.9);
+ mpf_class b;
+ b = floor(a); ASSERT_ALWAYS(b == 1);
+ }
+ {
+ mpf_class a(-1.1);
+ mpf_class b;
+ b = floor(a); ASSERT_ALWAYS(b == -2);
+ }
+
+ // ceil
+ {
+ mpf_class a(1.1);
+ mpf_class b;
+ b = ceil(a); ASSERT_ALWAYS(b == 2);
+ }
+ {
+ mpf_class a(-1.9);
+ mpf_class b;
+ b = ceil(a); ASSERT_ALWAYS(b == -1);
+ }
+
+ // sqrt
+ {
+ mpf_class a(25);
+ mpf_class b;
+ b = sqrt(a); ASSERT_ALWAYS(b == 5);
+ }
+ {
+ mpf_class a(2.25);
+ mpf_class b;
+ b = sqrt(a); ASSERT_ALWAYS(b == 1.5);
+ }
+
+ // sgn
+ {
+ mpf_class a(123);
+ int b = sgn(a); ASSERT_ALWAYS(b == 1);
+ }
+ {
+ mpf_class a(0);
+ int b = sgn(a); ASSERT_ALWAYS(b == 0);
+ }
+ {
+ mpf_class a(-123);
+ int b = sgn(a); ASSERT_ALWAYS(b == -1);
+ }
+
+
+ // binary operators and functions
+
+ // operator+
+ {
+ mpf_class a(1), b(2);
+ mpf_class c;
+ c = a + b; ASSERT_ALWAYS(c == 3);
+ }
+
+ // operator-
+ {
+ mpf_class a(3), b(4);
+ mpf_class c;
+ c = a - b; ASSERT_ALWAYS(c == -1);
+ }
+
+ // operator*
+ {
+ mpf_class a(2), b(5);
+ mpf_class c;
+ c = a * b; ASSERT_ALWAYS(c == 10);
+ }
+
+ // operator/
+ {
+ mpf_class a(7), b(4);
+ mpf_class c;
+ c = a / b; ASSERT_ALWAYS(c == 1.75);
+ }
+
+ // operator<<
+ // operator>>
+ // operator==
+ // operator!=
+ // operator<
+ // operator<=
+ // operator>
+ // operator>=
+
+ // hypot
+ {
+ mpf_class a(3), b(4);
+ mpf_class c;
+ c = hypot(a, b); ASSERT_ALWAYS(c == 5);
+ }
+
+ // cmp
+ {
+ mpf_class a(123), b(45);
+ int c;
+ c = cmp(a, b); ASSERT_ALWAYS(c > 0);
+ c = cmp(b, a); ASSERT_ALWAYS(c < 0);
+ }
+ {
+ mpf_class a(123);
+ unsigned long b = 45;
+ int c;
+ c = cmp(a, b); ASSERT_ALWAYS(c > 0);
+ c = cmp(b, a); ASSERT_ALWAYS(c < 0);
+ }
+ {
+ mpf_class a(123);
+ long b = 45;
+ int c;
+ c = cmp(a, b); ASSERT_ALWAYS(c > 0);
+ c = cmp(b, a); ASSERT_ALWAYS(c < 0);
+ }
+ {
+ mpf_class a(123);
+ double b = 45;
+ int c;
+ c = cmp(a, b); ASSERT_ALWAYS(c > 0);
+ c = cmp(b, a); ASSERT_ALWAYS(c < 0);
+ }
+ {
+ mpf_class a(123);
+ mpz_class b(45);
+ int c;
+ c = cmp(a, b); ASSERT_ALWAYS(c > 0);
+ c = cmp(b, a); ASSERT_ALWAYS(c < 0);
+ }
+ {
+ mpf_class a(123);
+ mpq_class b(45);
+ int c;
+ c = cmp(a, b); ASSERT_ALWAYS(c > 0);
+ c = cmp(b, a); ASSERT_ALWAYS(c < 0);
+ }
+}
+
+
+int
+main (void)
+{
+ tests_start();
+
+ check_mpz();
+ check_mpq();
+ check_mpf();
+
+ tests_end();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-ops2.h b/vendor/gmp-6.3.0/tests/cxx/t-ops2.h
new file mode 100644
index 0000000..f8898ee
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-ops2.h
@@ -0,0 +1,82 @@
+/* Test mp*_class operators and functions.
+
+Copyright 2011, 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <math.h>
+
+#include "gmpxx.h"
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+#define CHECK1(Type,a,fun) \
+ ASSERT_ALWAYS(fun((Type)(a))==fun(a))
+#define CHECK(Type1,Type2,a,b,op) \
+ ASSERT_ALWAYS(((Type1)(a) op (Type2)(b))==((a) op (b)))
+#define CHECK_G(Type,a,b,op) \
+ CHECK(Type,Type,a,b,op)
+#define CHECK_UI(Type,a,b,op) \
+ CHECK(Type,unsigned long,a,b,op); \
+ CHECK(unsigned long,Type,a,b,op)
+#define CHECK_SI(Type,a,b,op) \
+ CHECK(Type,long,a,b,op); \
+ CHECK(long,Type,a,b,op)
+#define CHECK_D(Type,a,b,op) \
+ CHECK(Type,double,a,b,op); \
+ CHECK(double,Type,a,b,op)
+#define CHECK_MPZ(Type,a,b,op) \
+ CHECK(Type,mpz_class,a,b,op); \
+ CHECK(mpz_class,Type,a,b,op)
+#define CHECK_MPQ(Type,a,b,op) \
+ CHECK(Type,mpq_class,a,b,op); \
+ CHECK(mpq_class,Type,a,b,op)
+#define CHECK_ALL_SIGNED(Type,a,b,op) \
+ CHECK_G(Type,a,b,op); \
+ CHECK_SI(Type,a,b,op); \
+ CHECK_D(Type,a,b,op)
+#define CHECK_ALL_SIGNS(Type,a,b,op) \
+ CHECK_ALL_SIGNED(Type,a,b,op); \
+ CHECK_ALL_SIGNED(Type,-(a),b,op); \
+ CHECK_ALL_SIGNED(Type,a,-(b),op); \
+ CHECK_ALL_SIGNED(Type,-(a),-(b),op)
+#define CHECK_ALL(Type,a,b,op) \
+ CHECK_ALL_SIGNED(Type,a,b,op); \
+ CHECK_UI(Type,a,b,op)
+#define CHECK_ALL_SIGNED_COMPARISONS(Type,a,b) \
+ CHECK_ALL_SIGNED(Type,a,b,<); \
+ CHECK_ALL_SIGNED(Type,a,b,>); \
+ CHECK_ALL_SIGNED(Type,a,b,<=); \
+ CHECK_ALL_SIGNED(Type,a,b,>=); \
+ CHECK_ALL_SIGNED(Type,a,b,==); \
+ CHECK_ALL_SIGNED(Type,a,b,!=)
+#define CHECK_ALL_SIGNS_COMPARISONS(Type,a,b) \
+ CHECK_ALL_SIGNS(Type,a,b,<); \
+ CHECK_ALL_SIGNS(Type,a,b,>); \
+ CHECK_ALL_SIGNS(Type,a,b,<=); \
+ CHECK_ALL_SIGNS(Type,a,b,>=); \
+ CHECK_ALL_SIGNS(Type,a,b,==); \
+ CHECK_ALL_SIGNS(Type,a,b,!=)
+#define CHECK_ALL_COMPARISONS(Type,a,b) \
+ CHECK_ALL(Type,a,b,<); \
+ CHECK_ALL(Type,a,b,>); \
+ CHECK_ALL(Type,a,b,<=); \
+ CHECK_ALL(Type,a,b,>=); \
+ CHECK_ALL(Type,a,b,==); \
+ CHECK_ALL(Type,a,b,!=)
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-ops2f.cc b/vendor/gmp-6.3.0/tests/cxx/t-ops2f.cc
new file mode 100644
index 0000000..71c9e10
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-ops2f.cc
@@ -0,0 +1,87 @@
+/* Test mp*_class operators and functions.
+
+Copyright 2011, 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "t-ops2.h"
+
+void checkf (){
+ ASSERT_ALWAYS(sqrt(mpf_class(7))>2.64);
+ ASSERT_ALWAYS(sqrt(mpf_class(7))<2.65);
+ ASSERT_ALWAYS(sqrt(mpf_class(0))==0);
+ // TODO: add some consistency checks, as described in
+ // https://gmplib.org/list-archives/gmp-bugs/2013-February/002940.html
+ CHECK1(mpf_class,1.9,trunc);
+ CHECK1(mpf_class,1.9,floor);
+ CHECK1(mpf_class,1.9,ceil);
+ CHECK1(mpf_class,4.3,trunc);
+ CHECK1(mpf_class,4.3,floor);
+ CHECK1(mpf_class,4.3,ceil);
+ CHECK1(mpf_class,-7.1,trunc);
+ CHECK1(mpf_class,-7.1,floor);
+ CHECK1(mpf_class,-7.1,ceil);
+ CHECK1(mpf_class,-2.8,trunc);
+ CHECK1(mpf_class,-2.8,floor);
+ CHECK1(mpf_class,-2.8,ceil);
+ CHECK1(mpf_class,-1.5,trunc);
+ CHECK1(mpf_class,-1.5,floor);
+ CHECK1(mpf_class,-1.5,ceil);
+ CHECK1(mpf_class,2.5,trunc);
+ CHECK1(mpf_class,2.5,floor);
+ CHECK1(mpf_class,2.5,ceil);
+ ASSERT_ALWAYS(hypot(mpf_class(-3),mpf_class(4))>4.9);
+ ASSERT_ALWAYS(hypot(mpf_class(-3),mpf_class(4))<5.1);
+ ASSERT_ALWAYS(hypot(mpf_class(-3),4.)>4.9);
+ ASSERT_ALWAYS(hypot(-3.,mpf_class(4))<5.1);
+ ASSERT_ALWAYS(hypot(mpf_class(-3),4l)>4.9);
+ ASSERT_ALWAYS(hypot(-3l,mpf_class(4))<5.1);
+ ASSERT_ALWAYS(hypot(mpf_class(-3),4ul)>4.9);
+ ASSERT_ALWAYS(hypot(3ul,mpf_class(4))<5.1);
+ CHECK(mpf_class,mpq_class,1.5,2.25,+);
+ CHECK(mpf_class,mpq_class,1.5,2.25,-);
+ CHECK(mpf_class,mpq_class,1.5,-2.25,*);
+ CHECK(mpf_class,mpq_class,1.5,-2,/);
+ CHECK_MPQ(mpf_class,-5.5,-2.25,+);
+ CHECK_MPQ(mpf_class,-5.5,-2.25,-);
+ CHECK_MPQ(mpf_class,-5.5,-2.25,*);
+ CHECK_MPQ(mpf_class,-5.25,-0.5,/);
+ CHECK_MPQ(mpf_class,5,-2,<);
+ CHECK_MPQ(mpf_class,5,-2,>);
+ CHECK_MPQ(mpf_class,5,-2,<=);
+ CHECK_MPQ(mpf_class,5,-2,>=);
+ CHECK_MPQ(mpf_class,5,-2,==);
+ CHECK_MPQ(mpf_class,5,-2,!=);
+ CHECK_MPQ(mpf_class,0,0,<);
+ CHECK_MPQ(mpf_class,0,0,>);
+ CHECK_MPQ(mpf_class,0,0,<=);
+ CHECK_MPQ(mpf_class,0,0,>=);
+ CHECK_MPQ(mpf_class,0,0,==);
+ CHECK_MPQ(mpf_class,0,0,!=);
+}
+
+int
+main (void)
+{
+ tests_start();
+
+ // Enough precision for 1 + denorm_min
+ mpf_set_default_prec(DBL_MANT_DIG-DBL_MIN_EXP+42);
+ checkf();
+
+ tests_end();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-ops2qf.cc b/vendor/gmp-6.3.0/tests/cxx/t-ops2qf.cc
new file mode 100644
index 0000000..bd96f61
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-ops2qf.cc
@@ -0,0 +1,89 @@
+/* Test mp*_class operators and functions.
+
+Copyright 2011, 2012, 2018 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "t-ops2.h"
+
+template<class T>
+void checkqf (){
+ CHECK_ALL(T,5.,0,+);
+ CHECK_ALL(T,5.,0,-);
+ CHECK_ALL(T,5.,2,+); CHECK_MPZ(T,5.,2,+);
+ CHECK_ALL(T,5.,2,-); CHECK_MPZ(T,5.,2,-);
+ CHECK_ALL(T,5.,2,*); CHECK_MPZ(T,5.,2,*);
+ CHECK_ALL(T,5.,2,/); CHECK_MPZ(T,5.,2,/);
+ CHECK_ALL(T,0.,2,/);
+ CHECK_ALL_SIGNS(T,11.,3,+);
+ CHECK_ALL_SIGNS(T,11.,3,-);
+ CHECK_ALL_SIGNS(T,13.,1,+);
+ CHECK_ALL_SIGNS(T,13.,1,-);
+ CHECK_ALL_SIGNS(T,11.,3,*);
+ CHECK_ALL_SIGNS(T,11.,4,/);
+ CHECK_SI(T,LONG_MIN,1,*);
+ CHECK_SI(T,0,3,*);
+ CHECK_ALL_COMPARISONS(T,5.,2);
+ CHECK_ALL_SIGNS_COMPARISONS(T,11.,3);
+ CHECK_MPZ(T,5,-2,<);
+ CHECK_MPZ(T,5,-2,>);
+ CHECK_MPZ(T,5,-2,<=);
+ CHECK_MPZ(T,5,-2,>=);
+ CHECK_MPZ(T,5,-2,==);
+ CHECK_MPZ(T,5,-2,!=);
+ CHECK_MPZ(T,0,0,<);
+ CHECK_MPZ(T,0,0,>);
+ CHECK_MPZ(T,0,0,<=);
+ CHECK_MPZ(T,0,0,>=);
+ CHECK_MPZ(T,0,0,==);
+ CHECK_MPZ(T,0,0,!=);
+ ASSERT_ALWAYS(T(6)<<2==6.*4);
+ ASSERT_ALWAYS(T(6)>>2==6./4);
+ ASSERT_ALWAYS(T(-13)<<2==-13.*4);
+ ASSERT_ALWAYS(T(-13)>>2==-13./4);
+ ASSERT_ALWAYS(++T(7)==8);
+ ASSERT_ALWAYS(++T(-8)==-7);
+ ASSERT_ALWAYS(--T(8)==7);
+ ASSERT_ALWAYS(--T(-7)==-8);
+ ASSERT_ALWAYS(+T(7)==7);
+ ASSERT_ALWAYS(+T(-8)==-8);
+ ASSERT_ALWAYS(-T(7)==-7);
+ ASSERT_ALWAYS(-T(-8)==8);
+ ASSERT_ALWAYS(abs(T(7))==7);
+ ASSERT_ALWAYS(abs(T(-8))==8);
+ ASSERT_ALWAYS(sgn(T(0))==0);
+ ASSERT_ALWAYS(sgn(T(9))==1);
+ ASSERT_ALWAYS(sgn(T(-17))==-1);
+ ASSERT_ALWAYS(T(1)+DBL_MAX>2);
+ ASSERT_ALWAYS(T(1)+DBL_MIN>1);
+ ASSERT_ALWAYS(T(1)+DBL_MIN<1.001);
+ ASSERT_ALWAYS(T(1)+std::numeric_limits<double>::denorm_min()>1);
+ ASSERT_ALWAYS(T(1)+std::numeric_limits<double>::denorm_min()<1.001);
+}
+
+int
+main (void)
+{
+ tests_start();
+
+ // Enough precision for 1 + denorm_min
+ mpf_set_default_prec(DBL_MANT_DIG-DBL_MIN_EXP+42);
+ checkqf<mpq_class>();
+ checkqf<mpf_class>();
+
+ tests_end();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-ops2z.cc b/vendor/gmp-6.3.0/tests/cxx/t-ops2z.cc
new file mode 100644
index 0000000..78694b7
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-ops2z.cc
@@ -0,0 +1,126 @@
+/* Test mp*_class operators and functions.
+
+Copyright 2011, 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "t-ops2.h"
+
+void checkz (){
+ CHECK_ALL(mpz_class,5,2,+);
+ CHECK_ALL(mpz_class,5,2,-);
+ CHECK_ALL(mpz_class,5,2,*);
+ CHECK_ALL(mpz_class,5,2,/);
+ CHECK_ALL(mpz_class,5,2,%);
+ CHECK_ALL_COMPARISONS(mpz_class,5,2);
+ CHECK_ALL_SIGNS(mpz_class,11,3,+);
+ CHECK_ALL_SIGNS(mpz_class,11,3,-);
+ CHECK_ALL_SIGNS(mpz_class,11,3,*);
+ CHECK_ALL_SIGNS(mpz_class,11,3,/);
+ CHECK_ALL_SIGNS(mpz_class,11,3,%);
+ CHECK_ALL_SIGNS(mpz_class,17,2,*);
+ CHECK_ALL_SIGNS(mpz_class,17,2,/);
+ CHECK_ALL_SIGNS(mpz_class,17,2,%);
+ CHECK(unsigned long,mpz_class,5,-2,/);
+ CHECK(unsigned long,mpz_class,5,-2,%);
+ ASSERT_ALWAYS(7ul/mpz_class(1e35)==0);
+ ASSERT_ALWAYS(7ul%mpz_class(1e35)==7);
+ ASSERT_ALWAYS(7ul/mpz_class(-1e35)==0);
+ ASSERT_ALWAYS(7ul%mpz_class(-1e35)==7);
+ CHECK_ALL_SIGNS_COMPARISONS(mpz_class,11,3);
+ CHECK_ALL(mpz_class,6,3,&);
+ CHECK_ALL(mpz_class,6,3,|);
+ CHECK_ALL(mpz_class,6,3,^);
+ CHECK(mpz_class,unsigned long,6,2,<<);
+ CHECK(mpz_class,unsigned long,6,2,>>);
+ ASSERT_ALWAYS((mpz_class(-13)<<(unsigned long)2) == (-13)*4);
+ CHECK(mpz_class,unsigned long,-13,2,>>);
+ ASSERT_ALWAYS(++mpz_class(7)==8);
+ ASSERT_ALWAYS(++mpz_class(-8)==-7);
+ ASSERT_ALWAYS(--mpz_class(8)==7);
+ ASSERT_ALWAYS(--mpz_class(-7)==-8);
+ ASSERT_ALWAYS(~mpz_class(7)==-8);
+ ASSERT_ALWAYS(~mpz_class(-8)==7);
+ ASSERT_ALWAYS(+mpz_class(7)==7);
+ ASSERT_ALWAYS(+mpz_class(-8)==-8);
+ ASSERT_ALWAYS(-mpz_class(7)==-7);
+ ASSERT_ALWAYS(-mpz_class(-8)==8);
+ ASSERT_ALWAYS(abs(mpz_class(7))==7);
+ ASSERT_ALWAYS(abs(mpz_class(-8))==8);
+ ASSERT_ALWAYS(sqrt(mpz_class(7))==2);
+ ASSERT_ALWAYS(sqrt(mpz_class(0))==0);
+ ASSERT_ALWAYS(sgn(mpz_class(0))==0);
+ ASSERT_ALWAYS(sgn(mpz_class(9))==1);
+ ASSERT_ALWAYS(sgn(mpz_class(-17))==-1);
+ ASSERT_ALWAYS(mpz_class(1)+DBL_MAX>2);
+ ASSERT_ALWAYS(mpz_class(1)+DBL_MIN<2);
+ ASSERT_ALWAYS(mpz_class(1)+std::numeric_limits<double>::denorm_min()<2);
+ ASSERT_ALWAYS(gcd(mpz_class(6),mpz_class(8))==2);
+ ASSERT_ALWAYS(gcd(-mpz_class(6),mpz_class(8))==2);
+ ASSERT_ALWAYS(gcd(-mpz_class(6),-mpz_class(8))==2);
+ ASSERT_ALWAYS(gcd(mpz_class(6),8.f)==2);
+ ASSERT_ALWAYS(gcd(-mpz_class(6),static_cast<unsigned char>(8))==2);
+ ASSERT_ALWAYS(gcd(static_cast<long>(-6),mpz_class(5)+3)==2);
+ ASSERT_ALWAYS(lcm(mpz_class(6),mpz_class(8))==24);
+ ASSERT_ALWAYS(lcm(-mpz_class(6),mpz_class(8))==24);
+ ASSERT_ALWAYS(lcm(-mpz_class(6),-mpz_class(8))==24);
+ ASSERT_ALWAYS(lcm(mpz_class(6),static_cast<short>(8))==24);
+ ASSERT_ALWAYS(lcm(-mpz_class(6),static_cast<unsigned char>(8))==24);
+ ASSERT_ALWAYS(lcm(-6.,mpz_class(5)+3)==24);
+ ASSERT_ALWAYS(factorial(mpz_class(3))==6);
+ ASSERT_ALWAYS(factorial(mpz_class(5)-1)==24);
+ ASSERT_ALWAYS(mpz_class::factorial(mpz_class(3))==6);
+ ASSERT_ALWAYS(mpz_class::factorial(mpz_class(2)*2)==24);
+ ASSERT_ALWAYS(mpz_class::factorial(3)==6);
+ ASSERT_ALWAYS(mpz_class::factorial(3ul)==6);
+ ASSERT_ALWAYS(mpz_class::factorial(3.f)==6);
+ mpz_class ret;
+ try { ret=factorial(-mpz_class(3)); ASSERT_ALWAYS(0); }
+ catch (std::domain_error&) {}
+ try { ret=mpz_class::factorial(-2); ASSERT_ALWAYS(0); }
+ catch (std::domain_error&) {}
+ try { ret=factorial(mpz_class(1)<<300); ASSERT_ALWAYS(0); }
+ catch (std::bad_alloc&) {}
+ ASSERT_ALWAYS(mpz_class::primorial(mpz_class(3))==6);
+ ASSERT_ALWAYS(mpz_class::primorial(mpz_class(2)*2)==6);
+ ASSERT_ALWAYS(mpz_class::primorial(3)==6);
+ ASSERT_ALWAYS(mpz_class::primorial(3ul)==6);
+ ASSERT_ALWAYS(mpz_class::primorial(3.f)==6);
+ try { ret=primorial(-mpz_class(3)); ASSERT_ALWAYS(0); }
+ catch (std::domain_error&) {}
+ try { ret=mpz_class::primorial(-5); ASSERT_ALWAYS(0); }
+ catch (std::domain_error&) {}
+ try { ret=primorial(mpz_class(1)<<300); ASSERT_ALWAYS(0); }
+ catch (std::bad_alloc&) {}
+ ASSERT_ALWAYS(mpz_class::fibonacci(mpz_class(6))==8);
+ ASSERT_ALWAYS(mpz_class::fibonacci(mpz_class(2)*2)==3);
+ ASSERT_ALWAYS(mpz_class::fibonacci(3)==2);
+ ASSERT_ALWAYS(mpz_class::fibonacci(3ul)==2);
+ ASSERT_ALWAYS(mpz_class::fibonacci(3.f)==2);
+ ASSERT_ALWAYS(fibonacci(-mpz_class(6))==-8);
+ ASSERT_ALWAYS(mpz_class::fibonacci(-3)==2);
+ try { ret=fibonacci(mpz_class(1)<<300); ASSERT_ALWAYS(0); }
+ catch (std::bad_alloc&) {}
+}
+
+int
+main (void)
+{
+ tests_start();
+ checkz();
+ tests_end();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-ops3.cc b/vendor/gmp-6.3.0/tests/cxx/t-ops3.cc
new file mode 100644
index 0000000..baf49e1
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-ops3.cc
@@ -0,0 +1,132 @@
+/* Test mp*_class assignment operators (+=, -=, etc)
+
+Copyright 2011 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include "gmpxx.h"
+#include "gmp-impl.h"
+#include "tests.h"
+
+using namespace std;
+
+#define FOR_ALL_SIGNED_BUILTIN(F) \
+ F(signed char) \
+ F(signed short) \
+ F(signed int) \
+ F(signed long) \
+ F(float) \
+ F(double)
+
+#define FOR_ALL_BUILTIN(F) \
+ FOR_ALL_SIGNED_BUILTIN(F) \
+ F(char) \
+ F(unsigned char) \
+ F(unsigned short) \
+ F(unsigned int) \
+ F(unsigned long)
+
+#define FOR_ALL_GMPXX(F) \
+ F(mpz_class) \
+ F(mpq_class) \
+ F(mpf_class)
+
+template<class T,class U> void f(T t, U u){
+ T a=t;
+ ASSERT_ALWAYS((a+=u)==(t+u)); ASSERT_ALWAYS(a==(t+u));
+ ASSERT_ALWAYS((a-=u)==t); ASSERT_ALWAYS(a==t);
+ ASSERT_ALWAYS((a*=u)==(t*u)); ASSERT_ALWAYS(a==(t*u));
+ ASSERT_ALWAYS((a/=u)==t); ASSERT_ALWAYS(a==t);
+ ASSERT_ALWAYS((a<<=5)==(t<<5)); ASSERT_ALWAYS(a==(t<<5));
+ ASSERT_ALWAYS((a>>=5)==t); ASSERT_ALWAYS(a==t);
+}
+
+template<class T,class U> void g(T t, U u){
+ T a=t;
+ ASSERT_ALWAYS((a%=u)==(t%u)); ASSERT_ALWAYS(a==(t%u));
+ a=t;
+ ASSERT_ALWAYS((a&=u)==(t&u)); ASSERT_ALWAYS(a==(t&u));
+ a=t;
+ ASSERT_ALWAYS((a|=u)==(t|u)); ASSERT_ALWAYS(a==(t|u));
+ a=t;
+ ASSERT_ALWAYS((a^=u)==(t^u)); ASSERT_ALWAYS(a==(t^u));
+}
+
+template<class T> void h(T t){
+ T a=t;
+ ASSERT_ALWAYS((a<<=5)==(t<<5)); ASSERT_ALWAYS(a==(t<<5));
+ ASSERT_ALWAYS((a>>=5)==t); ASSERT_ALWAYS(a==t);
+}
+
+template<class T, class U> void ffs(T t, U u){
+#define F(V) f(t,(V)u);
+ FOR_ALL_SIGNED_BUILTIN(F)
+ FOR_ALL_GMPXX(F)
+#undef F
+#define F(V) f(t,-(V)u);
+ FOR_ALL_GMPXX(F)
+#undef F
+}
+
+template<class T, class U> void ff(T t, U u){
+#define F(V) f(t,(V)u);
+ FOR_ALL_BUILTIN(F)
+ FOR_ALL_GMPXX(F)
+#undef F
+#define F(V) f(t,-(V)u);
+ FOR_ALL_GMPXX(F)
+#undef F
+}
+
+template<class U> void ggs(mpz_class t, U u){
+#define F(V) g(t,(V)u);
+ FOR_ALL_SIGNED_BUILTIN(F)
+#undef F
+ g(t,(mpz_class)u);
+ g(t,-(mpz_class)u);
+}
+
+template<class U> void gg(mpz_class t, U u){
+#define F(V) g(t,(V)u);
+ FOR_ALL_BUILTIN(F)
+#undef F
+ g(t,(mpz_class)u);
+ g(t,-(mpz_class)u);
+}
+
+void check(){
+ mpz_class z=18;
+ mpq_class q(7,2);
+ mpf_class d=3.375;
+ h(z); h(q); h(d);
+ ff(z,13); ff(q,13); ff(d,13);
+ ffs(z,-42); ffs(q,-42); ffs(d,-42);
+ gg(z,33); ggs(z,-22);
+}
+
+
+int
+main (void)
+{
+ tests_start();
+
+ check();
+
+ tests_end();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-ostream.cc b/vendor/gmp-6.3.0/tests/cxx/t-ostream.cc
new file mode 100644
index 0000000..8550f67
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-ostream.cc
@@ -0,0 +1,449 @@
+/* Test ostream formatted output.
+
+Copyright 2001, 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <iostream>
+#include <cstdlib>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+using namespace std;
+
+
+bool option_check_standard = false;
+
+
+#define CALL(expr) \
+ do { \
+ got.flags (data[i].flags); \
+ got.width (data[i].width); \
+ got.precision (data[i].precision); \
+ if (data[i].fill == '\0') \
+ got.fill (' '); \
+ else \
+ got.fill (data[i].fill); \
+ \
+ if (! (expr)) \
+ { \
+ cout << "\"got\" output error\n"; \
+ abort (); \
+ } \
+ if (got.width() != 0) \
+ { \
+ cout << "\"got\" width not reset to 0\n"; \
+ abort (); \
+ } \
+ \
+ } while (0)
+
+
+#define DUMP() \
+ do { \
+ cout << " want: |" << data[i].want << "|\n"; \
+ cout << " got: |" << got.str() << "|\n"; \
+ cout << " width: " << data[i].width << "\n"; \
+ cout << " prec: " << got.precision() << "\n"; \
+ cout << " flags: " << hex << (unsigned long) got.flags() << "\n"; \
+ } while (0)
+
+#define ABORT() \
+ do { \
+ DUMP (); \
+ abort (); \
+ } while (0)
+
+void
+check_mpz (void)
+{
+ static const struct {
+ const char *z;
+ const char *want;
+ ios::fmtflags flags;
+ int width;
+ int precision;
+ char fill;
+
+ } data[] = {
+
+ { "0", "0", ios::dec },
+
+ { "0", "0", ios::oct },
+ { "0", "0", ios::oct | ios::showbase },
+
+ { "0", "0", ios::hex },
+ { "0", "0x0", ios::hex | ios::showbase },
+ { "0", "0X0", ios::hex | ios::showbase | ios::uppercase },
+
+ { "1", "****1", ios::dec, 5, 0, '*' },
+
+ { "-1", " -1", ios::dec | ios::right, 5 },
+ { "-1", "- 1", ios::dec | ios::internal, 5 },
+ { "-1", "-1 ", ios::dec | ios::left, 5 },
+
+ { "1", " 0x1", ios::hex | ios::showbase | ios::right, 6 },
+ { "1", "0x 1", ios::hex | ios::showbase | ios::internal, 6 },
+ { "1", "0x1 ", ios::hex | ios::showbase | ios::left, 6 },
+
+ { "1", " +0x1", ios::hex | ios::showbase | ios::showpos | ios::right,
+ 7 },
+ { "1", "+0x 1", ios::hex | ios::showbase | ios::showpos | ios::internal,
+ 7 },
+ { "1", "+0x1 ", ios::hex | ios::showbase | ios::showpos | ios::left,
+ 7 },
+
+ { "123", "7b", ios::hex },
+ { "123", "7B", ios::hex | ios::uppercase },
+ { "123", "0x7b", ios::hex | ios::showbase },
+ { "123", "0X7B", ios::hex | ios::showbase | ios::uppercase },
+ { "-123", "-0x7b", ios::hex | ios::showbase },
+ { "-123", "-0X7B", ios::hex | ios::showbase | ios::uppercase },
+
+ { "123", "173", ios::oct },
+ { "123", "173", ios::oct | ios::uppercase },
+ { "123", "0173", ios::oct | ios::showbase },
+ { "123", "0173", ios::oct | ios::showbase | ios::uppercase },
+ { "-123", "-0173", ios::oct | ios::showbase },
+ { "-123", "-0173", ios::oct | ios::showbase | ios::uppercase },
+
+ };
+
+ size_t i;
+ mpz_t z;
+
+ mpz_init (z);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_str_or_abort (z, data[i].z, 0);
+
+ if (option_check_standard
+ && mpz_fits_slong_p (z)
+
+ // no negatives or showpos in hex or oct
+ && (((data[i].flags & ios::basefield) == ios::hex
+ || (data[i].flags & ios::basefield) == ios::oct)
+ ? (mpz_sgn (z) >= 0
+ && ! (data[i].flags & ios::showpos))
+ : 1)
+ )
+ {
+ ostringstream got;
+ long n = mpz_get_si (z);
+ CALL (got << n);
+ if (got.str().compare (data[i].want) != 0)
+ {
+ cout << "check_mpz data[" << i
+ << "] doesn't match standard ostream output\n";
+ cout << " z: " << data[i].z << "\n";
+ cout << " n: " << n << "\n";
+ DUMP ();
+ }
+ }
+
+ {
+ ostringstream got;
+ CALL (got << z);
+ if (got.str().compare (data[i].want) != 0)
+ {
+ cout << "mpz operator<< wrong, data[" << i << "]\n";
+ cout << " z: " << data[i].z << "\n";
+ ABORT ();
+ }
+ }
+ }
+
+ mpz_clear (z);
+}
+
+void
+check_mpq (void)
+{
+ static const struct {
+ const char *q;
+ const char *want;
+ ios::fmtflags flags;
+ int width;
+ int precision;
+ char fill;
+
+ } data[] = {
+
+ { "0", "0", ios::dec },
+ { "0", "0", ios::hex },
+ { "0", "0x0", ios::hex | ios::showbase },
+ { "0", "0X0", ios::hex | ios::showbase | ios::uppercase },
+
+ { "5/8", "5/8", ios::dec },
+ { "5/8", "0X5/0X8", ios::hex | ios::showbase | ios::uppercase },
+
+ // zero denominator with showbase
+ { "0/0", " 0/0", ios::oct | ios::showbase, 10 },
+ { "0/0", " 0/0", ios::dec | ios::showbase, 10 },
+ { "0/0", " 0x0/0x0", ios::hex | ios::showbase, 10 },
+ { "123/0", " 0173/0", ios::oct | ios::showbase, 10 },
+ { "123/0", " 123/0", ios::dec | ios::showbase, 10 },
+ { "123/0", " 0x7b/0x0", ios::hex | ios::showbase, 10 },
+ { "123/0", " 0X7B/0X0", ios::hex | ios::showbase | ios::uppercase, 10 },
+ { "0/123", " 0/0173", ios::oct | ios::showbase, 10 },
+ { "0/123", " 0/123", ios::dec | ios::showbase, 10 },
+ { "0/123", " 0x0/0x7b", ios::hex | ios::showbase, 10 },
+ { "0/123", " 0X0/0X7B", ios::hex | ios::showbase | ios::uppercase, 10 },
+ };
+
+ size_t i;
+ mpq_t q;
+
+ mpq_init (q);
+
+#define mpq_integer_p(q) (mpz_cmp_ui (mpq_denref(q), 1L) == 0)
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpq_set_str_or_abort (q, data[i].q, 0);
+ MPZ_CHECK_FORMAT (mpq_numref (q));
+ MPZ_CHECK_FORMAT (mpq_denref (q));
+
+ if (option_check_standard
+ && mpz_fits_slong_p (mpq_numref(q))
+ && mpq_integer_p (q))
+ {
+ ostringstream got;
+ long n = mpz_get_si (mpq_numref(q));
+ CALL (got << n);
+ if (got.str().compare (data[i].want) != 0)
+ {
+ cout << "check_mpq data[" << i
+ << "] doesn't match standard ostream output\n";
+ cout << " q: " << data[i].q << "\n";
+ cout << " n: " << n << "\n";
+ DUMP ();
+ }
+ }
+
+ {
+ ostringstream got;
+ CALL (got << q);
+ if (got.str().compare (data[i].want) != 0)
+ {
+ cout << "mpq operator<< wrong, data[" << i << "]\n";
+ cout << " q: " << data[i].q << "\n";
+ ABORT ();
+ }
+ }
+ }
+
+ mpq_clear (q);
+}
+
+
+void
+check_mpf (void)
+{
+ static const struct {
+ const char *f;
+ const char *want;
+ ios::fmtflags flags;
+ int width;
+ int precision;
+ char fill;
+
+ } data[] = {
+
+ { "0", "0", ios::dec },
+ { "0", "+0", ios::dec | ios::showpos },
+ { "0", "0.00000", ios::dec | ios::showpoint },
+ { "0", "0", ios::dec | ios::fixed },
+ { "0", "0.", ios::dec | ios::fixed | ios::showpoint },
+ { "0", "0.000000e+00", ios::dec | ios::scientific },
+ { "0", "0.000000e+00", ios::dec | ios::scientific | ios::showpoint },
+
+ { "0", "0", ios::dec, 0, 4 },
+ { "0", "0.000", ios::dec | ios::showpoint, 0, 4 },
+ { "0", "0.0000", ios::dec | ios::fixed, 0, 4 },
+ { "0", "0.0000", ios::dec | ios::fixed | ios::showpoint, 0, 4 },
+ { "0", "0.0000e+00", ios::dec | ios::scientific, 0, 4 },
+ { "0", "0.0000e+00", ios::dec | ios::scientific | ios::showpoint, 0, 4 },
+
+ { "1", "1", ios::dec },
+ { "1", "+1", ios::dec | ios::showpos },
+ { "1", "1.00000", ios::dec | ios::showpoint },
+ { "1", "1", ios::dec | ios::fixed },
+ { "1", "1.", ios::dec | ios::fixed | ios::showpoint },
+ { "1", "1.000000e+00", ios::dec | ios::scientific },
+ { "1", "1.000000e+00", ios::dec | ios::scientific | ios::showpoint },
+
+ { "1", "1", ios::dec, 0, 4 },
+ { "1", "1.000", ios::dec | ios::showpoint, 0, 4 },
+ { "1", "1.0000", ios::dec | ios::fixed, 0, 4 },
+ { "1", "1.0000", ios::dec | ios::fixed | ios::showpoint, 0, 4 },
+ { "1", "1.0000e+00", ios::dec | ios::scientific, 0, 4 },
+ { "1", "1.0000e+00", ios::dec | ios::scientific | ios::showpoint, 0, 4 },
+
+ { "-1", "-1", ios::dec | ios::showpos },
+
+ { "-1", " -1", ios::dec, 4 },
+ { "-1", "- 1", ios::dec | ios::internal, 4 },
+ { "-1", "-1 ", ios::dec | ios::left, 4 },
+
+ { "-1", " -0x1", ios::hex | ios::showbase, 6 },
+ { "-1", "-0x 1", ios::hex | ios::showbase | ios::internal, 6 },
+ { "-1", "-0x1 ", ios::hex | ios::showbase | ios::left, 6 },
+
+ { "1", "*********1", ios::dec, 10, 4, '*' },
+ { "1234", "******1234", ios::dec, 10, 4, '*' },
+ { "1234", "*****1234.", ios::dec | ios::showpoint, 10, 4, '*' },
+
+ { "12345", "1.23e+04", ios::dec, 0, 3 },
+
+ { "12345", "12345.", ios::dec | ios::fixed | ios::showpoint },
+
+ { "1.9999999", "2", ios::dec, 0, 1 },
+ { "1.0009999999", "1.001", ios::dec, 0, 4 },
+ { "1.0001", "1", ios::dec, 0, 4 },
+ { "1.0004", "1", ios::dec, 0, 4 },
+ { "1.000555", "1.001", ios::dec, 0, 4 },
+
+ { "1.0002", "1.000", ios::dec | ios::fixed, 0, 3 },
+ { "1.0008", "1.001", ios::dec | ios::fixed, 0, 3 },
+
+ { "0", "0", ios::hex },
+ { "0", "0x0", ios::hex | ios::showbase },
+ { "0", "0X0", ios::hex | ios::showbase | ios::uppercase },
+ { "123", "7b", ios::hex },
+ { "123", "0x7b", ios::hex | ios::showbase },
+ { "123", "0X7B", ios::hex | ios::showbase | ios::uppercase },
+
+ { "0", "0.000@+00", ios::hex | ios::scientific, 0, 3 },
+ { "256", "1.000@+02", ios::hex | ios::scientific, 0, 3 },
+
+ { "123", "7.b@+01", ios::hex | ios::scientific, 0, 1 },
+ { "123", "7.B@+01", ios::hex | ios::scientific | ios::uppercase, 0, 1 },
+ { "123", "0x7.b@+01", ios::hex | ios::scientific | ios::showbase, 0, 1 },
+ { "123", "0X7.B@+01",
+ ios::hex | ios::scientific | ios::showbase | ios::uppercase, 0, 1 },
+
+ { "1099511627776", "1.0@+10", ios::hex | ios::scientific, 0, 1 },
+ { "1099511627776", "1.0@+10",
+ ios::hex | ios::scientific | ios::uppercase, 0, 1 },
+
+ { "0.0625", "1.00@-01", ios::hex | ios::scientific, 0, 2 },
+
+ { "0", "0", ios::oct },
+ { "123", "173", ios::oct },
+ { "123", "0173", ios::oct | ios::showbase },
+
+ // octal showbase suppressed for 0
+ { "0", "0", ios::oct | ios::showbase },
+ { ".125", "00.1", ios::oct | ios::showbase, 0, 1 },
+ { ".015625", "00.01", ios::oct | ios::showbase, 0, 2 },
+ { ".125", "00.1", ios::fixed | ios::oct | ios::showbase, 0, 1 },
+ { ".015625", "0.0", ios::fixed | ios::oct | ios::showbase, 0, 1 },
+ { ".015625", "00.01", ios::fixed | ios::oct | ios::showbase, 0, 2 },
+
+ { "0.125", "1.000000e-01", ios::oct | ios::scientific },
+ { "0.125", "+1.000000e-01", ios::oct | ios::scientific | ios::showpos },
+ { "-0.125", "-1.000000e-01", ios::oct | ios::scientific },
+ { "-0.125", "-1.000000e-01", ios::oct | ios::scientific | ios::showpos },
+
+ { "0", "0.000e+00", ios::oct | ios::scientific, 0, 3 },
+ { "256", "4.000e+02", ios::oct | ios::scientific, 0, 3 },
+ { "256", "04.000e+02", ios::oct | ios::scientific | ios::showbase, 0, 3 },
+ { "256", "4.000E+02", ios::oct | ios::scientific | ios::uppercase, 0, 3 },
+ { "256", "04.000E+02",
+ ios::oct | ios::scientific | ios::showbase | ios::uppercase, 0, 3 },
+
+ { "16777216", "1.000000e+08", ios::oct | ios::scientific },
+ { "16777216", "1.000000E+08",
+ ios::oct | ios::scientific | ios::uppercase },
+ { "16777216", "01.000000e+08",
+ ios::oct | ios::scientific | ios::showbase },
+ { "16777216", "01.000000E+08",
+ ios::oct | ios::scientific | ios::showbase | ios::uppercase },
+ { "16777216", "+01.000000e+08",
+ ios::oct | ios::scientific | ios::showbase | ios::showpos },
+ { "16777216", "+01.000000E+08", ios::oct | ios::scientific
+ | ios::showbase | ios::showpos | ios::uppercase },
+ { "-16777216", "-01.000000e+08",
+ ios::oct | ios::scientific | ios::showbase | ios::showpos },
+ { "-16777216", "-01.000000E+08", ios::oct | ios::scientific
+ | ios::showbase | ios::showpos | ios::uppercase },
+
+ };
+
+ size_t i;
+ mpf_t f, f2;
+ double d;
+
+ mpf_init (f);
+ mpf_init (f2);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpf_set_str_or_abort (f, data[i].f, 0);
+
+ d = mpf_get_d (f);
+ mpf_set_d (f2, d);
+ if (option_check_standard && mpf_cmp (f, f2) == 0
+ && ! (data[i].flags & (ios::hex | ios::oct | ios::showbase)))
+ {
+ ostringstream got;
+ CALL (got << d);
+ if (got.str().compare (data[i].want) != 0)
+ {
+ cout << "check_mpf data[" << i
+ << "] doesn't match standard ostream output\n";
+ cout << " f: " << data[i].f << "\n";
+ cout << " d: " << d << "\n";
+ DUMP ();
+ }
+ }
+
+ {
+ ostringstream got;
+ CALL (got << f);
+ if (got.str().compare (data[i].want) != 0)
+ {
+ cout << "mpf operator<< wrong, data[" << i << "]\n";
+ cout << " f: " << data[i].f << "\n";
+ ABORT ();
+ }
+ }
+ }
+
+ mpf_clear (f);
+ mpf_clear (f2);
+}
+
+
+
+int
+main (int argc, char *argv[])
+{
+ if (argc > 1 && strcmp (argv[1], "-s") == 0)
+ option_check_standard = true;
+
+ tests_start ();
+
+ check_mpz ();
+ check_mpq ();
+ check_mpf ();
+
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-prec.cc b/vendor/gmp-6.3.0/tests/cxx/t-prec.cc
new file mode 100644
index 0000000..72fca72
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-prec.cc
@@ -0,0 +1,216 @@
+/* Test precision of mpf_class expressions.
+
+Copyright 2001-2003, 2008 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <iostream>
+
+#include "gmpxx.h"
+#include "gmp-impl.h"
+#include "tests.h"
+
+using namespace std;
+
+
+const int
+small_prec = 64, medium_prec = 128, large_prec = 192, very_large_prec = 256;
+
+#define ASSERT_ALWAYS_PREC(a, s, prec) \
+{ \
+ mpf_srcptr _a = a.get_mpf_t(); \
+ mpf_class _b(s, prec); \
+ mpf_srcptr _c = _b.get_mpf_t(); \
+ ASSERT_ALWAYS(mpf_eq(_a, _c, prec)); \
+}
+
+
+
+void
+check_mpf (void)
+{
+ mpf_set_default_prec(medium_prec);
+
+ // simple expressions
+ {
+ mpf_class f(3.0, small_prec);
+ mpf_class g(1 / f, very_large_prec);
+ ASSERT_ALWAYS_PREC
+ (g, "0.33333 33333 33333 33333 33333 33333 33333 33333 33333 33333"
+ " 33333 33333 33333 33333 33333 333", very_large_prec);
+ }
+ {
+ mpf_class f(9.0, medium_prec);
+ mpf_class g(0.0, very_large_prec);
+ g = 1 / f;
+ ASSERT_ALWAYS_PREC
+ (g, "0.11111 11111 11111 11111 11111 11111 11111 11111 11111 11111"
+ " 11111 11111 11111 11111 11111 111", very_large_prec);
+ }
+ {
+ mpf_class f(15.0, large_prec);
+ mpf_class g(0.0, very_large_prec);
+ g = 1 / f;
+ ASSERT_ALWAYS_PREC
+ (g, "0.06666 66666 66666 66666 66666 66666 66666 66666 66666 66666"
+ " 66666 66666 66666 66666 66666 667", very_large_prec);
+ }
+
+ // compound expressions
+ {
+ mpf_class f(3.0, small_prec);
+ mpf_class g(-(-(-1 / f)), very_large_prec);
+ ASSERT_ALWAYS_PREC
+ (g, "-0.33333 33333 33333 33333 33333 33333 33333 33333 33333 33333"
+ " 33333 33333 33333 33333 33333 333", very_large_prec);
+ }
+ {
+ mpf_class f(3.0, small_prec), g(9.0, medium_prec);
+ mpf_class h(0.0, very_large_prec);
+ h = 1/f + 1/g;
+ ASSERT_ALWAYS_PREC
+ (h, "0.44444 44444 44444 44444 44444 44444 44444 44444 44444 44444"
+ " 44444 44444 44444 44444 44444 444", very_large_prec);
+ }
+ {
+ mpf_class f(3.0, small_prec), g(9.0, medium_prec), h(15.0, large_prec);
+ mpf_class i(0.0, very_large_prec);
+ i = f / g + h;
+ ASSERT_ALWAYS_PREC
+ (i, "15.33333 33333 33333 33333 33333 33333 33333 33333 33333 33333"
+ " 33333 33333 33333 33333 33333 3", very_large_prec);
+ }
+ {
+ mpf_class f(3.0, small_prec);
+ mpf_class g(-(1 + f) / 3, very_large_prec);
+ ASSERT_ALWAYS_PREC
+ (g, "-1.33333 33333 33333 33333 33333 33333 33333 33333 33333 33333"
+ " 33333 33333 33333 33333 33333 33", very_large_prec);
+ }
+ {
+ mpf_class f(9.0, medium_prec);
+ mpf_class g(0.0, very_large_prec);
+ g = sqrt(1 / f);
+ ASSERT_ALWAYS_PREC
+ (g, "0.33333 33333 33333 33333 33333 33333 33333 33333 33333 33333"
+ " 33333 33333 33333 33333 33333 333", very_large_prec);
+ }
+ {
+ mpf_class f(15.0, large_prec);
+ mpf_class g(0.0, very_large_prec);
+ g = hypot(1 + 5 / f, 1.0);
+ ASSERT_ALWAYS_PREC
+ (g, "1.66666 66666 66666 66666 66666 66666 66666 66666 66666 66666"
+ " 66666 66666 66666 66666 66666 67", very_large_prec);
+ }
+
+ // compound assignments
+ {
+ mpf_class f(3.0, small_prec), g(9.0, medium_prec);
+ mpf_class h(1.0, very_large_prec);
+ h -= f / g;
+ ASSERT_ALWAYS_PREC
+ (h, "0.66666 66666 66666 66666 66666 66666 66666 66666 66666 66666"
+ " 66666 66666 66666 66666 66666 667", very_large_prec);
+ }
+
+ // construction from expressions
+ {
+ mpf_class f(3.0, small_prec);
+ mpf_class g(0.0, very_large_prec);
+ g = mpf_class(1 / f);
+ ASSERT_ALWAYS_PREC(g, "0.33333 33333 33333 33333", small_prec);
+ }
+ {
+ mpf_class f(9.0, medium_prec);
+ mpf_class g(0.0, very_large_prec);
+ g = mpf_class(1 / f);
+ ASSERT_ALWAYS_PREC
+ (g, "0.11111 11111 11111 11111 11111 11111 11111 1111", medium_prec);
+ }
+ {
+ mpf_class f(15.0, large_prec);
+ mpf_class g(0.0, very_large_prec);
+ g = mpf_class(1 / f);
+ ASSERT_ALWAYS_PREC
+ (g, "0.06666 66666 66666 66666 66666 66666 66666 66666 66666 66666"
+ " 66666 6667", large_prec);
+ }
+
+ {
+ mpf_class f(3.0, small_prec), g(9.0, medium_prec);
+ mpf_class h(0.0, very_large_prec);
+ h = mpf_class(f / g + 1, large_prec);
+ ASSERT_ALWAYS_PREC
+ (h, "1.33333 33333 33333 33333 33333 33333 33333 33333 33333 33333"
+ " 33333 333",
+ large_prec);
+ }
+
+ // mixed mpf/mpq expressions
+ {
+ mpf_class f(3.0, small_prec);
+ mpq_class q(1, 3);
+ mpf_class g(0.0, very_large_prec);
+ g = f - q;
+ ASSERT_ALWAYS_PREC
+ (g, "2.66666 66666 66666 66666 66666 66666 66666 66666 66666 66666"
+ " 66666 66666 66666 66666 66666 67", very_large_prec);
+ }
+
+ {
+ mpf_class f(3.0, small_prec);
+ mpq_class q(1, 3);
+ mpf_class g(0.0, very_large_prec);
+ g = mpf_class(f - q, large_prec);
+ ASSERT_ALWAYS_PREC
+ (g, "2.66666 66666 66666 66666 66666 66666 66666 66666 66666 66666"
+ " 66666 667",
+ large_prec);
+ }
+ {
+ mpf_class f(3.0, small_prec);
+ mpq_class q(1, 3);
+ mpf_class g(0.0, very_large_prec);
+ g = mpf_class(f - q);
+ ASSERT_ALWAYS_PREC
+ (g, "2.66666 66666 66666 66666 66666 66666 66666 667", medium_prec);
+ }
+ {
+ mpf_class f(15.0, large_prec);
+ mpq_class q(1, 3);
+ mpf_class g(0.0, very_large_prec);
+ g = mpf_class(f + q);
+ ASSERT_ALWAYS_PREC
+ (g, "15.33333 33333 33333 33333 33333 33333 33333 33333 33333 33333"
+ " 33333 33",
+ large_prec);
+ }
+}
+
+
+int
+main (void)
+{
+ tests_start();
+
+ check_mpf();
+
+ tests_end();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-rand.cc b/vendor/gmp-6.3.0/tests/cxx/t-rand.cc
new file mode 100644
index 0000000..d336d08
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-rand.cc
@@ -0,0 +1,148 @@
+/* Test gmp_randclass.
+
+Copyright 2002, 2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "gmpxx.h"
+#include "gmp-impl.h"
+#include "tests.h"
+
+using namespace std;
+
+
+/* all flavours of initialization */
+void
+check_randinit (void)
+{
+ {
+ gmp_randclass r(gmp_randinit_default);
+ }
+
+ {
+ mpz_class a(0);
+ unsigned long c = 0, m2exp = 8;
+ gmp_randclass r(gmp_randinit_lc_2exp, a, c, m2exp);
+ }
+
+ {
+ unsigned long m2exp = 64;
+ gmp_randclass r(gmp_randinit_lc_2exp_size, m2exp);
+ }
+
+ /* gmp_randinit_lc_2exp_size, with excessive size */
+ {
+ try {
+ unsigned long m2exp = ULONG_MAX;
+ gmp_randclass r(gmp_randinit_lc_2exp_size, m2exp);
+ ASSERT_ALWAYS (0); /* should not be reached */
+ } catch (length_error&) {
+ }
+ }
+
+ {
+ gmp_randclass r(gmp_randinit_mt);
+ }
+
+ /* obsolete, but still available */
+ {
+ gmp_randalg_t alg = GMP_RAND_ALG_LC;
+ unsigned long m2exp = 64;
+ gmp_randclass r(alg, m2exp);
+ }
+ {
+ gmp_randalg_t alg = GMP_RAND_ALG_DEFAULT;
+ unsigned long m2exp = 64;
+ gmp_randclass r(alg, m2exp);
+ }
+ {
+ gmp_randalg_t alg = (gmp_randalg_t) 0;
+ unsigned long m2exp = 64;
+ gmp_randclass r(alg, m2exp);
+ }
+}
+
+void
+check_mpz (void)
+{
+ {
+ gmp_randclass r(gmp_randinit_default);
+ mpz_class a(123);
+ unsigned int b = 256;
+ mpz_class c;
+ r.seed(a);
+ c = r.get_z_bits(b);
+ }
+ {
+ gmp_randclass r(gmp_randinit_default);
+ mpz_class a(256);
+ unsigned long b = 123;
+ mpz_class c;
+ r.seed(b);
+ c = r.get_z_bits(a);
+ }
+ {
+ gmp_randclass r(gmp_randinit_default);
+ mpz_class a(123), b(256);
+ mpz_class c;
+ r.seed(a);
+ c = r.get_z_range(b);
+ }
+}
+
+void
+check_mpf (void)
+{
+ {
+ gmp_randclass r(gmp_randinit_default);
+ mpz_class a(123);
+ r.seed(a);
+ mpf_class b;
+ b = r.get_f();
+ mpf_class c(r.get_f());
+ ASSERT_ALWAYS (c.get_prec() == mpf_get_default_prec());
+ mpf_class d(r.get_f(),212);
+ ASSERT_ALWAYS (d.get_prec() >= 212);
+ }
+ {
+ gmp_randclass r(gmp_randinit_default);
+ int a = 123, b = 198;
+ r.seed(a);
+ mpf_class c;
+ c = r.get_f(b);
+ ASSERT_ALWAYS (c.get_prec() == mpf_get_default_prec());
+ mpf_class d(r.get_f(b));
+ ASSERT_ALWAYS (d.get_prec() >= 198);
+ mpf_class e(r.get_f(b)-r.get_f());
+ ASSERT_ALWAYS (e.get_prec() >= 198);
+ mpf_class f(r.get_f(60),300);
+ ASSERT_ALWAYS (f.get_prec() >= 300);
+ }
+}
+
+
+int
+main (void)
+{
+ tests_start();
+
+ check_randinit();
+ check_mpz();
+ check_mpf();
+
+ tests_end();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-ternary.cc b/vendor/gmp-6.3.0/tests/cxx/t-ternary.cc
new file mode 100644
index 0000000..8d087fb
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-ternary.cc
@@ -0,0 +1,734 @@
+/* Test mp*_class ternary expressions.
+
+Copyright 2001-2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <iostream>
+
+#include "gmpxx.h"
+#include "gmp-impl.h"
+#include "tests.h"
+
+using namespace std;
+
+
+/* The various test cases are broken up into separate functions to keep down
+ compiler memory use. They're static so that any mistakenly omitted from
+ main() will provoke warnings (under gcc -Wall at least). */
+
+static void
+check_mpz_1 (void)
+{
+ // template<class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr
+ // <mpz_t, __gmp_binary_expr<mpz_class, mpz_class, Op1> >, Op2> >
+ {
+ mpz_class a(1), b(2), c(3);
+ mpz_class d;
+ d = a + b * c; ASSERT_ALWAYS(d == 7);
+ }
+ {
+ mpz_class a(1), b(2), c(3);
+ mpz_class d;
+ d = a - b * c; ASSERT_ALWAYS(d == -5);
+ }
+}
+
+static void
+check_mpz_2 (void)
+{
+ // template <class T, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr
+ // <mpz_t, __gmp_binary_expr<mpz_class, T, Op1> >, Op2> >
+ {
+ mpz_class a(1), b(2);
+ signed int c = 3;
+ mpz_class d;
+ d = a + b * c; ASSERT_ALWAYS(d == 7);
+ }
+ {
+ mpz_class a(1), b(2);
+ signed int c = 3;
+ mpz_class d;
+ d = a - b * c; ASSERT_ALWAYS(d == -5);
+ }
+}
+
+static void
+check_mpz_3 (void)
+{
+ // template <class T, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr
+ // <mpz_t, __gmp_binary_expr<T, mpz_class, Op1> >, Op2> >
+ {
+ mpz_class a(1), b(2);
+ unsigned int c = 3;
+ mpz_class d;
+ d = a + c * b; ASSERT_ALWAYS(d == 7);
+ }
+ {
+ mpz_class a(1), b(2);
+ unsigned int c = 3;
+ mpz_class d;
+ d = a - c * b; ASSERT_ALWAYS(d == -5);
+ }
+}
+
+static void
+check_mpz_4 (void)
+{
+ // template <class T, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr
+ // <mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr<mpz_t, T>, Op1> >, Op2> >
+ {
+ mpz_class a(1), b(2), c(3);
+ double d = 4.0;
+ mpz_class e;
+ e = a + b * (c + d); ASSERT_ALWAYS(e == 15);
+ }
+ {
+ mpz_class a(1), b(2), c(3);
+ double d = 4.0;
+ mpz_class e;
+ e = a - b * (c + d); ASSERT_ALWAYS(e == -13);
+ }
+}
+
+static void
+check_mpz_5 (void)
+{
+ // template <class T, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr
+ // <mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, mpz_class, Op1> >, Op2> >
+ {
+ mpz_class a(1), b(2), c(3);
+ signed int d = 4;
+ mpz_class e;
+ e = a + (b - d) * c; ASSERT_ALWAYS(e == -5);
+ }
+ {
+ mpz_class a(1), b(2), c(3);
+ signed int d = 4;
+ mpz_class e;
+ e = a - (b - d) * c; ASSERT_ALWAYS(e == 7);
+ }
+}
+
+static void
+check_mpz_6 (void)
+{
+ // template <class T, class U, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr
+ // <mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, U, Op1> >, Op2> >
+ {
+ mpz_class a(1), b(2);
+ unsigned int c = 3, d = 4;
+ mpz_class e;
+ e = a + (b + c) * d; ASSERT_ALWAYS(e == 21);
+ }
+ {
+ mpz_class a(1), b(2);
+ unsigned int c = 3, d = 4;
+ mpz_class e;
+ e = a - (b + c) * d; ASSERT_ALWAYS(e == -19);
+ }
+}
+
+static void
+check_mpz_7 (void)
+{
+ // template <class T, class U, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr
+ // <mpz_t, __gmp_binary_expr<T, __gmp_expr<mpz_t, U>, Op1> >, Op2> >
+ {
+ mpz_class a(1), b(2);
+ double c = 3.0, d = 4.0;
+ mpz_class e;
+ e = a + c * (b + d); ASSERT_ALWAYS(e == 19);
+ }
+ {
+ mpz_class a(1), b(2);
+ double c = 3.0, d = 4.0;
+ mpz_class e;
+ e = a - c * (b + d); ASSERT_ALWAYS(e == -17);
+ }
+}
+
+static void
+check_mpz_8 (void)
+{
+ // template <class T, class U, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr
+ // <mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, __gmp_expr<mpz_t, U>,
+ // Op1> >, Op2> >
+ {
+ mpz_class a(1), b(2), c(3);
+ signed int d = 4, e = 5;
+ mpz_class f;
+ f = a + (b - d) * (c + e); ASSERT_ALWAYS(f == -15);
+ }
+ {
+ mpz_class a(1), b(2), c(3);
+ signed int d = 4, e = 5;
+ mpz_class f;
+ f = a - (b - d) * (c + e); ASSERT_ALWAYS(f == 17);
+ }
+}
+
+static void
+check_mpz_9 (void)
+{
+ // template <class T, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>,
+ // __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, mpz_class, Op1> >, Op2> >
+ {
+ mpz_class a(1), b(2), c(3);
+ unsigned int d = 4;
+ mpz_class e;
+ e = (a + d) + b * c; ASSERT_ALWAYS(e == 11);
+ }
+ {
+ mpz_class a(1), b(2), c(3);
+ unsigned int d = 4;
+ mpz_class e;
+ e = (a + d) - b * c; ASSERT_ALWAYS(e == -1);
+ }
+}
+
+static void
+check_mpz_10 (void)
+{
+ // template <class T, class U, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>,
+ // __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, U, Op1> >, Op2> >
+ {
+ mpz_class a(1), b(2);
+ double c = 3.0, d = 4.0;
+ mpz_class e;
+ e = (a - c) + b * d; ASSERT_ALWAYS(e == 6);
+ }
+ {
+ mpz_class a(1), b(2);
+ double c = 3.0, d = 4.0;
+ mpz_class e;
+ e = (a - c) - b * d; ASSERT_ALWAYS(e == -10);
+ }
+}
+
+static void
+check_mpz_11 (void)
+{
+ // template <class T, class U, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>,
+ // __gmp_expr<mpz_t, __gmp_binary_expr<U, mpz_class, Op1> >, Op2> >
+ {
+ mpz_class a(1), b(2);
+ signed int c = 3, d = 4;
+ mpz_class e;
+ e = (a - c) + d * b; ASSERT_ALWAYS(e == 6);
+ }
+ {
+ mpz_class a(1), b(2);
+ signed int c = 3, d = 4;
+ mpz_class e;
+ e = (a - c) - d * b; ASSERT_ALWAYS(e == -10);
+ }
+}
+
+static void
+check_mpz_12 (void)
+{
+ // template <class T, class U, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, __gmp_expr
+ // <mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr<mpz_t, U>, Op1> >, Op2> >
+ {
+ mpz_class a(1), b(2), c(3);
+ unsigned int d = 4, e = 5;
+ mpz_class f;
+ f = (a + d) + b * (c - e); ASSERT_ALWAYS(f == 1);
+ }
+ {
+ mpz_class a(1), b(2), c(3);
+ unsigned int d = 4, e = 5;
+ mpz_class f;
+ f = (a + d) - b * (c - e); ASSERT_ALWAYS(f == 9);
+ }
+}
+
+static void
+check_mpz_13 (void)
+{
+ // template <class T, class U, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, __gmp_expr
+ // <mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, U>, mpz_class, Op1> >, Op2> >
+ {
+ mpz_class a(1), b(2), c(3);
+ double d = 4.0, e = 5.0;
+ mpz_class f;
+ f = (a - d) + (b + e) * c; ASSERT_ALWAYS(f == 18);
+ }
+ {
+ mpz_class a(1), b(2), c(3);
+ double d = 4.0, e = 5.0;
+ mpz_class f;
+ f = (a - d) - (b + e) * c; ASSERT_ALWAYS(f == -24);
+ }
+
+}
+
+static void
+check_mpz_14 (void)
+{
+ // template <class T, class U, class V, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, __gmp_expr
+ // <mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, U>, V, Op1> >, Op2> >
+ {
+ mpz_class a(1), b(2);
+ signed int c = 3, d = 4, e = 5;
+ mpz_class f;
+ f = (a + c) + (b + d) * e; ASSERT_ALWAYS(f == 34);
+ }
+ {
+ mpz_class a(1), b(2);
+ signed int c = 3, d = 4, e = 5;
+ mpz_class f;
+ f = (a + c) - (b + d) * e; ASSERT_ALWAYS(f == -26);
+ }
+}
+
+static void
+check_mpz_15 (void)
+{
+ // template <class T, class U, class V, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, __gmp_expr
+ // <mpz_t, __gmp_binary_expr<U, __gmp_expr<mpz_t, V>, Op1> >, Op2> >
+ {
+ mpz_class a(1), b(2);
+ unsigned int c = 3, d = 4, e = 5;
+ mpz_class f;
+ f = (a - c) + d * (b - e); ASSERT_ALWAYS(f == -14);
+ }
+ {
+ mpz_class a(1), b(2);
+ unsigned int c = 3, d = 4, e = 5;
+ mpz_class f;
+ f = (a - c) - d * (b - e); ASSERT_ALWAYS(f == 10);
+ }
+
+}
+
+static void
+check_mpz_16 (void)
+{
+ // template <class T, class U, class V, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, __gmp_expr
+ // <mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, U>, __gmp_expr<mpz_t, V>,
+ // Op1> >, Op2> >
+ {
+ mpz_class a(1), b(2), c(3);
+ double d = 4.0, e = 5.0, f = 6.0;
+ mpz_class g;
+ g = (a + d) + (b - e) * (c + f); ASSERT_ALWAYS(g == -22);
+ }
+ {
+ mpz_class a(1), b(2), c(3);
+ double d = 4.0, e = 5.0, f = 6.0;
+ mpz_class g;
+ g = (a + d) - (b - e) * (c + f); ASSERT_ALWAYS(g == 32);
+ }
+}
+
+static void
+check_mpz_17 (void)
+{
+ // template <class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr
+ // <mpz_t, __gmp_binary_expr<mpz_class, mpz_class, Op1> >, mpz_class, Op2> >
+ {
+ mpz_class a(2), b(3), c(4);
+ mpz_class d;
+ d = a * b + c; ASSERT_ALWAYS(d == 10);
+ }
+ {
+ mpz_class a(2), b(3), c(4);
+ mpz_class d;
+ d = a * b - c; ASSERT_ALWAYS(d == 2);
+ }
+}
+
+static void
+check_mpz_18 (void)
+{
+ // template <class T, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr
+ // <mpz_t, __gmp_binary_expr<mpz_class, T, Op1> >, mpz_class, Op2> >
+ {
+ mpz_class a(2), b(3);
+ signed int c = 4;
+ mpz_class d;
+ d = a * c + b; ASSERT_ALWAYS(d == 11);
+ }
+ {
+ mpz_class a(2), b(3);
+ signed int c = 4;
+ mpz_class d;
+ d = a * c - b; ASSERT_ALWAYS(d == 5);
+ }
+
+}
+
+static void
+check_mpz_19 (void)
+{
+ // template <class T, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr
+ // <mpz_t, __gmp_binary_expr<T, mpz_class, Op1> >, mpz_class, Op2> >
+ {
+ mpz_class a(2), b(3);
+ unsigned int c = 4;
+ mpz_class d;
+ d = c * a + b; ASSERT_ALWAYS(d == 11);
+ }
+ {
+ mpz_class a(2), b(3);
+ unsigned int c = 4;
+ mpz_class d;
+ d = c * a - b; ASSERT_ALWAYS(d == 5);
+ }
+}
+
+static void
+check_mpz_20 (void)
+{
+ // template <class T, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, __gmp_binary_expr
+ // <mpz_class, __gmp_expr<mpz_t, T>, Op1> >, mpz_class, Op2> >
+ {
+ mpz_class a(2), b(3), c(4);
+ double d = 5.0;
+ mpz_class e;
+ e = a * (b + d) + c; ASSERT_ALWAYS(e == 20);
+ }
+ {
+ mpz_class a(2), b(3), c(4);
+ double d = 5.0;
+ mpz_class e;
+ e = a * (b + d) - c; ASSERT_ALWAYS(e == 12);
+ }
+}
+
+static void
+check_mpz_21 (void)
+{
+ // template <class T, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, __gmp_binary_expr
+ // <__gmp_expr<mpz_t, T>, mpz_class, Op1> >, mpz_class, Op2> >
+ {
+ mpz_class a(2), b(3), c(4);
+ signed int d = 5;
+ mpz_class e;
+ e = (a - d) * b + c; ASSERT_ALWAYS(e == -5);
+ }
+ {
+ mpz_class a(2), b(3), c(4);
+ signed int d = 5;
+ mpz_class e;
+ e = (a - d) * b - c; ASSERT_ALWAYS(e == -13);
+ }
+}
+
+static void
+check_mpz_22 (void)
+{
+ // template <class T, class U, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, __gmp_binary_expr
+ // <__gmp_expr<mpz_t, T>, U, Op1> >, mpz_class, Op2> >
+ {
+ mpz_class a(2), b(3);
+ unsigned int c = 4, d = 5;
+ mpz_class e;
+ e = (a + c) * d + b; ASSERT_ALWAYS(e == 33);
+ }
+ {
+ mpz_class a(2), b(3);
+ unsigned int c = 4, d = 5;
+ mpz_class e;
+ e = (a + c) * d - b; ASSERT_ALWAYS(e == 27);
+ }
+}
+
+static void
+check_mpz_23 (void)
+{
+ // template <class T, class U, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, __gmp_binary_expr
+ // <T, __gmp_expr<mpz_t, U>, Op1> >, mpz_class, Op2> >
+ {
+ mpz_class a(2), b(3);
+ double c = 4.0, d = 5.0;
+ mpz_class e;
+ e = c * (a + d) + b; ASSERT_ALWAYS(e == 31);
+ }
+ {
+ mpz_class a(2), b(3);
+ double c = 4.0, d = 5.0;
+ mpz_class e;
+ e = c * (a + d) - b; ASSERT_ALWAYS(e == 25);
+ }
+
+}
+
+static void
+check_mpz_24 (void)
+{
+ // template <class T, class U, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, __gmp_binary_expr
+ // <__gmp_expr<mpz_t, T>, __gmp_expr<mpz_t, U>, Op1> >, mpz_class, Op2> >
+ {
+ mpz_class a(2), b(3), c(4);
+ signed int d = 5, e = 6;
+ mpz_class f;
+ f = (a - d) * (b + e) + c; ASSERT_ALWAYS(f == -23);
+ }
+ {
+ mpz_class a(2), b(3), c(4);
+ signed int d = 5, e = 6;
+ mpz_class f;
+ f = (a - d) * (b + e) - c; ASSERT_ALWAYS(f == -31);
+ }
+}
+
+static void
+check_mpz_25 (void)
+{
+ // template <class T, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, __gmp_binary_expr
+ // <mpz_class, mpz_class, Op1> >, __gmp_expr<mpz_t, T>, Op2> >
+ {
+ mpz_class a(2), b(3), c(4);
+ unsigned int d = 5;
+ mpz_class e;
+ e = a * b + (c - d); ASSERT_ALWAYS(e == 5);
+ }
+ {
+ mpz_class a(2), b(3), c(4);
+ unsigned int d = 5;
+ mpz_class e;
+ e = a * b - (c - d); ASSERT_ALWAYS(e == 7);
+ }
+}
+
+static void
+check_mpz_26 (void)
+{
+ // template <class T, class U, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, __gmp_binary_expr
+ // <mpz_class, T, Op1> >, __gmp_expr<mpz_t, U>, Op2> >
+ {
+ mpz_class a(2), b(3);
+ double c = 4.0, d = 5.0;
+ mpz_class e;
+ e = a * c + (b + d); ASSERT_ALWAYS(e == 16);
+ }
+ {
+ mpz_class a(2), b(3);
+ double c = 4.0, d = 5.0;
+ mpz_class e;
+ e = a * c - (b + d); ASSERT_ALWAYS(e == 0);
+ }
+}
+
+static void
+check_mpz_27 (void)
+{
+ // template <class T, class U, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, __gmp_binary_expr
+ // <T, mpz_class, Op1> >, __gmp_expr<mpz_t, U>, Op2> >
+ {
+ mpz_class a(2), b(3);
+ signed int c = 4, d = 5;
+ mpz_class e;
+ e = c * a + (b - d); ASSERT_ALWAYS(e == 6);
+ }
+ {
+ mpz_class a(2), b(3);
+ signed int c = 4, d = 5;
+ mpz_class e;
+ e = c * a - (b - d); ASSERT_ALWAYS(e == 10);
+ }
+}
+
+static void
+check_mpz_28 (void)
+{
+ // template <class T, class U, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, __gmp_binary_expr
+ // <mpz_class, __gmp_expr<mpz_t, T>, Op1> >, __gmp_expr<mpz_t, U>, Op2> >
+ {
+ mpz_class a(2), b(3), c(4);
+ unsigned int d = 5, e = 6;
+ mpz_class f;
+ f = a * (b - d) + (c + e); ASSERT_ALWAYS(f == 6);
+ }
+ {
+ mpz_class a(2), b(3), c(4);
+ unsigned int d = 5, e = 6;
+ mpz_class f;
+ f = a * (b - d) - (c + e); ASSERT_ALWAYS(f == -14);
+ }
+}
+
+static void
+check_mpz_29 (void)
+{
+ // template <class T, class U, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, __gmp_binary_expr
+ // <__gmp_expr<mpz_t, T>, mpz_class, Op1> >, __gmp_expr<mpz_t, U>, Op2> >
+ {
+ mpz_class a(2), b(3), c(4);
+ double d = 5.0, e = 6.0;
+ mpz_class f;
+ f = (a + d) * b + (c - e); ASSERT_ALWAYS(f == 19);
+ }
+ {
+ mpz_class a(2), b(3), c(4);
+ double d = 5.0, e = 6.0;
+ mpz_class f;
+ f = (a + d) * b - (c - e); ASSERT_ALWAYS(f == 23);
+ }
+}
+
+static void
+check_mpz_30 (void)
+{
+ // template <class T, class U, class V, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, __gmp_binary_expr
+ // <__gmp_expr<mpz_t, T>, U, Op1> >, __gmp_expr<mpz_t, V>, Op2> >
+ {
+ mpz_class a(2), b(3);
+ signed int c = 4, d = 5, e = 6;
+ mpz_class f;
+ f = (a + c) * d + (b + e); ASSERT_ALWAYS(f == 39);
+ }
+ {
+ mpz_class a(2), b(3);
+ signed int c = 4, d = 5, e = 6;
+ mpz_class f;
+ f = (a + c) * d - (b + e); ASSERT_ALWAYS(f == 21);
+ }
+}
+
+static void
+check_mpz_31 (void)
+{
+ // template <class T, class U, class V, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, __gmp_binary_expr
+ // <T, __gmp_expr<mpz_t, U>, Op1> >, __gmp_expr<mpz_t, V>, Op2> >
+ {
+ mpz_class a(2), b(3);
+ unsigned int c = 4, d = 5, e = 6;
+ mpz_class f;
+ f = c * (a + d) + (b - e); ASSERT_ALWAYS(f == 25);
+ }
+ {
+ mpz_class a(2), b(3);
+ unsigned int c = 4, d = 5, e = 6;
+ mpz_class f;
+ f = c * (a + d) - (b - e); ASSERT_ALWAYS(f == 31);
+ }
+}
+
+static void
+check_mpz_32 (void)
+{
+ // template <class T, class U, class V, class Op1, class Op2>
+ // __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, __gmp_binary_expr
+ // <__gmp_expr<mpz_t, T>, __gmp_expr<mpz_t, U>, Op1> >,
+ // __gmp_expr<mpz_t, V>, Op2> >
+ {
+ mpz_class a(2), b(3), c(4);
+ double d = 5.0, e = 6.0, f = 7.0;
+ mpz_class g;
+ g = (a + d) * (b - e) + (c + f); ASSERT_ALWAYS(g == -10);
+ }
+ {
+ mpz_class a(2), b(3), c(4);
+ double d = 5.0, e = 6.0, f = 7.0;
+ mpz_class g;
+ g = (a + d) * (b - e) - (c + f); ASSERT_ALWAYS(g == -32);
+ }
+}
+
+void
+check_mpq (void)
+{
+ // currently there's no ternary mpq operation
+}
+
+void
+check_mpf (void)
+{
+ // currently there's no ternary mpf operation
+}
+
+
+int
+main (void)
+{
+ tests_start();
+
+ check_mpz_1 ();
+ check_mpz_2 ();
+ check_mpz_3 ();
+ check_mpz_4 ();
+ check_mpz_5 ();
+ check_mpz_6 ();
+ check_mpz_7 ();
+ check_mpz_8 ();
+ check_mpz_9 ();
+ check_mpz_10 ();
+ check_mpz_11 ();
+ check_mpz_12 ();
+ check_mpz_13 ();
+ check_mpz_14 ();
+ check_mpz_15 ();
+ check_mpz_16 ();
+ check_mpz_17 ();
+ check_mpz_18 ();
+ check_mpz_19 ();
+ check_mpz_20 ();
+ check_mpz_21 ();
+ check_mpz_22 ();
+ check_mpz_23 ();
+ check_mpz_24 ();
+ check_mpz_25 ();
+ check_mpz_26 ();
+ check_mpz_27 ();
+ check_mpz_28 ();
+ check_mpz_29 ();
+ check_mpz_30 ();
+ check_mpz_31 ();
+ check_mpz_32 ();
+
+ check_mpq();
+ check_mpf();
+
+ tests_end();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/cxx/t-unary.cc b/vendor/gmp-6.3.0/tests/cxx/t-unary.cc
new file mode 100644
index 0000000..c7d8bf6
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/cxx/t-unary.cc
@@ -0,0 +1,132 @@
+/* Test mp*_class unary expressions.
+
+Copyright 2001-2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <iostream>
+
+#include "gmpxx.h"
+#include "gmp-impl.h"
+#include "tests.h"
+
+using namespace std;
+
+
+void
+check_mpz (void)
+{
+ // template <class T, class Op>
+ // __gmp_expr<T, __gmp_unary_expr<__gmp_expr<T, T>, Op> >
+ {
+ mpz_class a(1);
+ mpz_class b(+a); ASSERT_ALWAYS(b == 1);
+ }
+ {
+ mpz_class a(2);
+ mpz_class b;
+ b = -a; ASSERT_ALWAYS(b == -2);
+ }
+ {
+ mpz_class a(3);
+ mpz_class b;
+ b = ~a; ASSERT_ALWAYS(b == -4);
+ }
+
+ // template <class T, class U, class Op>
+ // __gmp_expr<T, __gmp_unary_expr<__gmp_expr<T, U>, Op> >
+ {
+ mpz_class a(1);
+ mpz_class b(-(-a)); ASSERT_ALWAYS(b == 1);
+ }
+ {
+ mpz_class a(2);
+ mpz_class b;
+ b = -(-(-a)); ASSERT_ALWAYS(b == -2);
+ }
+}
+
+void
+check_mpq (void)
+{
+ // template <class T, class Op>
+ // __gmp_expr<T, __gmp_unary_expr<__gmp_expr<T, T>, Op> >
+ {
+ mpq_class a(1);
+ mpq_class b(+a); ASSERT_ALWAYS(b == 1);
+ }
+ {
+ mpq_class a(2);
+ mpq_class b;
+ b = -a; ASSERT_ALWAYS(b == -2);
+ }
+
+ // template <class T, class U, class Op>
+ // __gmp_expr<T, __gmp_unary_expr<__gmp_expr<T, U>, Op> >
+ {
+ mpq_class a(1);
+ mpq_class b(-(-a)); ASSERT_ALWAYS(b == 1);
+ }
+ {
+ mpq_class a(2);
+ mpq_class b;
+ b = -(-(-a)); ASSERT_ALWAYS(b == -2);
+ }
+}
+
+void
+check_mpf (void)
+{
+ // template <class T, class Op>
+ // __gmp_expr<T, __gmp_unary_expr<__gmp_expr<T, T>, Op> >
+ {
+ mpf_class a(1);
+ mpf_class b(+a); ASSERT_ALWAYS(b == 1);
+ }
+ {
+ mpf_class a(2);
+ mpf_class b;
+ b = -a; ASSERT_ALWAYS(b == -2);
+ }
+
+ // template <class T, class U, class Op>
+ // __gmp_expr<T, __gmp_unary_expr<__gmp_expr<T, U>, Op> >
+ {
+ mpf_class a(1);
+ mpf_class b(-(-a)); ASSERT_ALWAYS(b == 1);
+ }
+ {
+ mpf_class a(2);
+ mpf_class b;
+ b = -(-(-a)); ASSERT_ALWAYS(b == -2);
+ }
+}
+
+
+int
+main (void)
+{
+ tests_start();
+
+ check_mpz();
+ check_mpq();
+ check_mpf();
+
+ tests_end();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/devel/Makefile.am b/vendor/gmp-6.3.0/tests/devel/Makefile.am
new file mode 100644
index 0000000..6c939a5
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/devel/Makefile.am
@@ -0,0 +1,47 @@
+## Process this file with automake to generate Makefile.in
+
+# Copyright 2000-2002, 2018 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+
+
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
+AM_LDFLAGS = -no-install
+LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
+
+EXTRA_PROGRAMS = \
+ sqrtrem_1_2 primes try test-add_ssaaaa test-sub_ddmmss
+
+EXTRA_DIST = gen-test-longlong_h.c
+
+allprogs: $(EXTRA_PROGRAMS)
+
+CLEANFILES = $(EXTRA_PROGRAMS)
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
+
+test-add_ssaaaa.c: gen-test-longlong_h$(EXEEXT_FOR_BUILD)
+ ./gen-test-longlong_h add >test-add_ssaaaa.c || (rm -f test-add_ssaaaa.c; exit 1)
+CLEANFILES += test-add_ssaaaa.c
+
+test-sub_ddmmss.c: gen-test-longlong_h$(EXEEXT_FOR_BUILD)
+ ./gen-test-longlong_h sub >test-sub_ddmmss.c || (rm -f test-sub_ddmmss.c; exit 1)
+CLEANFILES += test-sub_ddmmss.c
+
+gen-test-longlong_h$(EXEEXT_FOR_BUILD): gen-test-longlong_h.c
+ $(CC_FOR_BUILD) `test -f 'gen-test-longlong_h.c' || echo '$(srcdir)/'`gen-test-longlong_h.c -o gen-test-longlong_h$(EXEEXT_FOR_BUILD)
+CLEANFILES += gen-test-longlong_h$(EXEEXT_FOR_BUILD)
diff --git a/vendor/gmp-6.3.0/tests/devel/Makefile.in b/vendor/gmp-6.3.0/tests/devel/Makefile.in
new file mode 100644
index 0000000..b299954
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/devel/Makefile.in
@@ -0,0 +1,673 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 2000-2002, 2018 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+EXTRA_PROGRAMS = sqrtrem_1_2$(EXEEXT) primes$(EXEEXT) try$(EXEEXT) \
+ test-add_ssaaaa$(EXEEXT) test-sub_ddmmss$(EXEEXT)
+subdir = tests/devel
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+primes_SOURCES = primes.c
+primes_OBJECTS = primes.$(OBJEXT)
+primes_LDADD = $(LDADD)
+primes_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+sqrtrem_1_2_SOURCES = sqrtrem_1_2.c
+sqrtrem_1_2_OBJECTS = sqrtrem_1_2.$(OBJEXT)
+sqrtrem_1_2_LDADD = $(LDADD)
+sqrtrem_1_2_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+test_add_ssaaaa_SOURCES = test-add_ssaaaa.c
+test_add_ssaaaa_OBJECTS = test-add_ssaaaa.$(OBJEXT)
+test_add_ssaaaa_LDADD = $(LDADD)
+test_add_ssaaaa_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+test_sub_ddmmss_SOURCES = test-sub_ddmmss.c
+test_sub_ddmmss_OBJECTS = test-sub_ddmmss.$(OBJEXT)
+test_sub_ddmmss_LDADD = $(LDADD)
+test_sub_ddmmss_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+try_SOURCES = try.c
+try_OBJECTS = try.$(OBJEXT)
+try_LDADD = $(LDADD)
+try_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = primes.c sqrtrem_1_2.c test-add_ssaaaa.c test-sub_ddmmss.c \
+ try.c
+DIST_SOURCES = primes.c sqrtrem_1_2.c test-add_ssaaaa.c \
+ test-sub_ddmmss.c try.c
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in README
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ABI = @ABI@
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+ASMFLAGS = @ASMFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
+CC = @CC@
+CCAS = @CCAS@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPP_FOR_BUILD = @CPP_FOR_BUILD@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
+DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
+FGREP = @FGREP@
+GMP_LDFLAGS = @GMP_LDFLAGS@
+GMP_LIMB_BITS = @GMP_LIMB_BITS@
+GMP_NAIL_BITS = @GMP_NAIL_BITS@
+GREP = @GREP@
+HAVE_CLOCK_01 = @HAVE_CLOCK_01@
+HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@
+HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@
+HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@
+HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@
+HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@
+HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@
+HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
+HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
+HAVE_STACK_T_01 = @HAVE_STACK_T_01@
+HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBCURSES = @LIBCURSES@
+LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@
+LIBGMP_DLL = @LIBGMP_DLL@
+LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@
+LIBM = @LIBM@
+LIBM_FOR_BUILD = @LIBM_FOR_BUILD@
+LIBOBJS = @LIBOBJS@
+LIBREADLINE = @LIBREADLINE@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+M4 = @M4@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
+STRIP = @STRIP@
+TAL_OBJECT = @TAL_OBJECT@
+TUNE_LIBS = @TUNE_LIBS@
+TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U_FOR_BUILD = @U_FOR_BUILD@
+VERSION = @VERSION@
+WITH_READLINE_01 = @WITH_READLINE_01@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gmp_srclinks = @gmp_srclinks@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mpn_objects = @mpn_objects@
+mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
+AM_LDFLAGS = -no-install
+LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
+EXTRA_DIST = gen-test-longlong_h.c
+CLEANFILES = $(EXTRA_PROGRAMS) test-add_ssaaaa.c test-sub_ddmmss.c \
+ gen-test-longlong_h$(EXEEXT_FOR_BUILD)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/devel/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/devel/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+primes$(EXEEXT): $(primes_OBJECTS) $(primes_DEPENDENCIES) $(EXTRA_primes_DEPENDENCIES)
+ @rm -f primes$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(primes_OBJECTS) $(primes_LDADD) $(LIBS)
+
+sqrtrem_1_2$(EXEEXT): $(sqrtrem_1_2_OBJECTS) $(sqrtrem_1_2_DEPENDENCIES) $(EXTRA_sqrtrem_1_2_DEPENDENCIES)
+ @rm -f sqrtrem_1_2$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(sqrtrem_1_2_OBJECTS) $(sqrtrem_1_2_LDADD) $(LIBS)
+
+test-add_ssaaaa$(EXEEXT): $(test_add_ssaaaa_OBJECTS) $(test_add_ssaaaa_DEPENDENCIES) $(EXTRA_test_add_ssaaaa_DEPENDENCIES)
+ @rm -f test-add_ssaaaa$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_add_ssaaaa_OBJECTS) $(test_add_ssaaaa_LDADD) $(LIBS)
+
+test-sub_ddmmss$(EXEEXT): $(test_sub_ddmmss_OBJECTS) $(test_sub_ddmmss_DEPENDENCIES) $(EXTRA_test_sub_ddmmss_DEPENDENCIES)
+ @rm -f test-sub_ddmmss$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_sub_ddmmss_OBJECTS) $(test_sub_ddmmss_LDADD) $(LIBS)
+
+try$(EXEEXT): $(try_OBJECTS) $(try_DEPENDENCIES) $(EXTRA_try_DEPENDENCIES)
+ @rm -f try$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(try_OBJECTS) $(try_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+.c.o:
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+ $(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
+ clean-libtool cscopelist-am ctags ctags-am distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+allprogs: $(EXTRA_PROGRAMS)
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
+
+test-add_ssaaaa.c: gen-test-longlong_h$(EXEEXT_FOR_BUILD)
+ ./gen-test-longlong_h add >test-add_ssaaaa.c || (rm -f test-add_ssaaaa.c; exit 1)
+
+test-sub_ddmmss.c: gen-test-longlong_h$(EXEEXT_FOR_BUILD)
+ ./gen-test-longlong_h sub >test-sub_ddmmss.c || (rm -f test-sub_ddmmss.c; exit 1)
+
+gen-test-longlong_h$(EXEEXT_FOR_BUILD): gen-test-longlong_h.c
+ $(CC_FOR_BUILD) `test -f 'gen-test-longlong_h.c' || echo '$(srcdir)/'`gen-test-longlong_h.c -o gen-test-longlong_h$(EXEEXT_FOR_BUILD)
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/vendor/gmp-6.3.0/tests/devel/README b/vendor/gmp-6.3.0/tests/devel/README
new file mode 100644
index 0000000..77fa65d
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/devel/README
@@ -0,0 +1,37 @@
+Copyright 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+
+
+
+
+ DEVELOPMENT TEST PROGRAMS
+
+
+This directory contains various programs used during development. Casual
+GMP users are unlikely to find anything of interest.
+
+Nothing here is built or installed, nor even run in a "make check", but
+there's Makefile rules to build each program, or "allprogs" to build
+everything.
+
+
+
+----------------
+Local variables:
+mode: text
+fill-column: 76
+End:
diff --git a/vendor/gmp-6.3.0/tests/devel/gen-test-longlong_h.c b/vendor/gmp-6.3.0/tests/devel/gen-test-longlong_h.c
new file mode 100644
index 0000000..939c3f2
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/devel/gen-test-longlong_h.c
@@ -0,0 +1,140 @@
+/*
+Copyright 2020 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+typedef unsigned long mp_limb_t; /* neat */
+
+void
+one (const char *op, size_t ind, mp_limb_t m0, mp_limb_t s0)
+{
+ printf ("static void f%zu(mp_limb_t*r1p,mp_limb_t*r0p){", ind);
+ printf ("mp_limb_t r1,r0;");
+ printf ("%s(r1,r0,0,%ld,0,%ld);", op, (long) m0, (long) s0);
+ printf ("*r1p=r1;*r0p=r0;");
+ printf ("}\n");
+}
+
+mp_limb_t ops[1000];
+
+enum what_t {ADD, SUB};
+
+int
+main (int argc, char **argv)
+{
+ size_t n_operands = 0;
+ size_t n_functions = 0;
+ const char *op;
+ enum what_t what;
+
+ if (argc == 2 && strcmp (argv[1], "add") == 0)
+ {
+ op = "add_ssaaaa";
+ what = ADD;
+ }
+ else if (argc == 2 && strcmp (argv[1], "sub") == 0)
+ {
+ op = "sub_ddmmss";
+ what = SUB;
+ }
+ else
+ {
+ fprintf (stderr, "what do yuo want me to do?\n");
+ exit (1);
+ }
+
+ for (int i = 0; i < 16; i++)
+ {
+ ops[n_operands++] = 1 << i;
+ ops[n_operands++] = -(1 << i);
+ ops[n_operands++] = (1 << i) - 1;
+ ops[n_operands++] = -(1 << i) - 1;
+ }
+
+ printf ("#include <stdlib.h>\n");
+ printf ("#include <stdio.h>\n");
+ printf ("#include \"gmp-impl.h\"\n");
+ printf ("#include \"longlong.h\"\n");
+
+ /* Print out ops[] definition. */
+ printf ("static const int ops[%zu] = {\n", n_operands);
+ for (int i = 0; i < n_operands; i++)
+ {
+ printf ("%ld,", (long) ops[i]);
+ if ((i + 1) % 4 == 0)
+ puts ("");
+ }
+ printf ("};\n");
+
+ /* Generate functions and print them. */
+ for (int i = 0; i < n_operands; i++)
+ {
+ for (int j = 0; j < n_operands; j++)
+ {
+ one (op, n_functions++, ops[i], ops[j]);
+ }
+ }
+
+ /* Print out function pointer table. */
+ printf ("typedef void (*func_t) (mp_limb_t*, mp_limb_t*);\n");
+ printf ("static const func_t funcs[%zu] = {\n", n_functions);
+ for (size_t i = 0; i < n_functions; i++)
+ {
+ printf ("f%zu,", i);
+ if ((i + 1) % 16 == 0)
+ puts ("");
+ }
+ printf ("};\n");
+
+ /* Print out table of reference results. */
+ printf ("static const int ref[%zu][2] = {\n", n_functions);
+ for (int i = 0; i < n_operands; i++)
+ {
+ for (int j = 0; j < n_operands; j++)
+ {
+ if (what == ADD)
+ printf ("{%6ld,%2ld},", (long) ( ops[i] + ops[j]), (long) ((mp_limb_t) ((ops[i] + ops[j]) < ops[i])));
+ else /* SUB */
+ printf ("{%6ld,%2ld},", (long) ( ops[i] - ops[j]), (long) (-(mp_limb_t) (ops[i] < ops[j])));
+ if ((i * n_operands + j) % 8 == 0)
+ puts ("");
+ }
+ }
+ printf ("};\n");
+
+ printf ("int main ()\n{\n");
+ printf (" mp_limb_t r1, r0;\n");
+ printf (" int err = 0;\n");
+ printf (" size_t ind = 0;\n");
+ printf (" for (size_t i = 0; i < %zu; i++)\n", n_functions);
+ printf (" {\n");
+ printf (" int ii = i / %zu, jj = i %% %zu;\n", n_operands, n_operands);
+ printf (" funcs[i](&r1, &r0);\n");
+ printf (" if (r0 != (mp_limb_signed_t) ref[ind][0] || r1 != (mp_limb_signed_t) ref[ind][1]) {\n");
+ printf (" printf (\"error for f%%zu(%%d,%%d): want (%%d,%%d) got (%%d,%%d)\\n\", i, (int) ops[ii], (int) ops[jj], ref[ind][1], ref[ind][0], (int) r1, (int) r0);\n");
+ printf (" err++;\n");
+ printf (" }\n");
+ printf (" ind++;\n");
+ printf (" }\n");
+
+ printf (" return err != 0;\n");
+ printf ("}\n");
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/devel/primes.c b/vendor/gmp-6.3.0/tests/devel/primes.c
new file mode 100644
index 0000000..8e58962
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/devel/primes.c
@@ -0,0 +1,424 @@
+/*
+Copyright 2018-2020 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+/* Usage:
+
+ ./primes [p|c] [n0] <nMax>
+
+ Checks mpz_probab_prime_p(n, r) exhaustively, starting from n=n0
+ up to nMax.
+ If n0 * n0 > nMax, the intervall is sieved piecewise, else the
+ full intervall [0..nMax] is sieved at once.
+ With the parameter "p" (or nothing), tests all numbers. With "c"
+ only composites are tested.
+
+ ./primes n|N [n0] <nMax>
+
+ Checks mpz_nextprime() exhaustively, starting from n=n0 up to
+ nMax. With "n", only the sequence of primes is checked, with "N"
+ the function is tested on every number in the interval.
+
+ WARNING: The full intervall [0..nMax] is sieved at once, even if
+ only a piece is needed. This may require a lot of memory!
+
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "gmp-impl.h"
+#include "longlong.h"
+#include "tests.h"
+#define STOP(x) return (x)
+/* #define STOP(x) x */
+#define REPS 10
+/* #define TRACE(x,n) if ((n)>1) {x;} */
+#define TRACE(x,n)
+
+/* The full primesieve.c is included, just for block_resieve, that
+ is not exported ... */
+#undef gmp_primesieve
+#include "../../primesieve.c"
+
+#ifndef BLOCK_SIZE
+#define BLOCK_SIZE 2048
+#endif
+
+/*********************************************************/
+/* Section sieve: sieving functions and tools for primes */
+/*********************************************************/
+
+static mp_size_t
+primesieve_size (mp_limb_t n) { return n_fto_bit(n) / GMP_LIMB_BITS + 1; }
+
+/*************************************************************/
+/* Section macros: common macros, for swing/fac/bin (&sieve) */
+/*************************************************************/
+
+#define LOOP_ON_SIEVE_CONTINUE(prime,end) \
+ __max_i = (end); \
+ \
+ do { \
+ ++__i; \
+ if ((*__sieve & __mask) == 0) \
+ { \
+ mp_limb_t prime; \
+ prime = id_to_n(__i)
+
+#define LOOP_ON_SIEVE_BEGIN(prime,start,end,off,sieve) \
+ do { \
+ mp_limb_t __mask, *__sieve, __max_i, __i; \
+ \
+ __i = (start)-(off); \
+ __sieve = (sieve) + __i / GMP_LIMB_BITS; \
+ __mask = CNST_LIMB(1) << (__i % GMP_LIMB_BITS); \
+ __i += (off); \
+ \
+ LOOP_ON_SIEVE_CONTINUE(prime,end)
+
+#define LOOP_ON_SIEVE_STOP \
+ } \
+ __mask = __mask << 1 | __mask >> (GMP_LIMB_BITS-1); \
+ __sieve += __mask & 1; \
+ } while (__i <= __max_i)
+
+#define LOOP_ON_SIEVE_END \
+ LOOP_ON_SIEVE_STOP; \
+ } while (0)
+
+mpz_t g;
+
+int something_wrong (mpz_t er, int exp)
+{
+ fprintf (stderr, "value = %lu , expected = %i\n", mpz_get_ui (er), exp);
+ return -1;
+}
+
+int
+check_pprime (unsigned long begin, unsigned long end, int composites)
+{
+ begin = (begin / 6U) * 6U;
+ for (;(begin < 2) & (begin <= end); ++begin)
+ {
+ *(g->_mp_d) = begin;
+ TRACE(printf ("-%li ", begin),1);
+ if (mpz_probab_prime_p (g, REPS))
+ STOP (something_wrong (g, 0));
+ }
+ for (;(begin < 4) & (begin <= end); ++begin)
+ {
+ *(g->_mp_d) = begin;
+ TRACE(printf ("+%li ", begin),2);
+ if (!composites && !mpz_probab_prime_p (g, REPS))
+ STOP (something_wrong (g, 1));
+ }
+ if (end > 4) {
+ if ((end > 10000) && (begin > end / begin))
+ {
+ mp_limb_t *sieve, *primes;
+ mp_size_t size_s, size_p, off;
+ unsigned long start;
+
+ mpz_set_ui (g, end);
+ mpz_sqrt (g, g);
+ start = mpz_get_ui (g) + GMP_LIMB_BITS;
+ size_p = primesieve_size (start);
+
+ primes = __GMP_ALLOCATE_FUNC_LIMBS (size_p);
+ gmp_primesieve (primes, start);
+
+ size_s = BLOCK_SIZE * 2;
+ sieve = __GMP_ALLOCATE_FUNC_LIMBS (size_s);
+ off = n_cto_bit(begin);
+
+ do {
+ TRACE (printf ("off =%li\n", off),3);
+ block_resieve (sieve, BLOCK_SIZE, off, primes);
+ TRACE (printf ("LOOP =%li - %li\n", id_to_n (off+1), id_to_n (off + BLOCK_SIZE * GMP_LIMB_BITS)),3);
+ LOOP_ON_SIEVE_BEGIN (prime, off, off + BLOCK_SIZE * GMP_LIMB_BITS - 1,
+ off, sieve);
+
+ do {
+ *(g->_mp_d) = begin;
+ TRACE(printf ("-%li ", begin),1);
+ if (mpz_probab_prime_p (g, REPS))
+ STOP (something_wrong (g, 0));
+ if ((begin & 0xff) == 0)
+ {
+ spinner();
+ if ((begin & 0xfffffff) == 0)
+ printf ("%li (0x%lx)\n", begin, begin);
+ }
+ } while (++begin < prime);
+
+ *(g->_mp_d) = begin;
+ TRACE(printf ("+%li ", begin),2);
+ if (!composites && ! mpz_probab_prime_p (g, REPS))
+ STOP (something_wrong (g, 1));
+ ++begin;
+
+ LOOP_ON_SIEVE_END;
+ off += BLOCK_SIZE * GMP_LIMB_BITS;
+ } while (begin < end);
+
+ __GMP_FREE_FUNC_LIMBS (sieve, size_s);
+ __GMP_FREE_FUNC_LIMBS (primes, size_p);
+ }
+ else
+ {
+ mp_limb_t *sieve;
+ mp_size_t size;
+ unsigned long start;
+
+ size = primesieve_size (end);
+
+ sieve = __GMP_ALLOCATE_FUNC_LIMBS (size);
+ gmp_primesieve (sieve, end);
+ start = MAX (begin, 5) | 1;
+ LOOP_ON_SIEVE_BEGIN (prime, n_cto_bit(start),
+ n_fto_bit (end), 0, sieve);
+
+ do {
+ *(g->_mp_d) = begin;
+ TRACE(printf ("-%li ", begin),1);
+ if (mpz_probab_prime_p (g, REPS))
+ STOP (something_wrong (g, 0));
+ if ((begin & 0xff) == 0)
+ {
+ spinner();
+ if ((begin & 0xfffffff) == 0)
+ printf ("%li (0x%lx)\n", begin, begin);
+ }
+ } while (++begin < prime);
+
+ *(g->_mp_d) = begin;
+ TRACE(printf ("+%li ", begin),2);
+ if (!composites && ! mpz_probab_prime_p (g, REPS))
+ STOP (something_wrong (g, 1));
+ ++begin;
+
+ LOOP_ON_SIEVE_END;
+
+ __GMP_FREE_FUNC_LIMBS (sieve, size);
+ }
+ }
+
+ for (;begin < end; ++begin)
+ {
+ *(g->_mp_d) = begin;
+ TRACE(printf ("-%li ", begin),1);
+ if (mpz_probab_prime_p (g, REPS))
+ STOP (something_wrong (g, 0));
+ }
+
+ gmp_printf ("%Zd\n", g);
+ return 0;
+}
+
+int
+check_nprime (unsigned long begin, unsigned long end)
+{
+ if (begin < 2)
+ {
+ *(g->_mp_d) = begin;
+ g->_mp_size = begin;
+ TRACE(printf ("%li ", begin),1);
+ mpz_nextprime (g, g);
+ if (mpz_cmp_ui (g, 2) != 0)
+ STOP (something_wrong (g, 2));
+ begin = mpz_get_ui (g);
+ }
+ if (begin < 3)
+ {
+ *(g->_mp_d) = begin;
+ TRACE(printf ("%li ", begin),1);
+ mpz_nextprime (g, g);
+ if (mpz_cmp_ui (g, 3) != 0)
+ STOP (something_wrong (g, 3));
+ begin = mpz_get_ui (g);
+ }
+ if (end > 4)
+ {
+ mp_limb_t *sieve;
+ mp_size_t size;
+ unsigned long start;
+
+ size = primesieve_size (end);
+
+ sieve = __GMP_ALLOCATE_FUNC_LIMBS (size);
+ gmp_primesieve (sieve, end);
+ start = MAX (begin, 5) | 1;
+ *(g->_mp_d) = begin;
+ LOOP_ON_SIEVE_BEGIN (prime, n_cto_bit(start),
+ n_fto_bit (end), 0, sieve);
+
+ mpz_nextprime (g, g);
+ if (mpz_cmp_ui (g, prime) != 0)
+ STOP (something_wrong (g, prime));
+
+ if (prime - start > 200)
+ {
+ start = prime;
+ spinner();
+ if (prime - begin > 0xfffffff)
+ {
+ begin = prime;
+ printf ("%li (0x%lx)\n", begin, begin);
+ }
+ }
+
+ LOOP_ON_SIEVE_END;
+
+ __GMP_FREE_FUNC_LIMBS (sieve, size);
+ }
+
+ if (mpz_cmp_ui (g, end) < 0)
+ {
+ mpz_nextprime (g, g);
+ if (mpz_cmp_ui (g, end) <= 0)
+ STOP (something_wrong (g, -1));
+ }
+
+ gmp_printf ("%Zd\n", g);
+ return 0;
+}
+
+int
+check_Nprime (unsigned long begin, unsigned long end)
+{
+ mpz_t op;
+ mpz_init_set_ui (op, end);
+
+ for (;begin < 2; ++begin)
+ {
+ *(op->_mp_d) = begin;
+ op->_mp_size = begin;
+ TRACE(printf ("%li ", begin),1);
+ mpz_nextprime (g, op);
+ if (mpz_cmp_ui (g, 2) != 0)
+ STOP (something_wrong (g, 2));
+ }
+ if (begin < 3)
+ {
+ *(op->_mp_d) = begin;
+ TRACE(printf ("%li ", begin),1);
+ mpz_nextprime (g, op);
+ if (mpz_cmp_ui (g, 3) != 0)
+ STOP (something_wrong (g, 3));
+ begin = 3;
+ }
+ if (end > 4)
+ {
+ mp_limb_t *sieve;
+ mp_size_t size;
+ unsigned long start;
+ unsigned long opl;
+
+ size = primesieve_size (end);
+
+ sieve = __GMP_ALLOCATE_FUNC_LIMBS (size);
+ gmp_primesieve (sieve, end);
+ start = MAX (begin, 5) | 1;
+ opl = begin;
+ LOOP_ON_SIEVE_BEGIN (prime, n_cto_bit(start),
+ n_fto_bit (end), 0, sieve);
+
+ do {
+ *(op->_mp_d) = opl;
+ mpz_nextprime (g, op);
+ if (mpz_cmp_ui (g, prime) != 0)
+ STOP (something_wrong (g, prime));
+ ++opl;
+ } while (opl < prime);
+
+ if (prime - start > 200)
+ {
+ start = prime;
+ spinner();
+ if (prime - begin > 0xfffffff)
+ {
+ begin = prime;
+ printf ("%li (0x%lx)\n", begin, begin);
+ }
+ }
+
+ LOOP_ON_SIEVE_END;
+
+ __GMP_FREE_FUNC_LIMBS (sieve, size);
+ }
+
+ if (mpz_cmp_ui (g, end) < 0)
+ {
+ mpz_nextprime (g, g);
+ if (mpz_cmp_ui (g, end) <= 0)
+ STOP (something_wrong (g, -1));
+ }
+
+ gmp_printf ("%Zd\n", g);
+ return 0;
+}
+
+int
+main (int argc, char **argv)
+{
+ int ret, mode = 0;
+ unsigned long begin = 0, end = 0;
+
+ for (;argc > 1;--argc,++argv)
+ switch (*argv[1]) {
+ case 'p':
+ mode = 0;
+ break;
+ case 'c':
+ mode = 2;
+ break;
+ case 'n':
+ mode = 1;
+ break;
+ case 'N':
+ mode = 3;
+ break;
+ default:
+ begin = end;
+ end = atol (argv[1]);
+ }
+
+ if (begin >= end)
+ {
+ fprintf (stderr, "usage: primes [N|n|p|c] [n0] <nMax>\n");
+ exit (1);
+ }
+
+ mpz_init_set_ui (g, ULONG_MAX);
+
+ switch (mode) {
+ case 1:
+ ret = check_nprime (begin, end);
+ break;
+ case 3:
+ ret = check_Nprime (begin, end);
+ break;
+ default:
+ ret = check_pprime (begin, end, mode);
+ }
+
+ mpz_clear (g);
+
+ if (ret == 0)
+ printf ("Prime tests checked in [%lu - %lu] [0x%lx - 0x%lx].\n", begin, end, begin, end);
+ return ret;
+}
diff --git a/vendor/gmp-6.3.0/tests/devel/sqrtrem_1_2.c b/vendor/gmp-6.3.0/tests/devel/sqrtrem_1_2.c
new file mode 100644
index 0000000..3951191
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/devel/sqrtrem_1_2.c
@@ -0,0 +1,401 @@
+/*
+Copyright 2017 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+/* Usage:
+
+ ./sqrtrem_1_2 x
+
+ Checks mpn_sqrtrem() exhaustively, starting from 0, incrementing
+ the operand by a single unit, until all values handled by
+ mpn_sqrtrem{1,2} are tested. SLOW.
+
+ ./sqrtrem_1_2 s 1
+
+ Checks some special cases for mpn_sqrtrem(). I.e. values of the form
+ 2^k*i and 2^k*(i+1)-1, with k=2^n and 0<i<2^k, until all such values,
+ handled by mpn_sqrtrem{1,2}, are tested.
+ Currently supports only the test of values that fits in one limb.
+ Less slow than the exhaustive test.
+
+ ./sqrtrem_1_2 c
+
+ Checks all corner cases for mpn_sqrtrem(). I.e. values of the form
+ i*i and (i+1)*(i+1)-1, for each value of i, until all such values,
+ handled by mpn_sqrtrem{1,2}, are tested.
+ Slightly faster than the special cases test.
+
+ For larger values, use
+ ./try mpn_sqrtrem
+
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "gmp-impl.h"
+#include "longlong.h"
+#include "tests.h"
+#define STOP(x) return (x)
+/* #define STOP(x) x */
+#define SPINNER(v) \
+ do { \
+ MPN_SIZEINBASE_2EXP (spinner_count, q, v, 1); \
+ --spinner_count; \
+ spinner(); \
+ } while (0)
+
+int something_wrong (mp_limb_t er, mp_limb_t ec, mp_limb_t es)
+{
+ fprintf (stderr, "root = %lu , rem = {%lu , %lu}\n", (long unsigned) es,(long unsigned) ec,(long unsigned) er);
+ return -1;
+}
+
+int
+check_all_values (int justone, int quick)
+{
+ mp_limb_t es, mer, er, s[1], r[2], q[2];
+ mp_size_t x;
+ unsigned bits;
+
+ es=1;
+ if (quick) {
+ printf ("Quick, skipping some... (%u)\n", GMP_NUMB_BITS - 2);
+ es <<= GMP_NUMB_BITS / 2 - 1;
+ }
+ er=0;
+ mer= es << 1;
+ *q = es * es;
+ printf ("All values tested, up to bits:\n");
+ do {
+ x = mpn_sqrtrem (s, r, q, 1);
+ if (UNLIKELY (x != (er != 0)) || UNLIKELY (*s != es)
+ || UNLIKELY ((x == 1) && (er != *r)))
+ STOP (something_wrong (er, 0, es));
+
+ if (UNLIKELY (er == mer)) {
+ ++es;
+ if (UNLIKELY ((es & 0xff) == 0))
+ SPINNER(1);
+ mer +=2; /* mer = es * 2 */
+ er = 0;
+ } else
+ ++er;
+ ++*q;
+ } while (*q != 0);
+ q[1] = 1;
+ SPINNER(2);
+ printf ("\nValues of a single limb, tested.\n");
+ if (justone) return 0;
+ printf ("All values tested, up to bits:\n");
+ do {
+ x = mpn_sqrtrem (s, r, q, 2);
+ if (UNLIKELY (x != (er != 0)) || UNLIKELY (*s != es)
+ || UNLIKELY ((x == 1) && (er != *r)))
+ STOP (something_wrong (er, 0, es));
+
+ if (UNLIKELY (er == mer)) {
+ ++es;
+ if (UNLIKELY ((es & 0x7f) == 0))
+ SPINNER(2);
+ mer +=2; /* mer = es * 2 */
+ if (UNLIKELY (mer == 0))
+ break;
+ er = 0;
+ } else
+ ++er;
+ q[1] += (++*q == 0);
+ } while (1);
+ SPINNER(2);
+ printf ("\nValues with at most a limb for reminder, tested.\n");
+ printf ("Testing more values not supported, jet.\n");
+ return 0;
+}
+
+mp_limb_t
+upd (mp_limb_t *s, mp_limb_t k)
+{
+ mp_limb_t _s = *s;
+
+ while (k > _s * 2)
+ {
+ k -= _s * 2 + 1;
+ ++_s;
+ }
+ *s = _s;
+ return k;
+}
+
+mp_limb_t
+upd1 (mp_limb_t *s, mp_limb_t k)
+{
+ mp_limb_t _s = *s;
+
+ if (LIKELY (k < _s * 2)) return k + 1;
+ *s = _s + 1;
+ return k - _s * 2;
+}
+
+int
+check_some_values (int justone, int quick)
+{
+ mp_limb_t es, her, er, k, s[1], r[2], q[2];
+ mp_size_t x;
+ unsigned bits;
+
+ es = 1 << 1;
+ if (quick) {
+ es <<= GMP_NUMB_BITS / 4 - 1;
+ printf ("Quick, skipping some... (%u)\n", GMP_NUMB_BITS / 2);
+ }
+ er = 0;
+ *q = es * es;
+ printf ("High-half values tested, up to bits:\n");
+ do {
+ k = *q - 1;
+ do {
+ x = mpn_sqrtrem (s, r, q, 1);
+ if (UNLIKELY (x != (er != 0)) || UNLIKELY (*s != es)
+ || UNLIKELY ((x == 1) && (er != *r)))
+ STOP (something_wrong (er, 0, es));
+
+ if (UNLIKELY ((es & 0xffff) == 0))
+ SPINNER(1);
+ if ((*q & k) == 0) {
+ *q |= k;
+ er = upd (&es, k + er);
+ } else {
+ ++*q;
+ er = upd1 (&es, er);
+ }
+ } while (es & k);
+ } while (*q != 0);
+ q[1] = 1;
+ SPINNER(2);
+ printf ("\nValues of a single limb, tested.\n");
+ if (justone) return 0;
+ if (quick) {
+ es <<= GMP_NUMB_BITS / 2 - 1;
+ q[1] <<= GMP_NUMB_BITS - 2;
+ printf ("Quick, skipping some... (%u)\n", GMP_NUMB_BITS - 2);
+ }
+ printf ("High-half values tested, up to bits:\n");
+ do {
+ x = mpn_sqrtrem (s, r, q, 2);
+ if (UNLIKELY (x != (er != 0)) || UNLIKELY (*s != es)
+ || UNLIKELY ((x == 1) && (er != *r)))
+ STOP (something_wrong (er, 0, es));
+
+ if (*q == 0) {
+ *q = GMP_NUMB_MAX;
+ if (UNLIKELY ((es & 0xffff) == 0)) {
+ if (UNLIKELY (es == GMP_NUMB_HIGHBIT))
+ break;
+ SPINNER(2);
+ }
+ /* er = er + GMP_NUMB_MAX - 1 - es*2 // postponed */
+ ++es;
+ /* er = er + GMP_NUMB_MAX - 1 - 2*(es-1) =
+ = er +(GMP_NUMB_MAX + 1)- 2* es = er - 2*es */
+ er = upd (&es, er - 2 * es);
+ } else {
+ *q = 0;
+ ++q[1];
+ er = upd1 (&es, er);
+ }
+ } while (1);
+ SPINNER(2);
+ printf ("\nValues with at most a limb for reminder, tested.\n");
+ er = GMP_NUMB_MAX; her = 0;
+
+ printf ("High-half values tested, up to bits:\n");
+ do {
+ x = mpn_sqrtrem (s, r, q, 2);
+ if (UNLIKELY (x != (her?2:(er != 0))) || UNLIKELY (*s != es)
+ || UNLIKELY ((x != 0) && ((er != *r) || ((x == 2) && (r[1] != 1)))))
+ STOP (something_wrong (er, her, es));
+
+ if (*q == 0) {
+ *q = GMP_NUMB_MAX;
+ if (UNLIKELY ((es & 0xffff) == 0)) {
+ SPINNER(2);
+ }
+ if (her) {
+ ++es;
+ her = 0;
+ er = er - 2 * es;
+ } else {
+ her = --er != GMP_NUMB_MAX;
+ if (her & (er > es * 2)) {
+ er -= es * 2 + 1;
+ her = 0;
+ ++es;
+ }
+ }
+ } else {
+ *q = 0;
+ if (++q[1] == 0) break;
+ if ((her == 0) | (er < es * 2)) {
+ her += ++er == 0;
+ } else {
+ er -= es * 2;
+ her = 0;
+ ++es;
+ }
+ }
+ } while (1);
+ printf ("| %u\nValues of at most two limbs, tested.\n", GMP_NUMB_BITS*2);
+ return 0;
+}
+
+int
+check_corner_cases (int justone, int quick)
+{
+ mp_limb_t es, er, s[1], r[2], q[2];
+ mp_size_t x;
+ unsigned bits;
+
+ es = 1;
+ if (quick) {
+ es <<= GMP_NUMB_BITS / 2 - 1;
+ printf ("Quick, skipping some... (%u)\n", GMP_NUMB_BITS - 2);
+ }
+ er = 0;
+ *q = es*es;
+ printf ("Corner cases tested, up to bits:\n");
+ do {
+ x = mpn_sqrtrem (s, r, q, 1);
+ if (UNLIKELY (x != (er != 0)) || UNLIKELY (*s != es)
+ || UNLIKELY ((x == 1) && (er != *r)))
+ STOP (something_wrong (er, 0, es));
+
+ if (er != 0) {
+ ++es;
+ if (UNLIKELY ((es & 0xffff) == 0))
+ SPINNER(1);
+ er = 0;
+ ++*q;
+ } else {
+ er = es * 2;
+ *q += er;
+ }
+ } while (*q != 0);
+ q[1] = 1;
+ SPINNER(2);
+ printf ("\nValues of a single limb, tested.\n");
+ if (justone) return 0;
+ if (quick) {
+ es <<= GMP_NUMB_BITS / 2 - 1;
+ q[1] <<= GMP_NUMB_BITS - 2;
+ printf ("Quick, skipping some... (%u)\n", GMP_NUMB_BITS - 2);
+ --es;
+ --q[1];
+ q[0] -= es*2+1;
+ }
+ printf ("Corner cases tested, up to bits:\n");
+ do {
+ x = mpn_sqrtrem (s, r, q, 2);
+ if (UNLIKELY (x != (er != 0)) || UNLIKELY (*s != es)
+ || UNLIKELY ((x == 1) && (er != *r)))
+ STOP (something_wrong (er, 0, es));
+
+ if (er != 0) {
+ ++es;
+ if (UNLIKELY ((es & 0xff) == 0))
+ SPINNER(2);
+ er = 0;
+ q[1] += (++*q == 0);
+ if (UNLIKELY (es == GMP_NUMB_HIGHBIT))
+ break;
+ } else {
+ er = es * 2;
+ add_ssaaaa (q[1], *q, q[1], *q, 0, er);
+ }
+ } while (1);
+ SPINNER(2);
+ printf ("\nValues with at most a limb for reminder, tested.\nCorner cases tested, up to bits:\n");
+ x = mpn_sqrtrem (s, r, q, 2);
+ if ((*s != es) || (x != 0))
+ STOP (something_wrong (0, 0, es));
+ q[1] += 1;
+ x = mpn_sqrtrem (s, r, q, 2);
+ if ((*s != es) || (x != 2) || (*r != 0) || (r[1] != 1))
+ STOP (something_wrong (0, 1, es));
+ ++es;
+ q[1] += (++*q == 0);
+ do {
+ x = mpn_sqrtrem (s, r, q, 2);
+ if (UNLIKELY (x != (er != 0) * 2) || UNLIKELY (*s != es)
+ || UNLIKELY ((x == 2) && ((er != *r) || (r[1] != 1))))
+ STOP (something_wrong (er, er != 0, es));
+
+ if (er != 0) {
+ ++es;
+ if (UNLIKELY (es == 0))
+ break;
+ if (UNLIKELY ((es & 0xff) == 0))
+ SPINNER(2);
+ er = 0;
+ q[1] += (++*q == 0);
+ } else {
+ er = es * 2;
+ add_ssaaaa (q[1], *q, q[1], *q, 1, er);
+ }
+ } while (1);
+ printf ("| %u\nValues of at most two limbs, tested.\n", GMP_NUMB_BITS*2);
+ return 0;
+}
+
+int
+main (int argc, char **argv)
+{
+ int mode = 0;
+ int justone = 0;
+ int quick = 0;
+
+ for (;argc > 1;--argc,++argv)
+ switch (*argv[1]) {
+ default:
+ fprintf (stderr, "usage: sqrtrem_1_2 [x|c|s] [1|2] [q]\n");
+ exit (1);
+ case 'x':
+ mode = 0;
+ break;
+ case 'c':
+ mode = 1;
+ break;
+ case 's':
+ mode = 2;
+ break;
+ case 'q':
+ quick = 1;
+ break;
+ case '1':
+ justone = 1;
+ break;
+ case '2':
+ justone = 0;
+ }
+
+ switch (mode) {
+ default:
+ return check_all_values (justone, quick);
+ case 1:
+ return check_corner_cases (justone, quick);
+ case 2:
+ return check_some_values (justone, quick);
+ }
+}
diff --git a/vendor/gmp-6.3.0/tests/devel/try.c b/vendor/gmp-6.3.0/tests/devel/try.c
new file mode 100644
index 0000000..f8f4a1c
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/devel/try.c
@@ -0,0 +1,3658 @@
+/* Run some tests on various mpn routines.
+
+ THIS IS A TEST PROGRAM USED ONLY FOR DEVELOPMENT. IT'S ALMOST CERTAIN TO
+ BE SUBJECT TO INCOMPATIBLE CHANGES IN FUTURE VERSIONS OF GMP.
+
+Copyright 2000-2006, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+/* Usage: try [options] <function>...
+
+ For example, "./try mpn_add_n" to run tests of that function.
+
+ Combinations of alignments and overlaps are tested, with redzones above
+ or below the destinations, and with the sources write-protected.
+
+ The number of tests performed becomes ridiculously large with all the
+ combinations, and for that reason this can't be a part of a "make check",
+ it's meant only for development. The code isn't very pretty either.
+
+ During development it can help to disable the redzones, since seeing the
+ rest of the destination written can show where the wrong part is, or if
+ the dst pointers are off by 1 or whatever. The magic DEADVAL initial
+ fill (see below) will show locations never written.
+
+ The -s option can be used to test only certain size operands, which is
+ useful if some new code doesn't yet support say sizes less than the
+ unrolling, or whatever.
+
+ When a problem occurs it'll of course be necessary to run the program
+ under gdb to find out quite where, how and why it's going wrong. Disable
+ the spinner with the -W option when doing this, or single stepping won't
+ work. Using the "-1" option to run with simple data can be useful.
+
+ New functions to test can be added in try_array[]. If a new TYPE is
+ required then add it to the existing constants, set up its parameters in
+ param_init(), and add it to the call() function. Extra parameter fields
+ can be added if necessary, or further interpretations given to existing
+ fields.
+
+
+ Portability:
+
+ This program is not designed for use on Cray vector systems under Unicos,
+ it will fail to compile due to missing _SC_PAGE_SIZE. Those systems
+ don't really have pages or mprotect. We could arrange to run the tests
+ without the redzones, but we haven't bothered currently.
+
+
+ Enhancements:
+
+ umul_ppmm support is not very good, lots of source data is generated
+ whereas only two limbs are needed.
+
+ Make a little scheme for interpreting the "SIZE" selections uniformly.
+
+ Make tr->size==SIZE_2 work, for the benefit of find_a which wants just 2
+ source limbs. Possibly increase the default repetitions in that case.
+
+ Automatically detect gdb and disable the spinner (use -W for now).
+
+ Make a way to re-run a failing case in the debugger. Have an option to
+ snapshot each test case before it's run so the data is available if a
+ segv occurs. (This should be more reliable than the current print_all()
+ in the signal handler.)
+
+ When alignment means a dst isn't hard against the redzone, check the
+ space in between remains unchanged.
+
+ When a source overlaps a destination, don't run both s[i].high 0 and 1,
+ as s[i].high has no effect. Maybe encode s[i].high into overlap->s[i].
+
+ When partial overlaps aren't done, don't loop over source alignments
+ during overlaps.
+
+ Try to make the looping code a bit less horrible. Right now it's pretty
+ hard to see what iterations are actually done.
+
+ Perhaps specific setups and loops for each style of function under test
+ would be clearer than a parameterized general loop. There's lots of
+ stuff common to all functions, but the exceptions get messy.
+
+ When there's no overlap, run with both src>dst and src<dst. A subtle
+ calling-conventions violation occurred in a P6 copy which depended on the
+ relative location of src and dst.
+
+ multiplier_N is more or less a third source region for the addmul_N
+ routines, and could be done with the redzoned region scheme.
+
+*/
+
+
+/* always do assertion checking */
+#define WANT_ASSERT 1
+
+#include "config.h"
+
+#include <errno.h>
+#include <limits.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#if HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+
+#include "gmp-impl.h"
+#include "longlong.h"
+#include "tests.h"
+
+
+#if !HAVE_DECL_OPTARG
+extern char *optarg;
+extern int optind, opterr;
+#endif
+
+#if ! HAVE_DECL_SYS_NERR
+extern int sys_nerr;
+#endif
+
+#if ! HAVE_DECL_SYS_ERRLIST
+extern char *sys_errlist[];
+#endif
+
+#if ! HAVE_STRERROR
+char *
+strerror (int n)
+{
+ if (n < 0 || n >= sys_nerr)
+ return "errno out of range";
+ else
+ return sys_errlist[n];
+}
+#endif
+
+/* Rumour has it some systems lack a define of PROT_NONE. */
+#ifndef PROT_NONE
+#define PROT_NONE 0
+#endif
+
+/* Dummy defines for when mprotect doesn't exist. */
+#ifndef PROT_READ
+#define PROT_READ 0
+#endif
+#ifndef PROT_WRITE
+#define PROT_WRITE 0
+#endif
+
+/* _SC_PAGESIZE is standard, but hpux 9 and possibly other systems have
+ _SC_PAGE_SIZE instead. */
+#if defined (_SC_PAGE_SIZE) && ! defined (_SC_PAGESIZE)
+#define _SC_PAGESIZE _SC_PAGE_SIZE
+#endif
+
+
+#ifdef EXTRA_PROTOS
+EXTRA_PROTOS
+#endif
+#ifdef EXTRA_PROTOS2
+EXTRA_PROTOS2
+#endif
+
+
+#define DEFAULT_REPETITIONS 10
+
+int option_repetitions = DEFAULT_REPETITIONS;
+int option_spinner = 1;
+int option_redzones = 1;
+int option_firstsize = 0;
+int option_lastsize = 500;
+int option_firstsize2 = 0;
+
+#define ALIGNMENTS 4
+#define OVERLAPS 4
+#define CARRY_RANDOMS 5
+#define MULTIPLIER_RANDOMS 5
+#define DIVISOR_RANDOMS 5
+#define FRACTION_COUNT 4
+
+int option_print = 0;
+
+#define DATA_TRAND 0
+#define DATA_ZEROS 1
+#define DATA_SEQ 2
+#define DATA_FFS 3
+#define DATA_2FD 4
+int option_data = DATA_TRAND;
+
+
+mp_size_t pagesize;
+#define PAGESIZE_LIMBS (pagesize / GMP_LIMB_BYTES)
+
+/* must be a multiple of the page size */
+#define REDZONE_BYTES (pagesize * 16)
+#define REDZONE_LIMBS (REDZONE_BYTES / GMP_LIMB_BYTES)
+
+
+#define MAX3(x,y,z) (MAX (x, MAX (y, z)))
+
+#if GMP_LIMB_BITS == 32
+#define DEADVAL CNST_LIMB(0xDEADBEEF)
+#else
+#define DEADVAL CNST_LIMB(0xDEADBEEFBADDCAFE)
+#endif
+
+
+struct region_t {
+ mp_ptr ptr;
+ mp_size_t size;
+};
+
+
+#define TRAP_NOWHERE 0
+#define TRAP_REF 1
+#define TRAP_FUN 2
+#define TRAP_SETUPS 3
+int trap_location = TRAP_NOWHERE;
+
+
+#define NUM_SOURCES 5
+#define NUM_DESTS 2
+
+struct source_t {
+ struct region_t region;
+ int high;
+ mp_size_t align;
+ mp_ptr p;
+};
+
+struct source_t s[NUM_SOURCES];
+
+struct dest_t {
+ int high;
+ mp_size_t align;
+ mp_size_t size;
+};
+
+struct dest_t d[NUM_DESTS];
+
+struct source_each_t {
+ mp_ptr p;
+};
+
+struct dest_each_t {
+ struct region_t region;
+ mp_ptr p;
+};
+
+mp_size_t size;
+mp_size_t size2;
+unsigned long shift;
+mp_limb_t carry;
+mp_limb_t divisor;
+mp_limb_t multiplier;
+mp_limb_t multiplier_N[8];
+
+struct each_t {
+ const char *name;
+ struct dest_each_t d[NUM_DESTS];
+ struct source_each_t s[NUM_SOURCES];
+ mp_limb_t retval;
+};
+
+struct each_t ref = { "Ref" };
+struct each_t fun = { "Fun" };
+
+#define SRC_SIZE(n) ((n) == 1 && tr->size2 ? size2 : size)
+
+void validate_fail (void);
+
+
+#if HAVE_TRY_NEW_C
+#include "try-new.c"
+#endif
+
+
+typedef mp_limb_t (*tryfun_t) (ANYARGS);
+
+struct try_t {
+ char retval;
+
+ char src[NUM_SOURCES];
+ char dst[NUM_DESTS];
+
+#define SIZE_YES 1
+#define SIZE_ALLOW_ZERO 2
+#define SIZE_1 3 /* 1 limb */
+#define SIZE_2 4 /* 2 limbs */
+#define SIZE_3 5 /* 3 limbs */
+#define SIZE_4 6 /* 4 limbs */
+#define SIZE_6 7 /* 6 limbs */
+#define SIZE_FRACTION 8 /* size2 is fraction for divrem etc */
+#define SIZE_SIZE2 9
+#define SIZE_PLUS_1 10
+#define SIZE_SUM 11
+#define SIZE_DIFF 12
+#define SIZE_DIFF_PLUS_1 13
+#define SIZE_DIFF_PLUS_3 14
+#define SIZE_RETVAL 15
+#define SIZE_CEIL_HALF 16
+#define SIZE_GET_STR 17
+#define SIZE_PLUS_MSIZE_SUB_1 18 /* size+msize-1 */
+#define SIZE_ODD 19
+ char size;
+ char size2;
+ char dst_size[NUM_DESTS];
+
+ /* multiplier_N size in limbs */
+ mp_size_t msize;
+
+ char dst_bytes[NUM_DESTS];
+
+ char dst0_from_src1;
+
+#define CARRY_BIT 1 /* single bit 0 or 1 */
+#define CARRY_3 2 /* 0, 1, 2 */
+#define CARRY_4 3 /* 0 to 3 */
+#define CARRY_LIMB 4 /* any limb value */
+#define CARRY_DIVISOR 5 /* carry<divisor */
+ char carry;
+
+ /* a fudge to tell the output when to print negatives */
+ char carry_sign;
+
+ char multiplier;
+ char shift;
+
+#define DIVISOR_LIMB 1
+#define DIVISOR_NORM 2
+#define DIVISOR_ODD 3
+ char divisor;
+
+#define DATA_NON_ZERO 1
+#define DATA_GCD 2
+#define DATA_SRC0_ODD 3
+#define DATA_SRC0_HIGHBIT 4
+#define DATA_SRC1_ODD 5
+#define DATA_SRC1_ODD_PRIME 6
+#define DATA_SRC1_HIGHBIT 7
+#define DATA_MULTIPLE_DIVISOR 8
+#define DATA_UDIV_QRNND 9
+#define DATA_DIV_QR_1 10
+ char data;
+
+/* Default is allow full overlap. */
+#define OVERLAP_NONE 1
+#define OVERLAP_LOW_TO_HIGH 2
+#define OVERLAP_HIGH_TO_LOW 3
+#define OVERLAP_NOT_SRCS 4
+#define OVERLAP_NOT_SRC2 8
+#define OVERLAP_NOT_DST2 16
+ char overlap;
+
+ tryfun_t reference;
+ const char *reference_name;
+
+ void (*validate) (void);
+ const char *validate_name;
+};
+
+struct try_t *tr;
+
+
+void
+validate_mod_34lsub1 (void)
+{
+#define CNST_34LSUB1 ((CNST_LIMB(1) << (3 * (GMP_NUMB_BITS / 4))) - 1)
+
+ mp_srcptr ptr = s[0].p;
+ int error = 0;
+ mp_limb_t got, got_mod, want, want_mod;
+
+ ASSERT (size >= 1);
+
+ got = fun.retval;
+ got_mod = got % CNST_34LSUB1;
+
+ want = refmpn_mod_34lsub1 (ptr, size);
+ want_mod = want % CNST_34LSUB1;
+
+ if (got_mod != want_mod)
+ {
+ gmp_printf ("got 0x%MX reduced from 0x%MX\n", got_mod, got);
+ gmp_printf ("want 0x%MX reduced from 0x%MX\n", want_mod, want);
+ error = 1;
+ }
+
+ if (error)
+ validate_fail ();
+}
+
+void
+validate_divexact_1 (void)
+{
+ mp_srcptr src = s[0].p;
+ mp_srcptr dst = fun.d[0].p;
+ int error = 0;
+
+ ASSERT (size >= 1);
+
+ {
+ mp_ptr tp = refmpn_malloc_limbs (size);
+ mp_limb_t rem;
+
+ rem = refmpn_divrem_1 (tp, 0, src, size, divisor);
+ if (rem != 0)
+ {
+ gmp_printf ("Remainder a%%d == 0x%MX, mpn_divexact_1 undefined\n", rem);
+ error = 1;
+ }
+ if (! refmpn_equal_anynail (tp, dst, size))
+ {
+ printf ("Quotient a/d wrong\n");
+ mpn_trace ("fun ", dst, size);
+ mpn_trace ("want", tp, size);
+ error = 1;
+ }
+ free (tp);
+ }
+
+ if (error)
+ validate_fail ();
+}
+
+void
+validate_bdiv_q_1
+ (void)
+{
+ mp_srcptr src = s[0].p;
+ mp_srcptr dst = fun.d[0].p;
+ int error = 0;
+
+ ASSERT (size >= 1);
+
+ {
+ mp_ptr tp = refmpn_malloc_limbs (size + 1);
+
+ refmpn_mul_1 (tp, dst, size, divisor);
+ /* Set ignored low bits */
+ tp[0] |= (src[0] & LOW_ZEROS_MASK (divisor));
+ if (! refmpn_equal_anynail (tp, src, size))
+ {
+ printf ("Bdiv wrong: res * divisor != src (mod B^size)\n");
+ mpn_trace ("res ", dst, size);
+ mpn_trace ("src ", src, size);
+ error = 1;
+ }
+ free (tp);
+ }
+
+ if (error)
+ validate_fail ();
+}
+
+
+void
+validate_modexact_1c_odd (void)
+{
+ mp_srcptr ptr = s[0].p;
+ mp_limb_t r = fun.retval;
+ int error = 0;
+
+ ASSERT (size >= 1);
+ ASSERT (divisor & 1);
+
+ if ((r & GMP_NAIL_MASK) != 0)
+ printf ("r has non-zero nail\n");
+
+ if (carry < divisor)
+ {
+ if (! (r < divisor))
+ {
+ printf ("Don't have r < divisor\n");
+ error = 1;
+ }
+ }
+ else /* carry >= divisor */
+ {
+ if (! (r <= divisor))
+ {
+ printf ("Don't have r <= divisor\n");
+ error = 1;
+ }
+ }
+
+ {
+ mp_limb_t c = carry % divisor;
+ mp_ptr tp = refmpn_malloc_limbs (size+1);
+ mp_size_t k;
+
+ for (k = size-1; k <= size; k++)
+ {
+ /* set {tp,size+1} to r*b^k + a - c */
+ refmpn_copyi (tp, ptr, size);
+ tp[size] = 0;
+ ASSERT_NOCARRY (refmpn_add_1 (tp+k, tp+k, size+1-k, r));
+ if (refmpn_sub_1 (tp, tp, size+1, c))
+ ASSERT_CARRY (mpn_add_1 (tp, tp, size+1, divisor));
+
+ if (refmpn_mod_1 (tp, size+1, divisor) == 0)
+ goto good_remainder;
+ }
+ printf ("Remainder matches neither r*b^(size-1) nor r*b^size\n");
+ error = 1;
+
+ good_remainder:
+ free (tp);
+ }
+
+ if (error)
+ validate_fail ();
+}
+
+void
+validate_modexact_1_odd (void)
+{
+ carry = 0;
+ validate_modexact_1c_odd ();
+}
+
+void
+validate_div_qr_1_pi1 (void)
+{
+ mp_srcptr up = ref.s[0].p;
+ mp_size_t un = size;
+ mp_size_t uh = ref.s[1].p[0];
+ mp_srcptr qp = fun.d[0].p;
+ mp_limb_t r = fun.retval;
+ mp_limb_t cy;
+ int cmp;
+ mp_ptr tp;
+ if (r >= divisor)
+ {
+ gmp_printf ("Bad remainder %Md, d = %Md\n", r, divisor);
+ validate_fail ();
+ }
+ tp = refmpn_malloc_limbs (un);
+ cy = refmpn_mul_1 (tp, qp, un, divisor);
+ cy += refmpn_add_1 (tp, tp, un, r);
+ if (cy != uh || refmpn_cmp (tp, up, un) != 0)
+ {
+ gmp_printf ("Incorrect result, size %ld.\n"
+ "d = %Mx, u = %Mx, %Nx\n"
+ "got: r = %Mx, q = %Nx\n"
+ "q d + r = %Mx, %Nx",
+ (long) un,
+ divisor, uh, up, un,
+ r, qp, un,
+ cy, tp, un);
+ validate_fail ();
+ }
+ free (tp);
+}
+
+
+void
+validate_sqrtrem (void)
+{
+ mp_srcptr orig_ptr = s[0].p;
+ mp_size_t orig_size = size;
+ mp_size_t root_size = (size+1)/2;
+ mp_srcptr root_ptr = fun.d[0].p;
+ mp_size_t rem_size = fun.retval;
+ mp_srcptr rem_ptr = fun.d[1].p;
+ mp_size_t prod_size = 2*root_size;
+ mp_ptr p;
+ int error = 0;
+
+ if (rem_size < 0 || rem_size > size)
+ {
+ printf ("Bad remainder size retval %ld\n", (long) rem_size);
+ validate_fail ();
+ }
+
+ p = refmpn_malloc_limbs (prod_size);
+
+ p[root_size] = refmpn_lshift (p, root_ptr, root_size, 1);
+ if (refmpn_cmp_twosizes (p,root_size+1, rem_ptr,rem_size) < 0)
+ {
+ printf ("Remainder bigger than 2*root\n");
+ error = 1;
+ }
+
+ refmpn_sqr (p, root_ptr, root_size);
+ if (rem_size != 0)
+ refmpn_add (p, p, prod_size, rem_ptr, rem_size);
+ if (refmpn_cmp_twosizes (p,prod_size, orig_ptr,orig_size) != 0)
+ {
+ printf ("root^2+rem != original\n");
+ mpn_trace ("prod", p, prod_size);
+ error = 1;
+ }
+ free (p);
+
+ if (error)
+ validate_fail ();
+}
+
+void
+validate_sqrt (void)
+{
+ mp_srcptr orig_ptr = s[0].p;
+ mp_size_t orig_size = size;
+ mp_size_t root_size = (size+1)/2;
+ mp_srcptr root_ptr = fun.d[0].p;
+ int perf_pow = (fun.retval == 0);
+ mp_size_t prod_size = 2*root_size;
+ mp_ptr p;
+ int error = 0;
+
+ p = refmpn_malloc_limbs (prod_size);
+
+ refmpn_sqr (p, root_ptr, root_size);
+ MPN_NORMALIZE (p, prod_size);
+ if (refmpn_cmp_twosizes (p,prod_size, orig_ptr,orig_size) != - !perf_pow)
+ {
+ printf ("root^2 bigger than original, or wrong return value.\n");
+ mpn_trace ("prod...", p, prod_size);
+ error = 1;
+ }
+
+ refmpn_sub (p, orig_ptr,orig_size, p,prod_size);
+ MPN_NORMALIZE (p, prod_size);
+ if (prod_size >= root_size &&
+ refmpn_sub (p, p,prod_size, root_ptr, root_size) == 0 &&
+ refmpn_cmp_twosizes (p, prod_size, root_ptr, root_size) > 0)
+ {
+ printf ("(root+1)^2 smaller than original.\n");
+ mpn_trace ("prod", p, prod_size);
+ error = 1;
+ }
+ free (p);
+
+ if (error)
+ validate_fail ();
+}
+
+
+/* These types are indexes into the param[] array and are arbitrary so long
+ as they're all distinct and within the size of param[]. Renumber
+ whenever necessary or desired. */
+
+enum {
+ TYPE_ADD = 1, TYPE_ADD_N, TYPE_ADD_NC, TYPE_SUB, TYPE_SUB_N, TYPE_SUB_NC,
+
+ TYPE_ADD_ERR1_N, TYPE_ADD_ERR2_N, TYPE_ADD_ERR3_N,
+ TYPE_SUB_ERR1_N, TYPE_SUB_ERR2_N, TYPE_SUB_ERR3_N,
+
+ TYPE_MUL_1, TYPE_MUL_1C,
+
+ TYPE_MUL_2, TYPE_MUL_3, TYPE_MUL_4, TYPE_MUL_5, TYPE_MUL_6,
+
+ TYPE_ADDMUL_1, TYPE_ADDMUL_1C, TYPE_SUBMUL_1, TYPE_SUBMUL_1C,
+
+ TYPE_ADDMUL_2, TYPE_ADDMUL_3, TYPE_ADDMUL_4, TYPE_ADDMUL_5, TYPE_ADDMUL_6,
+ TYPE_ADDMUL_7, TYPE_ADDMUL_8,
+
+ TYPE_ADDSUB_N, TYPE_ADDSUB_NC,
+
+ TYPE_RSHIFT, TYPE_LSHIFT, TYPE_LSHIFTC,
+
+ TYPE_COPY, TYPE_COPYI, TYPE_COPYD, TYPE_COM,
+
+ TYPE_ADDLSH1_N, TYPE_ADDLSH2_N, TYPE_ADDLSH_N,
+ TYPE_ADDLSH1_N_IP1, TYPE_ADDLSH2_N_IP1, TYPE_ADDLSH_N_IP1,
+ TYPE_ADDLSH1_N_IP2, TYPE_ADDLSH2_N_IP2, TYPE_ADDLSH_N_IP2,
+ TYPE_SUBLSH1_N, TYPE_SUBLSH2_N, TYPE_SUBLSH_N,
+ TYPE_SUBLSH1_N_IP1, TYPE_SUBLSH2_N_IP1, TYPE_SUBLSH_N_IP1,
+ TYPE_RSBLSH1_N, TYPE_RSBLSH2_N, TYPE_RSBLSH_N,
+ TYPE_RSH1ADD_N, TYPE_RSH1SUB_N,
+
+ TYPE_ADDLSH1_NC, TYPE_ADDLSH2_NC, TYPE_ADDLSH_NC,
+ TYPE_SUBLSH1_NC, TYPE_SUBLSH2_NC, TYPE_SUBLSH_NC,
+ TYPE_RSBLSH1_NC, TYPE_RSBLSH2_NC, TYPE_RSBLSH_NC,
+
+ TYPE_ADDCND_N, TYPE_SUBCND_N,
+
+ TYPE_MOD_1, TYPE_MOD_1C, TYPE_DIVMOD_1, TYPE_DIVMOD_1C, TYPE_DIVREM_1,
+ TYPE_DIVREM_1C, TYPE_PREINV_DIVREM_1, TYPE_DIVREM_2, TYPE_PREINV_MOD_1,
+ TYPE_DIV_QR_1N_PI1,
+ TYPE_MOD_34LSUB1, TYPE_UDIV_QRNND, TYPE_UDIV_QRNND_R,
+
+ TYPE_DIVEXACT_1, TYPE_BDIV_Q_1, TYPE_DIVEXACT_BY3, TYPE_DIVEXACT_BY3C,
+ TYPE_MODEXACT_1_ODD, TYPE_MODEXACT_1C_ODD,
+
+ TYPE_INVERT, TYPE_BINVERT,
+
+ TYPE_GCD, TYPE_GCD_1, TYPE_GCD_FINDA, TYPE_MPZ_JACOBI, TYPE_MPZ_KRONECKER,
+ TYPE_MPZ_KRONECKER_UI, TYPE_MPZ_KRONECKER_SI, TYPE_MPZ_UI_KRONECKER,
+ TYPE_MPZ_SI_KRONECKER, TYPE_MPZ_LEGENDRE,
+
+ TYPE_AND_N, TYPE_NAND_N, TYPE_ANDN_N, TYPE_IOR_N, TYPE_IORN_N, TYPE_NIOR_N,
+ TYPE_XOR_N, TYPE_XNOR_N,
+
+ TYPE_MUL_MN, TYPE_MUL_N, TYPE_SQR, TYPE_UMUL_PPMM, TYPE_UMUL_PPMM_R,
+ TYPE_MULLO_N, TYPE_SQRLO, TYPE_MULMID_MN, TYPE_MULMID_N,
+
+ TYPE_SBPI1_DIV_QR, TYPE_TDIV_QR,
+
+ TYPE_SQRTREM, TYPE_SQRT, TYPE_ZERO, TYPE_GET_STR, TYPE_POPCOUNT, TYPE_HAMDIST,
+
+ TYPE_EXTRA
+};
+
+struct try_t param[TYPE_EXTRA];
+
+
+void
+param_init (void)
+{
+ struct try_t *p;
+
+#define COPY(index) memcpy (p, &param[index], sizeof (*p))
+
+#define REFERENCE(fun) \
+ p->reference = (tryfun_t) fun; \
+ p->reference_name = #fun
+#define VALIDATE(fun) \
+ p->validate = fun; \
+ p->validate_name = #fun
+
+
+ p = &param[TYPE_ADD_N];
+ p->retval = 1;
+ p->dst[0] = 1;
+ p->src[0] = 1;
+ p->src[1] = 1;
+ REFERENCE (refmpn_add_n);
+
+ p = &param[TYPE_ADD_NC];
+ COPY (TYPE_ADD_N);
+ p->carry = CARRY_BIT;
+ REFERENCE (refmpn_add_nc);
+
+ p = &param[TYPE_SUB_N];
+ COPY (TYPE_ADD_N);
+ REFERENCE (refmpn_sub_n);
+
+ p = &param[TYPE_SUB_NC];
+ COPY (TYPE_ADD_NC);
+ REFERENCE (refmpn_sub_nc);
+
+ p = &param[TYPE_ADD];
+ COPY (TYPE_ADD_N);
+ p->size = SIZE_ALLOW_ZERO;
+ p->size2 = 1;
+ REFERENCE (refmpn_add);
+
+ p = &param[TYPE_SUB];
+ COPY (TYPE_ADD);
+ REFERENCE (refmpn_sub);
+
+
+ p = &param[TYPE_ADD_ERR1_N];
+ p->retval = 1;
+ p->dst[0] = 1;
+ p->dst[1] = 1;
+ p->src[0] = 1;
+ p->src[1] = 1;
+ p->src[2] = 1;
+ p->dst_size[1] = SIZE_2;
+ p->carry = CARRY_BIT;
+ p->overlap = OVERLAP_NOT_DST2;
+ REFERENCE (refmpn_add_err1_n);
+
+ p = &param[TYPE_SUB_ERR1_N];
+ COPY (TYPE_ADD_ERR1_N);
+ REFERENCE (refmpn_sub_err1_n);
+
+ p = &param[TYPE_ADD_ERR2_N];
+ COPY (TYPE_ADD_ERR1_N);
+ p->src[3] = 1;
+ p->dst_size[1] = SIZE_4;
+ REFERENCE (refmpn_add_err2_n);
+
+ p = &param[TYPE_SUB_ERR2_N];
+ COPY (TYPE_ADD_ERR2_N);
+ REFERENCE (refmpn_sub_err2_n);
+
+ p = &param[TYPE_ADD_ERR3_N];
+ COPY (TYPE_ADD_ERR2_N);
+ p->src[4] = 1;
+ p->dst_size[1] = SIZE_6;
+ REFERENCE (refmpn_add_err3_n);
+
+ p = &param[TYPE_SUB_ERR3_N];
+ COPY (TYPE_ADD_ERR3_N);
+ REFERENCE (refmpn_sub_err3_n);
+
+ p = &param[TYPE_ADDCND_N];
+ COPY (TYPE_ADD_N);
+ p->carry = CARRY_BIT;
+ REFERENCE (refmpn_cnd_add_n);
+
+ p = &param[TYPE_SUBCND_N];
+ COPY (TYPE_ADD_N);
+ p->carry = CARRY_BIT;
+ REFERENCE (refmpn_cnd_sub_n);
+
+
+ p = &param[TYPE_MUL_1];
+ p->retval = 1;
+ p->dst[0] = 1;
+ p->src[0] = 1;
+ p->multiplier = 1;
+ p->overlap = OVERLAP_LOW_TO_HIGH;
+ REFERENCE (refmpn_mul_1);
+
+ p = &param[TYPE_MUL_1C];
+ COPY (TYPE_MUL_1);
+ p->carry = CARRY_LIMB;
+ REFERENCE (refmpn_mul_1c);
+
+
+ p = &param[TYPE_MUL_2];
+ p->retval = 1;
+ p->dst[0] = 1;
+ p->dst_size[0] = SIZE_PLUS_MSIZE_SUB_1;
+ p->src[0] = 1;
+ p->src[1] = 1;
+ p->msize = 2;
+ p->overlap = OVERLAP_NOT_SRC2;
+ REFERENCE (refmpn_mul_2);
+
+ p = &param[TYPE_MUL_3];
+ COPY (TYPE_MUL_2);
+ p->msize = 3;
+ REFERENCE (refmpn_mul_3);
+
+ p = &param[TYPE_MUL_4];
+ COPY (TYPE_MUL_2);
+ p->msize = 4;
+ REFERENCE (refmpn_mul_4);
+
+ p = &param[TYPE_MUL_5];
+ COPY (TYPE_MUL_2);
+ p->msize = 5;
+ REFERENCE (refmpn_mul_5);
+
+ p = &param[TYPE_MUL_6];
+ COPY (TYPE_MUL_2);
+ p->msize = 6;
+ REFERENCE (refmpn_mul_6);
+
+
+ p = &param[TYPE_ADDMUL_1];
+ p->retval = 1;
+ p->dst[0] = 1;
+ p->src[0] = 1;
+ p->multiplier = 1;
+ p->dst0_from_src1 = 1;
+ REFERENCE (refmpn_addmul_1);
+
+ p = &param[TYPE_ADDMUL_1C];
+ COPY (TYPE_ADDMUL_1);
+ p->carry = CARRY_LIMB;
+ REFERENCE (refmpn_addmul_1c);
+
+ p = &param[TYPE_SUBMUL_1];
+ COPY (TYPE_ADDMUL_1);
+ REFERENCE (refmpn_submul_1);
+
+ p = &param[TYPE_SUBMUL_1C];
+ COPY (TYPE_ADDMUL_1C);
+ REFERENCE (refmpn_submul_1c);
+
+
+ p = &param[TYPE_ADDMUL_2];
+ p->retval = 1;
+ p->dst[0] = 1;
+ p->dst_size[0] = SIZE_PLUS_MSIZE_SUB_1;
+ p->src[0] = 1;
+ p->src[1] = 1;
+ p->msize = 2;
+ p->dst0_from_src1 = 1;
+ p->overlap = OVERLAP_NONE;
+ REFERENCE (refmpn_addmul_2);
+
+ p = &param[TYPE_ADDMUL_3];
+ COPY (TYPE_ADDMUL_2);
+ p->msize = 3;
+ REFERENCE (refmpn_addmul_3);
+
+ p = &param[TYPE_ADDMUL_4];
+ COPY (TYPE_ADDMUL_2);
+ p->msize = 4;
+ REFERENCE (refmpn_addmul_4);
+
+ p = &param[TYPE_ADDMUL_5];
+ COPY (TYPE_ADDMUL_2);
+ p->msize = 5;
+ REFERENCE (refmpn_addmul_5);
+
+ p = &param[TYPE_ADDMUL_6];
+ COPY (TYPE_ADDMUL_2);
+ p->msize = 6;
+ REFERENCE (refmpn_addmul_6);
+
+ p = &param[TYPE_ADDMUL_7];
+ COPY (TYPE_ADDMUL_2);
+ p->msize = 7;
+ REFERENCE (refmpn_addmul_7);
+
+ p = &param[TYPE_ADDMUL_8];
+ COPY (TYPE_ADDMUL_2);
+ p->msize = 8;
+ REFERENCE (refmpn_addmul_8);
+
+
+ p = &param[TYPE_AND_N];
+ p->dst[0] = 1;
+ p->src[0] = 1;
+ p->src[1] = 1;
+ REFERENCE (refmpn_and_n);
+
+ p = &param[TYPE_ANDN_N];
+ COPY (TYPE_AND_N);
+ REFERENCE (refmpn_andn_n);
+
+ p = &param[TYPE_NAND_N];
+ COPY (TYPE_AND_N);
+ REFERENCE (refmpn_nand_n);
+
+ p = &param[TYPE_IOR_N];
+ COPY (TYPE_AND_N);
+ REFERENCE (refmpn_ior_n);
+
+ p = &param[TYPE_IORN_N];
+ COPY (TYPE_AND_N);
+ REFERENCE (refmpn_iorn_n);
+
+ p = &param[TYPE_NIOR_N];
+ COPY (TYPE_AND_N);
+ REFERENCE (refmpn_nior_n);
+
+ p = &param[TYPE_XOR_N];
+ COPY (TYPE_AND_N);
+ REFERENCE (refmpn_xor_n);
+
+ p = &param[TYPE_XNOR_N];
+ COPY (TYPE_AND_N);
+ REFERENCE (refmpn_xnor_n);
+
+
+ p = &param[TYPE_ADDSUB_N];
+ p->retval = 1;
+ p->dst[0] = 1;
+ p->dst[1] = 1;
+ p->src[0] = 1;
+ p->src[1] = 1;
+ REFERENCE (refmpn_add_n_sub_n);
+
+ p = &param[TYPE_ADDSUB_NC];
+ COPY (TYPE_ADDSUB_N);
+ p->carry = CARRY_4;
+ REFERENCE (refmpn_add_n_sub_nc);
+
+
+ p = &param[TYPE_COPY];
+ p->dst[0] = 1;
+ p->src[0] = 1;
+ p->overlap = OVERLAP_NONE;
+ p->size = SIZE_ALLOW_ZERO;
+ REFERENCE (refmpn_copy);
+
+ p = &param[TYPE_COPYI];
+ p->dst[0] = 1;
+ p->src[0] = 1;
+ p->overlap = OVERLAP_LOW_TO_HIGH;
+ p->size = SIZE_ALLOW_ZERO;
+ REFERENCE (refmpn_copyi);
+
+ p = &param[TYPE_COPYD];
+ p->dst[0] = 1;
+ p->src[0] = 1;
+ p->overlap = OVERLAP_HIGH_TO_LOW;
+ p->size = SIZE_ALLOW_ZERO;
+ REFERENCE (refmpn_copyd);
+
+ p = &param[TYPE_COM];
+ p->dst[0] = 1;
+ p->src[0] = 1;
+ REFERENCE (refmpn_com);
+
+
+ p = &param[TYPE_ADDLSH1_N];
+ COPY (TYPE_ADD_N);
+ REFERENCE (refmpn_addlsh1_n);
+
+ p = &param[TYPE_ADDLSH2_N];
+ COPY (TYPE_ADD_N);
+ REFERENCE (refmpn_addlsh2_n);
+
+ p = &param[TYPE_ADDLSH_N];
+ COPY (TYPE_ADD_N);
+ p->shift = 1;
+ REFERENCE (refmpn_addlsh_n);
+
+ p = &param[TYPE_ADDLSH1_N_IP1];
+ p->retval = 1;
+ p->dst[0] = 1;
+ p->src[0] = 1;
+ p->dst0_from_src1 = 1;
+ REFERENCE (refmpn_addlsh1_n_ip1);
+
+ p = &param[TYPE_ADDLSH2_N_IP1];
+ COPY (TYPE_ADDLSH1_N_IP1);
+ REFERENCE (refmpn_addlsh2_n_ip1);
+
+ p = &param[TYPE_ADDLSH_N_IP1];
+ COPY (TYPE_ADDLSH1_N_IP1);
+ p->shift = 1;
+ REFERENCE (refmpn_addlsh_n_ip1);
+
+ p = &param[TYPE_ADDLSH1_N_IP2];
+ COPY (TYPE_ADDLSH1_N_IP1);
+ REFERENCE (refmpn_addlsh1_n_ip2);
+
+ p = &param[TYPE_ADDLSH2_N_IP2];
+ COPY (TYPE_ADDLSH1_N_IP1);
+ REFERENCE (refmpn_addlsh2_n_ip2);
+
+ p = &param[TYPE_ADDLSH_N_IP2];
+ COPY (TYPE_ADDLSH_N_IP1);
+ REFERENCE (refmpn_addlsh_n_ip2);
+
+ p = &param[TYPE_SUBLSH1_N];
+ COPY (TYPE_ADD_N);
+ REFERENCE (refmpn_sublsh1_n);
+
+ p = &param[TYPE_SUBLSH2_N];
+ COPY (TYPE_ADD_N);
+ REFERENCE (refmpn_sublsh2_n);
+
+ p = &param[TYPE_SUBLSH_N];
+ COPY (TYPE_ADDLSH_N);
+ REFERENCE (refmpn_sublsh_n);
+
+ p = &param[TYPE_SUBLSH1_N_IP1];
+ COPY (TYPE_ADDLSH1_N_IP1);
+ REFERENCE (refmpn_sublsh1_n_ip1);
+
+ p = &param[TYPE_SUBLSH2_N_IP1];
+ COPY (TYPE_ADDLSH1_N_IP1);
+ REFERENCE (refmpn_sublsh2_n_ip1);
+
+ p = &param[TYPE_SUBLSH_N_IP1];
+ COPY (TYPE_ADDLSH_N_IP1);
+ REFERENCE (refmpn_sublsh_n_ip1);
+
+ p = &param[TYPE_RSBLSH1_N];
+ COPY (TYPE_ADD_N);
+ REFERENCE (refmpn_rsblsh1_n);
+
+ p = &param[TYPE_RSBLSH2_N];
+ COPY (TYPE_ADD_N);
+ REFERENCE (refmpn_rsblsh2_n);
+
+ p = &param[TYPE_RSBLSH_N];
+ COPY (TYPE_ADDLSH_N);
+ REFERENCE (refmpn_rsblsh_n);
+
+ p = &param[TYPE_RSH1ADD_N];
+ COPY (TYPE_ADD_N);
+ REFERENCE (refmpn_rsh1add_n);
+
+ p = &param[TYPE_RSH1SUB_N];
+ COPY (TYPE_ADD_N);
+ REFERENCE (refmpn_rsh1sub_n);
+
+
+ p = &param[TYPE_ADDLSH1_NC];
+ COPY (TYPE_ADDLSH1_N);
+ p->carry = CARRY_3;
+ REFERENCE (refmpn_addlsh1_nc);
+
+ p = &param[TYPE_ADDLSH2_NC];
+ COPY (TYPE_ADDLSH2_N);
+ p->carry = CARRY_4; /* FIXME */
+ REFERENCE (refmpn_addlsh2_nc);
+
+ p = &param[TYPE_ADDLSH_NC];
+ COPY (TYPE_ADDLSH_N);
+ p->carry = CARRY_BIT; /* FIXME */
+ REFERENCE (refmpn_addlsh_nc);
+
+ p = &param[TYPE_SUBLSH1_NC];
+ COPY (TYPE_ADDLSH1_NC);
+ REFERENCE (refmpn_sublsh1_nc);
+
+ p = &param[TYPE_SUBLSH2_NC];
+ COPY (TYPE_ADDLSH2_NC);
+ REFERENCE (refmpn_sublsh2_nc);
+
+ p = &param[TYPE_SUBLSH_NC];
+ COPY (TYPE_ADDLSH_NC);
+ REFERENCE (refmpn_sublsh_nc);
+
+ p = &param[TYPE_RSBLSH1_NC];
+ COPY (TYPE_RSBLSH1_N);
+ p->carry = CARRY_BIT; /* FIXME */
+ REFERENCE (refmpn_rsblsh1_nc);
+
+ p = &param[TYPE_RSBLSH2_NC];
+ COPY (TYPE_RSBLSH2_N);
+ p->carry = CARRY_4; /* FIXME */
+ REFERENCE (refmpn_rsblsh2_nc);
+
+ p = &param[TYPE_RSBLSH_NC];
+ COPY (TYPE_RSBLSH_N);
+ p->carry = CARRY_BIT; /* FIXME */
+ REFERENCE (refmpn_rsblsh_nc);
+
+
+ p = &param[TYPE_MOD_1];
+ p->retval = 1;
+ p->src[0] = 1;
+ p->size = SIZE_ALLOW_ZERO;
+ p->divisor = DIVISOR_LIMB;
+ REFERENCE (refmpn_mod_1);
+
+ p = &param[TYPE_MOD_1C];
+ COPY (TYPE_MOD_1);
+ p->carry = CARRY_DIVISOR;
+ REFERENCE (refmpn_mod_1c);
+
+ p = &param[TYPE_DIVMOD_1];
+ COPY (TYPE_MOD_1);
+ p->dst[0] = 1;
+ REFERENCE (refmpn_divmod_1);
+
+ p = &param[TYPE_DIVMOD_1C];
+ COPY (TYPE_DIVMOD_1);
+ p->carry = CARRY_DIVISOR;
+ REFERENCE (refmpn_divmod_1c);
+
+ p = &param[TYPE_DIVREM_1];
+ COPY (TYPE_DIVMOD_1);
+ p->size2 = SIZE_FRACTION;
+ p->dst_size[0] = SIZE_SUM;
+ REFERENCE (refmpn_divrem_1);
+
+ p = &param[TYPE_DIVREM_1C];
+ COPY (TYPE_DIVREM_1);
+ p->carry = CARRY_DIVISOR;
+ REFERENCE (refmpn_divrem_1c);
+
+ p = &param[TYPE_PREINV_DIVREM_1];
+ COPY (TYPE_DIVREM_1);
+ p->size = SIZE_YES; /* ie. no size==0 */
+ REFERENCE (refmpn_preinv_divrem_1);
+
+ p = &param[TYPE_DIV_QR_1N_PI1];
+ p->retval = 1;
+ p->src[0] = 1;
+ p->src[1] = 1;
+ /* SIZE_1 not supported. Always uses low limb only. */
+ p->size2 = 1;
+ p->dst[0] = 1;
+ p->divisor = DIVISOR_NORM;
+ p->data = DATA_DIV_QR_1;
+ VALIDATE (validate_div_qr_1_pi1);
+
+ p = &param[TYPE_PREINV_MOD_1];
+ p->retval = 1;
+ p->src[0] = 1;
+ p->divisor = DIVISOR_NORM;
+ REFERENCE (refmpn_preinv_mod_1);
+
+ p = &param[TYPE_MOD_34LSUB1];
+ p->retval = 1;
+ p->src[0] = 1;
+ VALIDATE (validate_mod_34lsub1);
+
+ p = &param[TYPE_UDIV_QRNND];
+ p->retval = 1;
+ p->src[0] = 1;
+ p->dst[0] = 1;
+ p->dst_size[0] = SIZE_1;
+ p->divisor = UDIV_NEEDS_NORMALIZATION ? DIVISOR_NORM : DIVISOR_LIMB;
+ p->data = DATA_UDIV_QRNND;
+ p->overlap = OVERLAP_NONE;
+ REFERENCE (refmpn_udiv_qrnnd);
+
+ p = &param[TYPE_UDIV_QRNND_R];
+ COPY (TYPE_UDIV_QRNND);
+ REFERENCE (refmpn_udiv_qrnnd_r);
+
+
+ p = &param[TYPE_DIVEXACT_1];
+ p->dst[0] = 1;
+ p->src[0] = 1;
+ p->divisor = DIVISOR_LIMB;
+ p->data = DATA_MULTIPLE_DIVISOR;
+ VALIDATE (validate_divexact_1);
+ REFERENCE (refmpn_divmod_1);
+
+ p = &param[TYPE_BDIV_Q_1];
+ p->dst[0] = 1;
+ p->src[0] = 1;
+ p->divisor = DIVISOR_LIMB;
+ VALIDATE (validate_bdiv_q_1);
+
+ p = &param[TYPE_DIVEXACT_BY3];
+ p->retval = 1;
+ p->dst[0] = 1;
+ p->src[0] = 1;
+ REFERENCE (refmpn_divexact_by3);
+
+ p = &param[TYPE_DIVEXACT_BY3C];
+ COPY (TYPE_DIVEXACT_BY3);
+ p->carry = CARRY_3;
+ REFERENCE (refmpn_divexact_by3c);
+
+
+ p = &param[TYPE_MODEXACT_1_ODD];
+ p->retval = 1;
+ p->src[0] = 1;
+ p->divisor = DIVISOR_ODD;
+ VALIDATE (validate_modexact_1_odd);
+
+ p = &param[TYPE_MODEXACT_1C_ODD];
+ COPY (TYPE_MODEXACT_1_ODD);
+ p->carry = CARRY_LIMB;
+ VALIDATE (validate_modexact_1c_odd);
+
+
+ p = &param[TYPE_GCD_1];
+ p->retval = 1;
+ p->src[0] = 1;
+ p->data = DATA_NON_ZERO;
+ p->divisor = DIVISOR_LIMB;
+ REFERENCE (refmpn_gcd_1);
+
+ p = &param[TYPE_GCD];
+ p->retval = 1;
+ p->dst[0] = 1;
+ p->src[0] = 1;
+ p->src[1] = 1;
+ p->size2 = 1;
+ p->dst_size[0] = SIZE_RETVAL;
+ p->overlap = OVERLAP_NOT_SRCS;
+ p->data = DATA_GCD;
+ REFERENCE (refmpn_gcd);
+
+
+ p = &param[TYPE_MPZ_LEGENDRE];
+ p->retval = 1;
+ p->src[0] = 1;
+ p->size = SIZE_ALLOW_ZERO;
+ p->src[1] = 1;
+ p->data = DATA_SRC1_ODD_PRIME;
+ p->size2 = 1;
+ p->carry = CARRY_BIT;
+ p->carry_sign = 1;
+ REFERENCE (refmpz_legendre);
+
+ p = &param[TYPE_MPZ_JACOBI];
+ p->retval = 1;
+ p->src[0] = 1;
+ p->size = SIZE_ALLOW_ZERO;
+ p->src[1] = 1;
+ p->data = DATA_SRC1_ODD;
+ p->size2 = 1;
+ p->carry = CARRY_BIT;
+ p->carry_sign = 1;
+ REFERENCE (refmpz_jacobi);
+
+ p = &param[TYPE_MPZ_KRONECKER];
+ p->retval = 1;
+ p->src[0] = 1;
+ p->size = SIZE_ALLOW_ZERO;
+ p->src[1] = 1;
+ p->data = 0;
+ p->size2 = 1;
+ p->carry = CARRY_4;
+ p->carry_sign = 1;
+ REFERENCE (refmpz_kronecker);
+
+
+ p = &param[TYPE_MPZ_KRONECKER_UI];
+ p->retval = 1;
+ p->src[0] = 1;
+ p->size = SIZE_ALLOW_ZERO;
+ p->multiplier = 1;
+ p->carry = CARRY_BIT;
+ REFERENCE (refmpz_kronecker_ui);
+
+ p = &param[TYPE_MPZ_KRONECKER_SI];
+ COPY (TYPE_MPZ_KRONECKER_UI);
+ REFERENCE (refmpz_kronecker_si);
+
+ p = &param[TYPE_MPZ_UI_KRONECKER];
+ COPY (TYPE_MPZ_KRONECKER_UI);
+ REFERENCE (refmpz_ui_kronecker);
+
+ p = &param[TYPE_MPZ_SI_KRONECKER];
+ COPY (TYPE_MPZ_KRONECKER_UI);
+ REFERENCE (refmpz_si_kronecker);
+
+
+ p = &param[TYPE_SQR];
+ p->dst[0] = 1;
+ p->src[0] = 1;
+ p->dst_size[0] = SIZE_SUM;
+ p->overlap = OVERLAP_NONE;
+ REFERENCE (refmpn_sqr);
+
+ p = &param[TYPE_MUL_N];
+ COPY (TYPE_SQR);
+ p->src[1] = 1;
+ REFERENCE (refmpn_mul_n);
+
+ p = &param[TYPE_MULLO_N];
+ COPY (TYPE_MUL_N);
+ p->dst_size[0] = 0;
+ REFERENCE (refmpn_mullo_n);
+
+ p = &param[TYPE_SQRLO];
+ COPY (TYPE_SQR);
+ p->dst_size[0] = 0;
+ REFERENCE (refmpn_sqrlo);
+
+ p = &param[TYPE_MUL_MN];
+ COPY (TYPE_MUL_N);
+ p->size2 = 1;
+ REFERENCE (refmpn_mul_basecase);
+
+ p = &param[TYPE_MULMID_MN];
+ COPY (TYPE_MUL_MN);
+ p->dst_size[0] = SIZE_DIFF_PLUS_3;
+ REFERENCE (refmpn_mulmid_basecase);
+
+ p = &param[TYPE_MULMID_N];
+ COPY (TYPE_MUL_N);
+ p->size = SIZE_ODD;
+ p->size2 = SIZE_CEIL_HALF;
+ p->dst_size[0] = SIZE_DIFF_PLUS_3;
+ REFERENCE (refmpn_mulmid_n);
+
+ p = &param[TYPE_UMUL_PPMM];
+ p->retval = 1;
+ p->src[0] = 1;
+ p->dst[0] = 1;
+ p->dst_size[0] = SIZE_1;
+ p->overlap = OVERLAP_NONE;
+ REFERENCE (refmpn_umul_ppmm);
+
+ p = &param[TYPE_UMUL_PPMM_R];
+ COPY (TYPE_UMUL_PPMM);
+ REFERENCE (refmpn_umul_ppmm_r);
+
+
+ p = &param[TYPE_RSHIFT];
+ p->retval = 1;
+ p->dst[0] = 1;
+ p->src[0] = 1;
+ p->shift = 1;
+ p->overlap = OVERLAP_LOW_TO_HIGH;
+ REFERENCE (refmpn_rshift);
+
+ p = &param[TYPE_LSHIFT];
+ COPY (TYPE_RSHIFT);
+ p->overlap = OVERLAP_HIGH_TO_LOW;
+ REFERENCE (refmpn_lshift);
+
+ p = &param[TYPE_LSHIFTC];
+ COPY (TYPE_RSHIFT);
+ p->overlap = OVERLAP_HIGH_TO_LOW;
+ REFERENCE (refmpn_lshiftc);
+
+
+ p = &param[TYPE_POPCOUNT];
+ p->retval = 1;
+ p->src[0] = 1;
+ REFERENCE (refmpn_popcount);
+
+ p = &param[TYPE_HAMDIST];
+ COPY (TYPE_POPCOUNT);
+ p->src[1] = 1;
+ REFERENCE (refmpn_hamdist);
+
+
+ p = &param[TYPE_SBPI1_DIV_QR];
+ p->retval = 1;
+ p->dst[0] = 1;
+ p->dst[1] = 1;
+ p->src[0] = 1;
+ p->src[1] = 1;
+ p->data = DATA_SRC1_HIGHBIT;
+ p->size2 = 1;
+ p->dst_size[0] = SIZE_DIFF;
+ p->overlap = OVERLAP_NONE;
+ REFERENCE (refmpn_sb_div_qr);
+
+ p = &param[TYPE_TDIV_QR];
+ p->dst[0] = 1;
+ p->dst[1] = 1;
+ p->src[0] = 1;
+ p->src[1] = 1;
+ p->size2 = 1;
+ p->dst_size[0] = SIZE_DIFF_PLUS_1;
+ p->dst_size[1] = SIZE_SIZE2;
+ p->overlap = OVERLAP_NONE;
+ REFERENCE (refmpn_tdiv_qr);
+
+ p = &param[TYPE_SQRTREM];
+ p->retval = 1;
+ p->dst[0] = 1;
+ p->dst[1] = 1;
+ p->src[0] = 1;
+ p->dst_size[0] = SIZE_CEIL_HALF;
+ p->dst_size[1] = SIZE_RETVAL;
+ p->overlap = OVERLAP_NONE;
+ VALIDATE (validate_sqrtrem);
+ REFERENCE (refmpn_sqrtrem);
+
+ p = &param[TYPE_SQRT];
+ p->retval = 1;
+ p->dst[0] = 1;
+ p->dst[1] = 0;
+ p->src[0] = 1;
+ p->dst_size[0] = SIZE_CEIL_HALF;
+ p->overlap = OVERLAP_NONE;
+ VALIDATE (validate_sqrt);
+
+ p = &param[TYPE_ZERO];
+ p->dst[0] = 1;
+ p->size = SIZE_ALLOW_ZERO;
+ REFERENCE (refmpn_zero);
+
+ p = &param[TYPE_GET_STR];
+ p->retval = 1;
+ p->src[0] = 1;
+ p->size = SIZE_ALLOW_ZERO;
+ p->dst[0] = 1;
+ p->dst[1] = 1;
+ p->dst_size[0] = SIZE_GET_STR;
+ p->dst_bytes[0] = 1;
+ p->overlap = OVERLAP_NONE;
+ REFERENCE (refmpn_get_str);
+
+ p = &param[TYPE_BINVERT];
+ p->dst[0] = 1;
+ p->src[0] = 1;
+ p->data = DATA_SRC0_ODD;
+ p->overlap = OVERLAP_NONE;
+ REFERENCE (refmpn_binvert);
+
+ p = &param[TYPE_INVERT];
+ p->dst[0] = 1;
+ p->src[0] = 1;
+ p->data = DATA_SRC0_HIGHBIT;
+ p->overlap = OVERLAP_NONE;
+ REFERENCE (refmpn_invert);
+
+#ifdef EXTRA_PARAM_INIT
+ EXTRA_PARAM_INIT
+#endif
+}
+
+
+/* The following are macros if there's no native versions, so wrap them in
+ functions that can be in try_array[]. */
+
+void
+MPN_COPY_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{ MPN_COPY (rp, sp, size); }
+
+void
+MPN_COPY_INCR_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{ MPN_COPY_INCR (rp, sp, size); }
+
+void
+MPN_COPY_DECR_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{ MPN_COPY_DECR (rp, sp, size); }
+
+void
+__GMPN_COPY_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{ __GMPN_COPY (rp, sp, size); }
+
+#ifdef __GMPN_COPY_INCR
+void
+__GMPN_COPY_INCR_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{ __GMPN_COPY_INCR (rp, sp, size); }
+#endif
+
+void
+mpn_com_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{ mpn_com (rp, sp, size); }
+
+void
+mpn_and_n_fun (mp_ptr rp, mp_srcptr s1, mp_srcptr s2, mp_size_t size)
+{ mpn_and_n (rp, s1, s2, size); }
+
+void
+mpn_andn_n_fun (mp_ptr rp, mp_srcptr s1, mp_srcptr s2, mp_size_t size)
+{ mpn_andn_n (rp, s1, s2, size); }
+
+void
+mpn_nand_n_fun (mp_ptr rp, mp_srcptr s1, mp_srcptr s2, mp_size_t size)
+{ mpn_nand_n (rp, s1, s2, size); }
+
+void
+mpn_ior_n_fun (mp_ptr rp, mp_srcptr s1, mp_srcptr s2, mp_size_t size)
+{ mpn_ior_n (rp, s1, s2, size); }
+
+void
+mpn_iorn_n_fun (mp_ptr rp, mp_srcptr s1, mp_srcptr s2, mp_size_t size)
+{ mpn_iorn_n (rp, s1, s2, size); }
+
+void
+mpn_nior_n_fun (mp_ptr rp, mp_srcptr s1, mp_srcptr s2, mp_size_t size)
+{ mpn_nior_n (rp, s1, s2, size); }
+
+void
+mpn_xor_n_fun (mp_ptr rp, mp_srcptr s1, mp_srcptr s2, mp_size_t size)
+{ mpn_xor_n (rp, s1, s2, size); }
+
+void
+mpn_xnor_n_fun (mp_ptr rp, mp_srcptr s1, mp_srcptr s2, mp_size_t size)
+{ mpn_xnor_n (rp, s1, s2, size); }
+
+mp_limb_t
+udiv_qrnnd_fun (mp_limb_t *remptr, mp_limb_t n1, mp_limb_t n0, mp_limb_t d)
+{
+ mp_limb_t q;
+ udiv_qrnnd (q, *remptr, n1, n0, d);
+ return q;
+}
+
+mp_limb_t
+mpn_divexact_by3_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+ return mpn_divexact_by3 (rp, sp, size);
+}
+
+#if HAVE_NATIVE_mpn_addlsh1_n_ip1
+mp_limb_t
+mpn_addlsh1_n_ip1_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+ return mpn_addlsh1_n_ip1 (rp, sp, size);
+}
+#endif
+#if HAVE_NATIVE_mpn_addlsh2_n_ip1
+mp_limb_t
+mpn_addlsh2_n_ip1_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+ return mpn_addlsh2_n_ip1 (rp, sp, size);
+}
+#endif
+#if HAVE_NATIVE_mpn_addlsh_n_ip1
+mp_limb_t
+mpn_addlsh_n_ip1_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size, unsigned int sh)
+{
+ return mpn_addlsh_n_ip1 (rp, sp, size, sh);
+}
+#endif
+#if HAVE_NATIVE_mpn_addlsh1_n_ip2
+mp_limb_t
+mpn_addlsh1_n_ip2_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+ return mpn_addlsh1_n_ip2 (rp, sp, size);
+}
+#endif
+#if HAVE_NATIVE_mpn_addlsh2_n_ip2
+mp_limb_t
+mpn_addlsh2_n_ip2_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+ return mpn_addlsh2_n_ip2 (rp, sp, size);
+}
+#endif
+#if HAVE_NATIVE_mpn_addlsh_n_ip2
+mp_limb_t
+mpn_addlsh_n_ip2_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size, unsigned int sh)
+{
+ return mpn_addlsh_n_ip2 (rp, sp, size, sh);
+}
+#endif
+#if HAVE_NATIVE_mpn_sublsh1_n_ip1
+mp_limb_t
+mpn_sublsh1_n_ip1_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+ return mpn_sublsh1_n_ip1 (rp, sp, size);
+}
+#endif
+#if HAVE_NATIVE_mpn_sublsh2_n_ip1
+mp_limb_t
+mpn_sublsh2_n_ip1_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+ return mpn_sublsh2_n_ip1 (rp, sp, size);
+}
+#endif
+#if HAVE_NATIVE_mpn_sublsh_n_ip1
+mp_limb_t
+mpn_sublsh_n_ip1_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size, unsigned int sh)
+{
+ return mpn_sublsh_n_ip1 (rp, sp, size, sh);
+}
+#endif
+
+mp_limb_t
+mpn_modexact_1_odd_fun (mp_srcptr ptr, mp_size_t size, mp_limb_t divisor)
+{
+ return mpn_modexact_1_odd (ptr, size, divisor);
+}
+
+void
+mpn_toom22_mul_fun (mp_ptr dst, mp_srcptr src1, mp_srcptr src2, mp_size_t size)
+{
+ mp_ptr tspace;
+ TMP_DECL;
+ TMP_MARK;
+ tspace = TMP_ALLOC_LIMBS (mpn_toom22_mul_itch (size, size));
+ mpn_toom22_mul (dst, src1, size, src2, size, tspace);
+ TMP_FREE;
+}
+void
+mpn_toom2_sqr_fun (mp_ptr dst, mp_srcptr src, mp_size_t size)
+{
+ mp_ptr tspace;
+ TMP_DECL;
+ TMP_MARK;
+ tspace = TMP_ALLOC_LIMBS (mpn_toom2_sqr_itch (size));
+ mpn_toom2_sqr (dst, src, size, tspace);
+ TMP_FREE;
+}
+void
+mpn_toom33_mul_fun (mp_ptr dst, mp_srcptr src1, mp_srcptr src2, mp_size_t size)
+{
+ mp_ptr tspace;
+ TMP_DECL;
+ TMP_MARK;
+ tspace = TMP_ALLOC_LIMBS (mpn_toom33_mul_itch (size, size));
+ mpn_toom33_mul (dst, src1, size, src2, size, tspace);
+ TMP_FREE;
+}
+void
+mpn_toom3_sqr_fun (mp_ptr dst, mp_srcptr src, mp_size_t size)
+{
+ mp_ptr tspace;
+ TMP_DECL;
+ TMP_MARK;
+ tspace = TMP_ALLOC_LIMBS (mpn_toom3_sqr_itch (size));
+ mpn_toom3_sqr (dst, src, size, tspace);
+ TMP_FREE;
+}
+void
+mpn_toom44_mul_fun (mp_ptr dst, mp_srcptr src1, mp_srcptr src2, mp_size_t size)
+{
+ mp_ptr tspace;
+ TMP_DECL;
+ TMP_MARK;
+ tspace = TMP_ALLOC_LIMBS (mpn_toom44_mul_itch (size, size));
+ mpn_toom44_mul (dst, src1, size, src2, size, tspace);
+ TMP_FREE;
+}
+void
+mpn_toom4_sqr_fun (mp_ptr dst, mp_srcptr src, mp_size_t size)
+{
+ mp_ptr tspace;
+ TMP_DECL;
+ TMP_MARK;
+ tspace = TMP_ALLOC_LIMBS (mpn_toom4_sqr_itch (size));
+ mpn_toom4_sqr (dst, src, size, tspace);
+ TMP_FREE;
+}
+
+void
+mpn_toom42_mulmid_fun (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
+ mp_size_t size)
+{
+ mp_ptr tspace;
+ mp_size_t n;
+ TMP_DECL;
+ TMP_MARK;
+ tspace = TMP_ALLOC_LIMBS (mpn_toom42_mulmid_itch (size));
+ mpn_toom42_mulmid (dst, src1, src2, size, tspace);
+ TMP_FREE;
+}
+
+mp_limb_t
+umul_ppmm_fun (mp_limb_t *lowptr, mp_limb_t m1, mp_limb_t m2)
+{
+ mp_limb_t high;
+ umul_ppmm (high, *lowptr, m1, m2);
+ return high;
+}
+
+void
+MPN_ZERO_fun (mp_ptr ptr, mp_size_t size)
+{ MPN_ZERO (ptr, size); }
+
+mp_size_t
+mpn_sqrt_fun (mp_ptr dst, mp_srcptr src, mp_size_t size)
+{ return mpn_sqrtrem (dst, NULL, src, size); }
+
+struct choice_t {
+ const char *name;
+ tryfun_t function;
+ int type;
+ mp_size_t minsize;
+};
+
+#define TRY(fun) #fun, (tryfun_t) fun
+#define TRY_FUNFUN(fun) #fun, (tryfun_t) fun##_fun
+
+const struct choice_t choice_array[] = {
+ { TRY(mpn_add), TYPE_ADD },
+ { TRY(mpn_sub), TYPE_SUB },
+
+ { TRY(mpn_add_n), TYPE_ADD_N },
+ { TRY(mpn_sub_n), TYPE_SUB_N },
+
+#if HAVE_NATIVE_mpn_add_nc
+ { TRY(mpn_add_nc), TYPE_ADD_NC },
+#endif
+#if HAVE_NATIVE_mpn_sub_nc
+ { TRY(mpn_sub_nc), TYPE_SUB_NC },
+#endif
+
+#if HAVE_NATIVE_mpn_add_n_sub_n
+ { TRY(mpn_add_n_sub_n), TYPE_ADDSUB_N },
+#endif
+#if HAVE_NATIVE_mpn_add_n_sub_nc
+ { TRY(mpn_add_n_sub_nc), TYPE_ADDSUB_NC },
+#endif
+
+ { TRY(mpn_add_err1_n), TYPE_ADD_ERR1_N },
+ { TRY(mpn_sub_err1_n), TYPE_SUB_ERR1_N },
+ { TRY(mpn_add_err2_n), TYPE_ADD_ERR2_N },
+ { TRY(mpn_sub_err2_n), TYPE_SUB_ERR2_N },
+ { TRY(mpn_add_err3_n), TYPE_ADD_ERR3_N },
+ { TRY(mpn_sub_err3_n), TYPE_SUB_ERR3_N },
+
+ { TRY(mpn_addmul_1), TYPE_ADDMUL_1 },
+ { TRY(mpn_submul_1), TYPE_SUBMUL_1 },
+#if HAVE_NATIVE_mpn_addmul_1c
+ { TRY(mpn_addmul_1c), TYPE_ADDMUL_1C },
+#endif
+#if HAVE_NATIVE_mpn_submul_1c
+ { TRY(mpn_submul_1c), TYPE_SUBMUL_1C },
+#endif
+
+#if HAVE_NATIVE_mpn_addmul_2
+ { TRY(mpn_addmul_2), TYPE_ADDMUL_2, 2 },
+#endif
+#if HAVE_NATIVE_mpn_addmul_3
+ { TRY(mpn_addmul_3), TYPE_ADDMUL_3, 3 },
+#endif
+#if HAVE_NATIVE_mpn_addmul_4
+ { TRY(mpn_addmul_4), TYPE_ADDMUL_4, 4 },
+#endif
+#if HAVE_NATIVE_mpn_addmul_5
+ { TRY(mpn_addmul_5), TYPE_ADDMUL_5, 5 },
+#endif
+#if HAVE_NATIVE_mpn_addmul_6
+ { TRY(mpn_addmul_6), TYPE_ADDMUL_6, 6 },
+#endif
+#if HAVE_NATIVE_mpn_addmul_7
+ { TRY(mpn_addmul_7), TYPE_ADDMUL_7, 7 },
+#endif
+#if HAVE_NATIVE_mpn_addmul_8
+ { TRY(mpn_addmul_8), TYPE_ADDMUL_8, 8 },
+#endif
+
+ { TRY_FUNFUN(mpn_com), TYPE_COM },
+
+ { TRY_FUNFUN(MPN_COPY), TYPE_COPY },
+ { TRY_FUNFUN(MPN_COPY_INCR), TYPE_COPYI },
+ { TRY_FUNFUN(MPN_COPY_DECR), TYPE_COPYD },
+
+ { TRY_FUNFUN(__GMPN_COPY), TYPE_COPY },
+#ifdef __GMPN_COPY_INCR
+ { TRY_FUNFUN(__GMPN_COPY_INCR), TYPE_COPYI },
+#endif
+
+#if HAVE_NATIVE_mpn_copyi
+ { TRY(mpn_copyi), TYPE_COPYI },
+#endif
+#if HAVE_NATIVE_mpn_copyd
+ { TRY(mpn_copyd), TYPE_COPYD },
+#endif
+
+ { TRY(mpn_cnd_add_n), TYPE_ADDCND_N },
+ { TRY(mpn_cnd_sub_n), TYPE_SUBCND_N },
+#if HAVE_NATIVE_mpn_addlsh1_n == 1
+ { TRY(mpn_addlsh1_n), TYPE_ADDLSH1_N },
+#endif
+#if HAVE_NATIVE_mpn_addlsh2_n == 1
+ { TRY(mpn_addlsh2_n), TYPE_ADDLSH2_N },
+#endif
+#if HAVE_NATIVE_mpn_addlsh_n
+ { TRY(mpn_addlsh_n), TYPE_ADDLSH_N },
+#endif
+#if HAVE_NATIVE_mpn_addlsh1_n_ip1
+ { TRY_FUNFUN(mpn_addlsh1_n_ip1), TYPE_ADDLSH1_N_IP1 },
+#endif
+#if HAVE_NATIVE_mpn_addlsh2_n_ip1
+ { TRY_FUNFUN(mpn_addlsh2_n_ip1), TYPE_ADDLSH2_N_IP1 },
+#endif
+#if HAVE_NATIVE_mpn_addlsh_n_ip1
+ { TRY_FUNFUN(mpn_addlsh_n_ip1), TYPE_ADDLSH_N_IP1 },
+#endif
+#if HAVE_NATIVE_mpn_addlsh1_n_ip2
+ { TRY_FUNFUN(mpn_addlsh1_n_ip2), TYPE_ADDLSH1_N_IP2 },
+#endif
+#if HAVE_NATIVE_mpn_addlsh2_n_ip2
+ { TRY_FUNFUN(mpn_addlsh2_n_ip2), TYPE_ADDLSH2_N_IP2 },
+#endif
+#if HAVE_NATIVE_mpn_addlsh_n_ip2
+ { TRY_FUNFUN(mpn_addlsh_n_ip2), TYPE_ADDLSH_N_IP2 },
+#endif
+#if HAVE_NATIVE_mpn_sublsh1_n == 1
+ { TRY(mpn_sublsh1_n), TYPE_SUBLSH1_N },
+#endif
+#if HAVE_NATIVE_mpn_sublsh2_n == 1
+ { TRY(mpn_sublsh2_n), TYPE_SUBLSH2_N },
+#endif
+#if HAVE_NATIVE_mpn_sublsh_n
+ { TRY(mpn_sublsh_n), TYPE_SUBLSH_N },
+#endif
+#if HAVE_NATIVE_mpn_sublsh1_n_ip1
+ { TRY_FUNFUN(mpn_sublsh1_n_ip1), TYPE_SUBLSH1_N_IP1 },
+#endif
+#if HAVE_NATIVE_mpn_sublsh2_n_ip1
+ { TRY_FUNFUN(mpn_sublsh2_n_ip1), TYPE_SUBLSH2_N_IP1 },
+#endif
+#if HAVE_NATIVE_mpn_sublsh_n_ip1
+ { TRY_FUNFUN(mpn_sublsh_n_ip1), TYPE_SUBLSH_N_IP1 },
+#endif
+#if HAVE_NATIVE_mpn_rsblsh1_n == 1
+ { TRY(mpn_rsblsh1_n), TYPE_RSBLSH1_N },
+#endif
+#if HAVE_NATIVE_mpn_rsblsh2_n == 1
+ { TRY(mpn_rsblsh2_n), TYPE_RSBLSH2_N },
+#endif
+#if HAVE_NATIVE_mpn_rsblsh_n
+ { TRY(mpn_rsblsh_n), TYPE_RSBLSH_N },
+#endif
+#if HAVE_NATIVE_mpn_rsh1add_n
+ { TRY(mpn_rsh1add_n), TYPE_RSH1ADD_N },
+#endif
+#if HAVE_NATIVE_mpn_rsh1sub_n
+ { TRY(mpn_rsh1sub_n), TYPE_RSH1SUB_N },
+#endif
+
+#if HAVE_NATIVE_mpn_addlsh1_nc == 1
+ { TRY(mpn_addlsh1_nc), TYPE_ADDLSH1_NC },
+#endif
+#if HAVE_NATIVE_mpn_addlsh2_nc == 1
+ { TRY(mpn_addlsh2_nc), TYPE_ADDLSH2_NC },
+#endif
+#if HAVE_NATIVE_mpn_addlsh_nc
+ { TRY(mpn_addlsh_nc), TYPE_ADDLSH_NC },
+#endif
+#if HAVE_NATIVE_mpn_sublsh1_nc == 1
+ { TRY(mpn_sublsh1_nc), TYPE_SUBLSH1_NC },
+#endif
+#if HAVE_NATIVE_mpn_sublsh2_nc == 1
+ { TRY(mpn_sublsh2_nc), TYPE_SUBLSH2_NC },
+#endif
+#if HAVE_NATIVE_mpn_sublsh_nc
+ { TRY(mpn_sublsh_nc), TYPE_SUBLSH_NC },
+#endif
+#if HAVE_NATIVE_mpn_rsblsh1_nc
+ { TRY(mpn_rsblsh1_nc), TYPE_RSBLSH1_NC },
+#endif
+#if HAVE_NATIVE_mpn_rsblsh2_nc
+ { TRY(mpn_rsblsh2_nc), TYPE_RSBLSH2_NC },
+#endif
+#if HAVE_NATIVE_mpn_rsblsh_nc
+ { TRY(mpn_rsblsh_nc), TYPE_RSBLSH_NC },
+#endif
+
+ { TRY_FUNFUN(mpn_and_n), TYPE_AND_N },
+ { TRY_FUNFUN(mpn_andn_n), TYPE_ANDN_N },
+ { TRY_FUNFUN(mpn_nand_n), TYPE_NAND_N },
+ { TRY_FUNFUN(mpn_ior_n), TYPE_IOR_N },
+ { TRY_FUNFUN(mpn_iorn_n), TYPE_IORN_N },
+ { TRY_FUNFUN(mpn_nior_n), TYPE_NIOR_N },
+ { TRY_FUNFUN(mpn_xor_n), TYPE_XOR_N },
+ { TRY_FUNFUN(mpn_xnor_n), TYPE_XNOR_N },
+
+ { TRY(mpn_divrem_1), TYPE_DIVREM_1 },
+#if USE_PREINV_DIVREM_1
+ { TRY(mpn_preinv_divrem_1), TYPE_PREINV_DIVREM_1 },
+#endif
+ { TRY(mpn_mod_1), TYPE_MOD_1 },
+#if USE_PREINV_MOD_1
+ { TRY(mpn_preinv_mod_1), TYPE_PREINV_MOD_1 },
+#endif
+#if HAVE_NATIVE_mpn_divrem_1c
+ { TRY(mpn_divrem_1c), TYPE_DIVREM_1C },
+#endif
+#if HAVE_NATIVE_mpn_mod_1c
+ { TRY(mpn_mod_1c), TYPE_MOD_1C },
+#endif
+ { TRY(mpn_div_qr_1n_pi1), TYPE_DIV_QR_1N_PI1 },
+#if GMP_NUMB_BITS % 4 == 0
+ { TRY(mpn_mod_34lsub1), TYPE_MOD_34LSUB1 },
+#endif
+
+ { TRY_FUNFUN(udiv_qrnnd), TYPE_UDIV_QRNND, 2 },
+#if HAVE_NATIVE_mpn_udiv_qrnnd
+ { TRY(mpn_udiv_qrnnd), TYPE_UDIV_QRNND, 2 },
+#endif
+#if HAVE_NATIVE_mpn_udiv_qrnnd_r
+ { TRY(mpn_udiv_qrnnd_r), TYPE_UDIV_QRNND_R, 2 },
+#endif
+
+ { TRY(mpn_divexact_1), TYPE_DIVEXACT_1 },
+ { TRY(mpn_bdiv_q_1), TYPE_BDIV_Q_1 },
+ { TRY_FUNFUN(mpn_divexact_by3), TYPE_DIVEXACT_BY3 },
+ { TRY(mpn_divexact_by3c), TYPE_DIVEXACT_BY3C },
+
+ { TRY_FUNFUN(mpn_modexact_1_odd), TYPE_MODEXACT_1_ODD },
+ { TRY(mpn_modexact_1c_odd), TYPE_MODEXACT_1C_ODD },
+
+
+ { TRY(mpn_sbpi1_div_qr), TYPE_SBPI1_DIV_QR, 3},
+ { TRY(mpn_tdiv_qr), TYPE_TDIV_QR },
+
+ { TRY(mpn_mul_1), TYPE_MUL_1 },
+#if HAVE_NATIVE_mpn_mul_1c
+ { TRY(mpn_mul_1c), TYPE_MUL_1C },
+#endif
+#if HAVE_NATIVE_mpn_mul_2
+ { TRY(mpn_mul_2), TYPE_MUL_2, 2 },
+#endif
+#if HAVE_NATIVE_mpn_mul_3
+ { TRY(mpn_mul_3), TYPE_MUL_3, 3 },
+#endif
+#if HAVE_NATIVE_mpn_mul_4
+ { TRY(mpn_mul_4), TYPE_MUL_4, 4 },
+#endif
+#if HAVE_NATIVE_mpn_mul_5
+ { TRY(mpn_mul_5), TYPE_MUL_5, 5 },
+#endif
+#if HAVE_NATIVE_mpn_mul_6
+ { TRY(mpn_mul_6), TYPE_MUL_6, 6 },
+#endif
+
+ { TRY(mpn_rshift), TYPE_RSHIFT },
+ { TRY(mpn_lshift), TYPE_LSHIFT },
+ { TRY(mpn_lshiftc), TYPE_LSHIFTC },
+
+
+ { TRY(mpn_mul_basecase), TYPE_MUL_MN },
+ { TRY(mpn_mulmid_basecase), TYPE_MULMID_MN },
+ { TRY(mpn_mullo_basecase), TYPE_MULLO_N },
+ { TRY(mpn_sqrlo_basecase), TYPE_SQRLO },
+ { TRY(mpn_sqrlo), TYPE_SQRLO },
+#if SQR_TOOM2_THRESHOLD > 0
+ { TRY(mpn_sqr_basecase), TYPE_SQR },
+#endif
+
+ { TRY(mpn_mul), TYPE_MUL_MN },
+ { TRY(mpn_mul_n), TYPE_MUL_N },
+ { TRY(mpn_sqr), TYPE_SQR },
+
+ { TRY_FUNFUN(umul_ppmm), TYPE_UMUL_PPMM, 2 },
+#if HAVE_NATIVE_mpn_umul_ppmm
+ { TRY(mpn_umul_ppmm), TYPE_UMUL_PPMM, 2 },
+#endif
+#if HAVE_NATIVE_mpn_umul_ppmm_r
+ { TRY(mpn_umul_ppmm_r), TYPE_UMUL_PPMM_R, 2 },
+#endif
+
+ { TRY_FUNFUN(mpn_toom22_mul), TYPE_MUL_N, MPN_TOOM22_MUL_MINSIZE },
+ { TRY_FUNFUN(mpn_toom2_sqr), TYPE_SQR, MPN_TOOM2_SQR_MINSIZE },
+ { TRY_FUNFUN(mpn_toom33_mul), TYPE_MUL_N, MPN_TOOM33_MUL_MINSIZE },
+ { TRY_FUNFUN(mpn_toom3_sqr), TYPE_SQR, MPN_TOOM3_SQR_MINSIZE },
+ { TRY_FUNFUN(mpn_toom44_mul), TYPE_MUL_N, MPN_TOOM44_MUL_MINSIZE },
+ { TRY_FUNFUN(mpn_toom4_sqr), TYPE_SQR, MPN_TOOM4_SQR_MINSIZE },
+
+ { TRY(mpn_mulmid_n), TYPE_MULMID_N, 1 },
+ { TRY(mpn_mulmid), TYPE_MULMID_MN, 1 },
+ { TRY_FUNFUN(mpn_toom42_mulmid), TYPE_MULMID_N,
+ (2 * MPN_TOOM42_MULMID_MINSIZE - 1) },
+
+ { TRY(mpn_gcd_1), TYPE_GCD_1 },
+ { TRY(mpn_gcd), TYPE_GCD },
+ { TRY(mpz_legendre), TYPE_MPZ_LEGENDRE },
+ { TRY(mpz_jacobi), TYPE_MPZ_JACOBI },
+ { TRY(mpz_kronecker), TYPE_MPZ_KRONECKER },
+ { TRY(mpz_kronecker_ui), TYPE_MPZ_KRONECKER_UI },
+ { TRY(mpz_kronecker_si), TYPE_MPZ_KRONECKER_SI },
+ { TRY(mpz_ui_kronecker), TYPE_MPZ_UI_KRONECKER },
+ { TRY(mpz_si_kronecker), TYPE_MPZ_SI_KRONECKER },
+
+ { TRY(mpn_popcount), TYPE_POPCOUNT },
+ { TRY(mpn_hamdist), TYPE_HAMDIST },
+
+ { TRY(mpn_sqrtrem), TYPE_SQRTREM },
+ { TRY_FUNFUN(mpn_sqrt), TYPE_SQRT },
+
+ { TRY_FUNFUN(MPN_ZERO), TYPE_ZERO },
+
+ { TRY(mpn_get_str), TYPE_GET_STR },
+
+ { TRY(mpn_binvert), TYPE_BINVERT },
+ { TRY(mpn_invert), TYPE_INVERT },
+
+#ifdef EXTRA_ROUTINES
+ EXTRA_ROUTINES
+#endif
+};
+
+const struct choice_t *choice = NULL;
+
+
+void
+mprotect_maybe (void *addr, size_t len, int prot)
+{
+ if (!option_redzones)
+ return;
+
+#if HAVE_MPROTECT
+ if (mprotect (addr, len, prot) != 0)
+ {
+ fprintf (stderr, "Cannot mprotect %p 0x%X 0x%X: %s\n",
+ addr, (unsigned) len, prot, strerror (errno));
+ exit (1);
+ }
+#else
+ {
+ static int warned = 0;
+ if (!warned)
+ {
+ fprintf (stderr,
+ "mprotect not available, bounds testing not performed\n");
+ warned = 1;
+ }
+ }
+#endif
+}
+
+/* round "a" up to a multiple of "m" */
+size_t
+round_up_multiple (size_t a, size_t m)
+{
+ unsigned long r;
+
+ r = a % m;
+ if (r == 0)
+ return a;
+ else
+ return a + (m - r);
+}
+
+
+/* On some systems it seems that only an mmap'ed region can be mprotect'ed,
+ for instance HP-UX 10.
+
+ mmap will almost certainly return a pointer already aligned to a page
+ boundary, but it's easy enough to share the alignment handling with the
+ malloc case. */
+
+void
+malloc_region (struct region_t *r, mp_size_t n)
+{
+ mp_ptr p;
+ size_t nbytes;
+
+ ASSERT ((pagesize % GMP_LIMB_BYTES) == 0);
+
+ n = round_up_multiple (n, PAGESIZE_LIMBS);
+ r->size = n;
+
+ nbytes = n*GMP_LIMB_BYTES + 2*REDZONE_BYTES + pagesize;
+
+#if defined (MAP_ANONYMOUS) && ! defined (MAP_ANON)
+#define MAP_ANON MAP_ANONYMOUS
+#endif
+
+#if HAVE_MMAP && defined (MAP_ANON)
+ /* note must pass fd=-1 for MAP_ANON on BSD */
+ p = (mp_ptr) mmap (NULL, nbytes, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);
+ if (p == (void *) -1)
+ {
+ fprintf (stderr, "Cannot mmap %#x anon bytes: %s\n",
+ (unsigned) nbytes, strerror (errno));
+ exit (1);
+ }
+#else
+ p = (mp_ptr) malloc (nbytes);
+ ASSERT_ALWAYS (p != NULL);
+#endif
+
+ p = (mp_ptr) align_pointer (p, pagesize);
+
+ mprotect_maybe (p, REDZONE_BYTES, PROT_NONE);
+ p += REDZONE_LIMBS;
+ r->ptr = p;
+
+ mprotect_maybe (p + n, REDZONE_BYTES, PROT_NONE);
+}
+
+void
+mprotect_region (const struct region_t *r, int prot)
+{
+ mprotect_maybe (r->ptr, r->size, prot);
+}
+
+
+/* First four entries must be 0,1,2,3 for the benefit of CARRY_BIT, CARRY_3,
+ and CARRY_4 */
+mp_limb_t carry_array[] = {
+ 0, 1, 2, 3,
+ 4,
+ CNST_LIMB(1) << 8,
+ CNST_LIMB(1) << 16,
+ GMP_NUMB_MAX
+};
+int carry_index;
+
+#define CARRY_COUNT \
+ ((tr->carry == CARRY_BIT) ? 2 \
+ : tr->carry == CARRY_3 ? 3 \
+ : tr->carry == CARRY_4 ? 4 \
+ : (tr->carry == CARRY_LIMB || tr->carry == CARRY_DIVISOR) \
+ ? numberof(carry_array) + CARRY_RANDOMS \
+ : 1)
+
+#define MPN_RANDOM_ALT(index,dst,size) \
+ (((index) & 1) ? refmpn_random (dst, size) : refmpn_random2 (dst, size))
+
+/* The dummy value after MPN_RANDOM_ALT ensures both sides of the ":" have
+ the same type */
+#define CARRY_ITERATION \
+ for (carry_index = 0; \
+ (carry_index < numberof (carry_array) \
+ ? (carry = carry_array[carry_index]) \
+ : (MPN_RANDOM_ALT (carry_index, &carry, 1), (mp_limb_t) 0)), \
+ (tr->carry == CARRY_DIVISOR ? carry %= divisor : 0), \
+ carry_index < CARRY_COUNT; \
+ carry_index++)
+
+
+mp_limb_t multiplier_array[] = {
+ 0, 1, 2, 3,
+ CNST_LIMB(1) << 8,
+ CNST_LIMB(1) << 16,
+ GMP_NUMB_MAX - 2,
+ GMP_NUMB_MAX - 1,
+ GMP_NUMB_MAX
+};
+int multiplier_index;
+
+mp_limb_t divisor_array[] = {
+ 1, 2, 3,
+ CNST_LIMB(1) << 8,
+ CNST_LIMB(1) << 16,
+ CNST_LIMB(1) << (GMP_NUMB_BITS/2 - 1),
+ GMP_NUMB_MAX >> (GMP_NUMB_BITS/2),
+ GMP_NUMB_HIGHBIT,
+ GMP_NUMB_HIGHBIT + 1,
+ GMP_NUMB_MAX - 2,
+ GMP_NUMB_MAX - 1,
+ GMP_NUMB_MAX
+};
+
+int divisor_index;
+
+/* The dummy value after MPN_RANDOM_ALT ensures both sides of the ":" have
+ the same type */
+#define ARRAY_ITERATION(var, index, limit, array, randoms, cond) \
+ for (index = 0; \
+ (index < numberof (array) \
+ ? (var = array[index]) \
+ : (MPN_RANDOM_ALT (index, &var, 1), (mp_limb_t) 0)), \
+ index < limit; \
+ index++)
+
+#define MULTIPLIER_COUNT \
+ (tr->multiplier \
+ ? numberof (multiplier_array) + MULTIPLIER_RANDOMS \
+ : 1)
+
+#define MULTIPLIER_ITERATION \
+ ARRAY_ITERATION(multiplier, multiplier_index, MULTIPLIER_COUNT, \
+ multiplier_array, MULTIPLIER_RANDOMS, TRY_MULTIPLIER)
+
+#define DIVISOR_COUNT \
+ (tr->divisor \
+ ? numberof (divisor_array) + DIVISOR_RANDOMS \
+ : 1)
+
+#define DIVISOR_ITERATION \
+ ARRAY_ITERATION(divisor, divisor_index, DIVISOR_COUNT, divisor_array, \
+ DIVISOR_RANDOMS, TRY_DIVISOR)
+
+
+/* overlap_array[].s[i] is where s[i] should be, 0 or 1 means overlapping
+ d[0] or d[1] respectively, -1 means a separate (write-protected)
+ location. */
+
+struct overlap_t {
+ int s[NUM_SOURCES];
+} overlap_array[] = {
+ { { -1, -1, -1, -1, -1 } },
+ { { 0, -1, -1, -1, -1 } },
+ { { -1, 0, -1, -1, -1 } },
+ { { 0, 0, -1, -1, -1 } },
+ { { 1, -1, -1, -1, -1 } },
+ { { -1, 1, -1, -1, -1 } },
+ { { 1, 1, -1, -1, -1 } },
+ { { 0, 1, -1, -1, -1 } },
+ { { 1, 0, -1, -1, -1 } },
+};
+
+struct overlap_t *overlap, *overlap_limit;
+
+#define OVERLAP_COUNT \
+ (tr->overlap & OVERLAP_NONE ? 1 \
+ : tr->overlap & OVERLAP_NOT_SRCS ? 3 \
+ : tr->overlap & OVERLAP_NOT_SRC2 ? 2 \
+ : tr->overlap & OVERLAP_NOT_DST2 ? 4 \
+ : tr->dst[1] ? 9 \
+ : tr->src[1] ? 4 \
+ : tr->dst[0] ? 2 \
+ : 1)
+
+#define OVERLAP_ITERATION \
+ for (overlap = &overlap_array[0], \
+ overlap_limit = &overlap_array[OVERLAP_COUNT]; \
+ overlap < overlap_limit; \
+ overlap++)
+
+
+int base = 10;
+
+#define T_RAND_COUNT 2
+int t_rand;
+
+void
+t_random (mp_ptr ptr, mp_size_t n)
+{
+ if (n == 0)
+ return;
+
+ switch (option_data) {
+ case DATA_TRAND:
+ switch (t_rand) {
+ case 0: refmpn_random (ptr, n); break;
+ case 1: refmpn_random2 (ptr, n); break;
+ default: abort();
+ }
+ break;
+ case DATA_SEQ:
+ {
+ static mp_limb_t counter = 0;
+ mp_size_t i;
+ for (i = 0; i < n; i++)
+ ptr[i] = ++counter;
+ }
+ break;
+ case DATA_ZEROS:
+ refmpn_zero (ptr, n);
+ break;
+ case DATA_FFS:
+ refmpn_fill (ptr, n, GMP_NUMB_MAX);
+ break;
+ case DATA_2FD:
+ /* Special value 0x2FFF...FFFD, which divided by 3 gives 0xFFF...FFF,
+ inducing the q1_ff special case in the mul-by-inverse part of some
+ versions of divrem_1 and mod_1. */
+ refmpn_fill (ptr, n, (mp_limb_t) -1);
+ ptr[n-1] = 2;
+ ptr[0] -= 2;
+ break;
+
+ default:
+ abort();
+ }
+}
+#define T_RAND_ITERATION \
+ for (t_rand = 0; t_rand < T_RAND_COUNT; t_rand++)
+
+
+void
+print_each (const struct each_t *e)
+{
+ int i;
+
+ printf ("%s %s\n", e->name, e == &ref ? tr->reference_name : choice->name);
+ if (tr->retval)
+ mpn_trace (" retval", &e->retval, 1);
+
+ for (i = 0; i < NUM_DESTS; i++)
+ {
+ if (tr->dst[i])
+ {
+ if (tr->dst_bytes[i])
+ byte_tracen (" d[%d]", i, e->d[i].p, d[i].size);
+ else
+ mpn_tracen (" d[%d]", i, e->d[i].p, d[i].size);
+ printf (" located %p\n", (void *) (e->d[i].p));
+ }
+ }
+
+ for (i = 0; i < NUM_SOURCES; i++)
+ if (tr->src[i])
+ printf (" s[%d] located %p\n", i, (void *) (e->s[i].p));
+}
+
+
+void
+print_all (void)
+{
+ int i;
+
+ printf ("\n");
+ printf ("size %ld\n", (long) size);
+ if (tr->size2)
+ printf ("size2 %ld\n", (long) size2);
+
+ for (i = 0; i < NUM_DESTS; i++)
+ if (d[i].size != size)
+ printf ("d[%d].size %ld\n", i, (long) d[i].size);
+
+ if (tr->multiplier)
+ mpn_trace (" multiplier", &multiplier, 1);
+ if (tr->divisor)
+ mpn_trace (" divisor", &divisor, 1);
+ if (tr->shift)
+ printf (" shift %lu\n", shift);
+ if (tr->carry)
+ mpn_trace (" carry", &carry, 1);
+ if (tr->msize)
+ mpn_trace (" multiplier_N", multiplier_N, tr->msize);
+
+ for (i = 0; i < NUM_DESTS; i++)
+ if (tr->dst[i])
+ printf (" d[%d] %s, align %ld, size %ld\n",
+ i, d[i].high ? "high" : "low",
+ (long) d[i].align, (long) d[i].size);
+
+ for (i = 0; i < NUM_SOURCES; i++)
+ {
+ if (tr->src[i])
+ {
+ printf (" s[%d] %s, align %ld, ",
+ i, s[i].high ? "high" : "low", (long) s[i].align);
+ switch (overlap->s[i]) {
+ case -1:
+ printf ("no overlap\n");
+ break;
+ default:
+ printf ("==d[%d]%s\n",
+ overlap->s[i],
+ tr->overlap == OVERLAP_LOW_TO_HIGH ? "+a"
+ : tr->overlap == OVERLAP_HIGH_TO_LOW ? "-a"
+ : "");
+ break;
+ }
+ printf (" s[%d]=", i);
+ if (tr->carry_sign && (carry & (1 << i)))
+ printf ("-");
+ mpn_trace (NULL, s[i].p, SRC_SIZE(i));
+ }
+ }
+
+ if (tr->dst0_from_src1)
+ mpn_trace (" d[0]", s[1].region.ptr, size);
+
+ if (tr->reference)
+ print_each (&ref);
+ print_each (&fun);
+}
+
+void
+compare (void)
+{
+ int error = 0;
+ int i;
+
+ if (tr->retval && ref.retval != fun.retval)
+ {
+ gmp_printf ("Different return values (%Mu, %Mu)\n",
+ ref.retval, fun.retval);
+ error = 1;
+ }
+
+ for (i = 0; i < NUM_DESTS; i++)
+ {
+ switch (tr->dst_size[i]) {
+ case SIZE_RETVAL:
+ case SIZE_GET_STR:
+ d[i].size = ref.retval;
+ break;
+ }
+ }
+
+ for (i = 0; i < NUM_DESTS; i++)
+ {
+ if (! tr->dst[i])
+ continue;
+
+ if (tr->dst_bytes[i])
+ {
+ if (memcmp (ref.d[i].p, fun.d[i].p, d[i].size) != 0)
+ {
+ printf ("Different d[%d] data results, low diff at %ld, high diff at %ld\n",
+ i,
+ (long) byte_diff_lowest (ref.d[i].p, fun.d[i].p, d[i].size),
+ (long) byte_diff_highest (ref.d[i].p, fun.d[i].p, d[i].size));
+ error = 1;
+ }
+ }
+ else
+ {
+ if (d[i].size != 0
+ && ! refmpn_equal_anynail (ref.d[i].p, fun.d[i].p, d[i].size))
+ {
+ printf ("Different d[%d] data results, low diff at %ld, high diff at %ld\n",
+ i,
+ (long) mpn_diff_lowest (ref.d[i].p, fun.d[i].p, d[i].size),
+ (long) mpn_diff_highest (ref.d[i].p, fun.d[i].p, d[i].size));
+ error = 1;
+ }
+ }
+ }
+
+ if (error)
+ {
+ print_all();
+ abort();
+ }
+}
+
+
+/* The functions are cast if the return value should be a long rather than
+ the default mp_limb_t. This is necessary under _LONG_LONG_LIMB. This
+ might not be enough if some actual calling conventions checking is
+ implemented on a long long limb system. */
+
+void
+call (struct each_t *e, tryfun_t function)
+{
+ switch (choice->type) {
+ case TYPE_ADD:
+ case TYPE_SUB:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p, size, e->s[1].p, size2);
+ break;
+
+ case TYPE_ADD_N:
+ case TYPE_SUB_N:
+ case TYPE_ADDLSH1_N:
+ case TYPE_ADDLSH2_N:
+ case TYPE_SUBLSH1_N:
+ case TYPE_SUBLSH2_N:
+ case TYPE_RSBLSH1_N:
+ case TYPE_RSBLSH2_N:
+ case TYPE_RSH1ADD_N:
+ case TYPE_RSH1SUB_N:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p, e->s[1].p, size);
+ break;
+ case TYPE_ADDLSH_N:
+ case TYPE_SUBLSH_N:
+ case TYPE_RSBLSH_N:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p, e->s[1].p, size, shift);
+ break;
+ case TYPE_ADDLSH_NC:
+ case TYPE_SUBLSH_NC:
+ case TYPE_RSBLSH_NC:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p, e->s[1].p, size, shift, carry);
+ break;
+ case TYPE_ADDLSH1_NC:
+ case TYPE_ADDLSH2_NC:
+ case TYPE_SUBLSH1_NC:
+ case TYPE_SUBLSH2_NC:
+ case TYPE_RSBLSH1_NC:
+ case TYPE_RSBLSH2_NC:
+ case TYPE_ADD_NC:
+ case TYPE_SUB_NC:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p, e->s[1].p, size, carry);
+ break;
+ case TYPE_ADDCND_N:
+ case TYPE_SUBCND_N:
+ e->retval = CALLING_CONVENTIONS (function)
+ (carry, e->d[0].p, e->s[0].p, e->s[1].p, size);
+ break;
+ case TYPE_ADD_ERR1_N:
+ case TYPE_SUB_ERR1_N:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p, e->s[1].p, e->d[1].p, e->s[2].p, size, carry);
+ break;
+ case TYPE_ADD_ERR2_N:
+ case TYPE_SUB_ERR2_N:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p, e->s[1].p, e->d[1].p, e->s[2].p, e->s[3].p, size, carry);
+ break;
+ case TYPE_ADD_ERR3_N:
+ case TYPE_SUB_ERR3_N:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p, e->s[1].p, e->d[1].p, e->s[2].p, e->s[3].p, e->s[4].p, size, carry);
+ break;
+
+ case TYPE_MUL_1:
+ case TYPE_ADDMUL_1:
+ case TYPE_SUBMUL_1:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p, size, multiplier);
+ break;
+ case TYPE_MUL_1C:
+ case TYPE_ADDMUL_1C:
+ case TYPE_SUBMUL_1C:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p, size, multiplier, carry);
+ break;
+
+ case TYPE_MUL_2:
+ case TYPE_MUL_3:
+ case TYPE_MUL_4:
+ case TYPE_MUL_5:
+ case TYPE_MUL_6:
+ if (size == 1)
+ abort ();
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p, size, multiplier_N);
+ break;
+
+ case TYPE_ADDMUL_2:
+ case TYPE_ADDMUL_3:
+ case TYPE_ADDMUL_4:
+ case TYPE_ADDMUL_5:
+ case TYPE_ADDMUL_6:
+ case TYPE_ADDMUL_7:
+ case TYPE_ADDMUL_8:
+ if (size == 1)
+ abort ();
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p, size, multiplier_N);
+ break;
+
+ case TYPE_AND_N:
+ case TYPE_ANDN_N:
+ case TYPE_NAND_N:
+ case TYPE_IOR_N:
+ case TYPE_IORN_N:
+ case TYPE_NIOR_N:
+ case TYPE_XOR_N:
+ case TYPE_XNOR_N:
+ CALLING_CONVENTIONS (function) (e->d[0].p, e->s[0].p, e->s[1].p, size);
+ break;
+
+ case TYPE_ADDSUB_N:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->d[1].p, e->s[0].p, e->s[1].p, size);
+ break;
+ case TYPE_ADDSUB_NC:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->d[1].p, e->s[0].p, e->s[1].p, size, carry);
+ break;
+
+ case TYPE_COPY:
+ case TYPE_COPYI:
+ case TYPE_COPYD:
+ case TYPE_COM:
+ CALLING_CONVENTIONS (function) (e->d[0].p, e->s[0].p, size);
+ break;
+
+ case TYPE_ADDLSH1_N_IP1:
+ case TYPE_ADDLSH2_N_IP1:
+ case TYPE_ADDLSH1_N_IP2:
+ case TYPE_ADDLSH2_N_IP2:
+ case TYPE_SUBLSH1_N_IP1:
+ case TYPE_SUBLSH2_N_IP1:
+ case TYPE_DIVEXACT_BY3:
+ e->retval = CALLING_CONVENTIONS (function) (e->d[0].p, e->s[0].p, size);
+ break;
+ case TYPE_DIVEXACT_BY3C:
+ e->retval = CALLING_CONVENTIONS (function) (e->d[0].p, e->s[0].p, size,
+ carry);
+ break;
+
+
+ case TYPE_DIVMOD_1:
+ case TYPE_DIVEXACT_1:
+ case TYPE_BDIV_Q_1:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p, size, divisor);
+ break;
+ case TYPE_DIVMOD_1C:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p, size, divisor, carry);
+ break;
+ case TYPE_DIVREM_1:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, size2, e->s[0].p, size, divisor);
+ break;
+ case TYPE_DIVREM_1C:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, size2, e->s[0].p, size, divisor, carry);
+ break;
+ case TYPE_PREINV_DIVREM_1:
+ {
+ mp_limb_t dinv;
+ unsigned shift;
+ shift = refmpn_count_leading_zeros (divisor);
+ dinv = refmpn_invert_limb (divisor << shift);
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, size2, e->s[0].p, size, divisor, dinv, shift);
+ }
+ break;
+ case TYPE_MOD_1:
+ case TYPE_MODEXACT_1_ODD:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->s[0].p, size, divisor);
+ break;
+ case TYPE_MOD_1C:
+ case TYPE_MODEXACT_1C_ODD:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->s[0].p, size, divisor, carry);
+ break;
+ case TYPE_PREINV_MOD_1:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->s[0].p, size, divisor, refmpn_invert_limb (divisor));
+ break;
+ case TYPE_DIV_QR_1N_PI1:
+ {
+ mp_limb_t dinv = refmpn_invert_limb (divisor);
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p, size, e->s[1].p[0], divisor, dinv);
+ break;
+ }
+
+ case TYPE_MOD_34LSUB1:
+ e->retval = CALLING_CONVENTIONS (function) (e->s[0].p, size);
+ break;
+
+ case TYPE_UDIV_QRNND:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p[1], e->s[0].p[0], divisor);
+ break;
+ case TYPE_UDIV_QRNND_R:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->s[0].p[1], e->s[0].p[0], divisor, e->d[0].p);
+ break;
+
+ case TYPE_SBPI1_DIV_QR:
+ {
+ gmp_pi1_t dinv;
+ invert_pi1 (dinv, e->s[1].p[size2-1], e->s[1].p[size2-2]); /* FIXME: use refinvert_pi1 */
+ refmpn_copyi (e->d[1].p, e->s[0].p, size); /* dividend */
+ refmpn_fill (e->d[0].p, size-size2, 0x98765432); /* quotient */
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->d[1].p, size, e->s[1].p, size2, dinv.inv32);
+ refmpn_zero (e->d[1].p+size2, size-size2); /* excess over remainder */
+ }
+ break;
+
+ case TYPE_TDIV_QR:
+ CALLING_CONVENTIONS (function) (e->d[0].p, e->d[1].p, 0,
+ e->s[0].p, size, e->s[1].p, size2);
+ break;
+
+ case TYPE_GCD_1:
+ /* Must have a non-zero src, but this probably isn't the best way to do
+ it. */
+ if (refmpn_zero_p (e->s[0].p, size))
+ e->retval = 0;
+ else
+ e->retval = CALLING_CONVENTIONS (function) (e->s[0].p, size, divisor);
+ break;
+
+ case TYPE_GCD:
+ /* Sources are destroyed, so they're saved and replaced, but a general
+ approach to this might be better. Note that it's still e->s[0].p and
+ e->s[1].p that are passed, to get the desired alignments. */
+ {
+ mp_ptr s0 = refmpn_malloc_limbs (size);
+ mp_ptr s1 = refmpn_malloc_limbs (size2);
+ refmpn_copyi (s0, e->s[0].p, size);
+ refmpn_copyi (s1, e->s[1].p, size2);
+
+ mprotect_region (&s[0].region, PROT_READ|PROT_WRITE);
+ mprotect_region (&s[1].region, PROT_READ|PROT_WRITE);
+ e->retval = CALLING_CONVENTIONS (function) (e->d[0].p,
+ e->s[0].p, size,
+ e->s[1].p, size2);
+ refmpn_copyi (e->s[0].p, s0, size);
+ refmpn_copyi (e->s[1].p, s1, size2);
+ free (s0);
+ free (s1);
+ }
+ break;
+
+ case TYPE_GCD_FINDA:
+ {
+ /* FIXME: do this with a flag */
+ mp_limb_t c[2];
+ c[0] = e->s[0].p[0];
+ c[0] += (c[0] == 0);
+ c[1] = e->s[0].p[0];
+ c[1] += (c[1] == 0);
+ e->retval = CALLING_CONVENTIONS (function) (c);
+ }
+ break;
+
+ case TYPE_MPZ_LEGENDRE:
+ case TYPE_MPZ_JACOBI:
+ {
+ mpz_t a, b;
+ PTR(a) = e->s[0].p; SIZ(a) = (carry==0 ? size : -size);
+ PTR(b) = e->s[1].p; SIZ(b) = size2;
+ e->retval = CALLING_CONVENTIONS (function) (a, b);
+ }
+ break;
+ case TYPE_MPZ_KRONECKER:
+ {
+ mpz_t a, b;
+ PTR(a) = e->s[0].p; SIZ(a) = ((carry&1)==0 ? size : -size);
+ PTR(b) = e->s[1].p; SIZ(b) = ((carry&2)==0 ? size2 : -size2);
+ e->retval = CALLING_CONVENTIONS (function) (a, b);
+ }
+ break;
+ case TYPE_MPZ_KRONECKER_UI:
+ {
+ mpz_t a;
+ PTR(a) = e->s[0].p; SIZ(a) = (carry==0 ? size : -size);
+ e->retval = CALLING_CONVENTIONS(function) (a, (unsigned long)multiplier);
+ }
+ break;
+ case TYPE_MPZ_KRONECKER_SI:
+ {
+ mpz_t a;
+ PTR(a) = e->s[0].p; SIZ(a) = (carry==0 ? size : -size);
+ e->retval = CALLING_CONVENTIONS (function) (a, (long) multiplier);
+ }
+ break;
+ case TYPE_MPZ_UI_KRONECKER:
+ {
+ mpz_t b;
+ PTR(b) = e->s[0].p; SIZ(b) = (carry==0 ? size : -size);
+ e->retval = CALLING_CONVENTIONS(function) ((unsigned long)multiplier, b);
+ }
+ break;
+ case TYPE_MPZ_SI_KRONECKER:
+ {
+ mpz_t b;
+ PTR(b) = e->s[0].p; SIZ(b) = (carry==0 ? size : -size);
+ e->retval = CALLING_CONVENTIONS (function) ((long) multiplier, b);
+ }
+ break;
+
+ case TYPE_MUL_MN:
+ case TYPE_MULMID_MN:
+ CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p, size, e->s[1].p, size2);
+ break;
+ case TYPE_MUL_N:
+ case TYPE_MULLO_N:
+ CALLING_CONVENTIONS (function) (e->d[0].p, e->s[0].p, e->s[1].p, size);
+ break;
+ case TYPE_MULMID_N:
+ CALLING_CONVENTIONS (function) (e->d[0].p, e->s[0].p, e->s[1].p,
+ (size + 1) / 2);
+ break;
+ case TYPE_SQR:
+ case TYPE_SQRLO:
+ CALLING_CONVENTIONS (function) (e->d[0].p, e->s[0].p, size);
+ break;
+
+ case TYPE_UMUL_PPMM:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p[0], e->s[0].p[1]);
+ break;
+ case TYPE_UMUL_PPMM_R:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->s[0].p[0], e->s[0].p[1], e->d[0].p);
+ break;
+
+ case TYPE_ADDLSH_N_IP1:
+ case TYPE_ADDLSH_N_IP2:
+ case TYPE_SUBLSH_N_IP1:
+ case TYPE_LSHIFT:
+ case TYPE_LSHIFTC:
+ case TYPE_RSHIFT:
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->s[0].p, size, shift);
+ break;
+
+ case TYPE_POPCOUNT:
+ e->retval = (* (unsigned long (*)(ANYARGS))
+ CALLING_CONVENTIONS (function)) (e->s[0].p, size);
+ break;
+ case TYPE_HAMDIST:
+ e->retval = (* (unsigned long (*)(ANYARGS))
+ CALLING_CONVENTIONS (function)) (e->s[0].p, e->s[1].p, size);
+ break;
+
+ case TYPE_SQRTREM:
+ e->retval = (* (long (*)(ANYARGS)) CALLING_CONVENTIONS (function))
+ (e->d[0].p, e->d[1].p, e->s[0].p, size);
+ break;
+
+ case TYPE_SQRT:
+ e->retval = (* (long (*)(ANYARGS)) CALLING_CONVENTIONS (function))
+ (e->d[0].p, e->s[0].p, size);
+ break;
+
+ case TYPE_ZERO:
+ CALLING_CONVENTIONS (function) (e->d[0].p, size);
+ break;
+
+ case TYPE_GET_STR:
+ {
+ size_t sizeinbase, fill;
+ char *dst;
+ MPN_SIZEINBASE (sizeinbase, e->s[0].p, size, base);
+ ASSERT_ALWAYS (sizeinbase <= d[0].size);
+ fill = d[0].size - sizeinbase;
+ if (d[0].high)
+ {
+ memset (e->d[0].p, 0xBA, fill);
+ dst = (char *) e->d[0].p + fill;
+ }
+ else
+ {
+ dst = (char *) e->d[0].p;
+ memset (dst + sizeinbase, 0xBA, fill);
+ }
+ if (POW2_P (base))
+ {
+ e->retval = CALLING_CONVENTIONS (function) (dst, base,
+ e->s[0].p, size);
+ }
+ else
+ {
+ refmpn_copy (e->d[1].p, e->s[0].p, size);
+ e->retval = CALLING_CONVENTIONS (function) (dst, base,
+ e->d[1].p, size);
+ }
+ refmpn_zero (e->d[1].p, size); /* clobbered or unused */
+ }
+ break;
+
+ case TYPE_INVERT:
+ {
+ mp_ptr scratch;
+ TMP_DECL;
+ TMP_MARK;
+ scratch = TMP_ALLOC_LIMBS (mpn_invert_itch (size));
+ CALLING_CONVENTIONS (function) (e->d[0].p, e->s[0].p, size, scratch);
+ TMP_FREE;
+ }
+ break;
+ case TYPE_BINVERT:
+ {
+ mp_ptr scratch;
+ TMP_DECL;
+ TMP_MARK;
+ scratch = TMP_ALLOC_LIMBS (mpn_binvert_itch (size));
+ CALLING_CONVENTIONS (function) (e->d[0].p, e->s[0].p, size, scratch);
+ TMP_FREE;
+ }
+ break;
+
+#ifdef EXTRA_CALL
+ EXTRA_CALL
+#endif
+
+ default:
+ printf ("Unknown routine type %d\n", choice->type);
+ abort ();
+ break;
+ }
+}
+
+
+void
+pointer_setup (struct each_t *e)
+{
+ int i, j;
+
+ for (i = 0; i < NUM_DESTS; i++)
+ {
+ switch (tr->dst_size[i]) {
+ case 0:
+ case SIZE_RETVAL: /* will be adjusted later */
+ d[i].size = size;
+ break;
+
+ case SIZE_1:
+ d[i].size = 1;
+ break;
+ case SIZE_2:
+ d[i].size = 2;
+ break;
+ case SIZE_3:
+ d[i].size = 3;
+ break;
+ case SIZE_4:
+ d[i].size = 4;
+ break;
+ case SIZE_6:
+ d[i].size = 6;
+ break;
+
+ case SIZE_PLUS_1:
+ d[i].size = size+1;
+ break;
+ case SIZE_PLUS_MSIZE_SUB_1:
+ d[i].size = size + tr->msize - 1;
+ break;
+
+ case SIZE_SUM:
+ if (tr->size2)
+ d[i].size = size + size2;
+ else
+ d[i].size = 2*size;
+ break;
+
+ case SIZE_SIZE2:
+ d[i].size = size2;
+ break;
+
+ case SIZE_DIFF:
+ d[i].size = size - size2;
+ break;
+
+ case SIZE_DIFF_PLUS_1:
+ d[i].size = size - size2 + 1;
+ break;
+
+ case SIZE_DIFF_PLUS_3:
+ d[i].size = size - size2 + 3;
+ break;
+
+ case SIZE_CEIL_HALF:
+ d[i].size = (size+1)/2;
+ break;
+
+ case SIZE_GET_STR:
+ {
+ mp_limb_t ff = GMP_NUMB_MAX;
+ MPN_SIZEINBASE (d[i].size, &ff - (size-1), size, base);
+ }
+ break;
+
+ default:
+ printf ("Unrecognised dst_size type %d\n", tr->dst_size[i]);
+ abort ();
+ }
+ }
+
+ /* establish e->d[].p destinations */
+ for (i = 0; i < NUM_DESTS; i++)
+ {
+ mp_size_t offset = 0;
+
+ /* possible room for overlapping sources */
+ for (j = 0; j < numberof (overlap->s); j++)
+ if (overlap->s[j] == i)
+ offset = MAX (offset, s[j].align);
+
+ if (d[i].high)
+ {
+ if (tr->dst_bytes[i])
+ {
+ e->d[i].p = (mp_ptr)
+ ((char *) (e->d[i].region.ptr + e->d[i].region.size)
+ - d[i].size - d[i].align);
+ }
+ else
+ {
+ e->d[i].p = e->d[i].region.ptr + e->d[i].region.size
+ - d[i].size - d[i].align;
+ if (tr->overlap == OVERLAP_LOW_TO_HIGH)
+ e->d[i].p -= offset;
+ }
+ }
+ else
+ {
+ if (tr->dst_bytes[i])
+ {
+ e->d[i].p = (mp_ptr) ((char *) e->d[i].region.ptr + d[i].align);
+ }
+ else
+ {
+ e->d[i].p = e->d[i].region.ptr + d[i].align;
+ if (tr->overlap == OVERLAP_HIGH_TO_LOW)
+ e->d[i].p += offset;
+ }
+ }
+ }
+
+ /* establish e->s[].p sources */
+ for (i = 0; i < NUM_SOURCES; i++)
+ {
+ int o = overlap->s[i];
+ switch (o) {
+ case -1:
+ /* no overlap */
+ e->s[i].p = s[i].p;
+ break;
+ case 0:
+ case 1:
+ /* overlap with d[o] */
+ if (tr->overlap == OVERLAP_HIGH_TO_LOW)
+ e->s[i].p = e->d[o].p - s[i].align;
+ else if (tr->overlap == OVERLAP_LOW_TO_HIGH)
+ e->s[i].p = e->d[o].p + s[i].align;
+ else if (tr->size2 == SIZE_FRACTION)
+ e->s[i].p = e->d[o].p + size2;
+ else
+ e->s[i].p = e->d[o].p;
+ break;
+ default:
+ abort();
+ break;
+ }
+ }
+}
+
+
+void
+validate_fail (void)
+{
+ if (tr->reference)
+ {
+ trap_location = TRAP_REF;
+ call (&ref, tr->reference);
+ trap_location = TRAP_NOWHERE;
+ }
+
+ print_all();
+ abort();
+}
+
+
+void
+try_one (void)
+{
+ int i;
+
+ if (option_spinner)
+ spinner();
+ spinner_count++;
+
+ trap_location = TRAP_SETUPS;
+
+ if (tr->divisor == DIVISOR_NORM)
+ divisor |= GMP_NUMB_HIGHBIT;
+ if (tr->divisor == DIVISOR_ODD)
+ divisor |= 1;
+
+ for (i = 0; i < NUM_SOURCES; i++)
+ {
+ if (s[i].high)
+ s[i].p = s[i].region.ptr + s[i].region.size - SRC_SIZE(i) - s[i].align;
+ else
+ s[i].p = s[i].region.ptr + s[i].align;
+ }
+
+ pointer_setup (&ref);
+ pointer_setup (&fun);
+
+ ref.retval = 0x04152637;
+ fun.retval = 0x8C9DAEBF;
+
+ t_random (multiplier_N, tr->msize);
+
+ for (i = 0; i < NUM_SOURCES; i++)
+ {
+ if (! tr->src[i])
+ continue;
+
+ mprotect_region (&s[i].region, PROT_READ|PROT_WRITE);
+ t_random (s[i].p, SRC_SIZE(i));
+
+ switch (tr->data) {
+ case DATA_NON_ZERO:
+ if (refmpn_zero_p (s[i].p, SRC_SIZE(i)))
+ s[i].p[0] = 1;
+ break;
+
+ case DATA_MULTIPLE_DIVISOR:
+ /* same number of low zero bits as divisor */
+ s[i].p[0] &= ~ LOW_ZEROS_MASK (divisor);
+ refmpn_sub_1 (s[i].p, s[i].p, size,
+ refmpn_mod_1 (s[i].p, size, divisor));
+ break;
+
+ case DATA_GCD:
+ /* s[1] no more bits than s[0] */
+ if (i == 1 && size2 == size)
+ s[1].p[size-1] &= refmpn_msbone_mask (s[0].p[size-1]);
+
+ /* high limb non-zero */
+ s[i].p[SRC_SIZE(i)-1] += (s[i].p[SRC_SIZE(i)-1] == 0);
+
+ /* odd */
+ s[i].p[0] |= 1;
+ break;
+
+ case DATA_SRC0_ODD:
+ if (i == 0)
+ s[i].p[0] |= 1;
+ break;
+
+ case DATA_SRC1_ODD:
+ if (i == 1)
+ s[i].p[0] |= 1;
+ break;
+
+ case DATA_SRC1_ODD_PRIME:
+ if (i == 1)
+ {
+ if (refmpn_zero_p (s[i].p+1, SRC_SIZE(i)-1)
+ && s[i].p[0] <=3)
+ s[i].p[0] = 3;
+ else
+ {
+ mpz_t p;
+ mpz_init (p);
+ for (;;)
+ {
+ _mpz_realloc (p, SRC_SIZE(i));
+ MPN_COPY (PTR(p), s[i].p, SRC_SIZE(i));
+ SIZ(p) = SRC_SIZE(i);
+ MPN_NORMALIZE (PTR(p), SIZ(p));
+ mpz_nextprime (p, p);
+ if (mpz_size (p) <= SRC_SIZE(i))
+ break;
+
+ t_random (s[i].p, SRC_SIZE(i));
+ }
+ MPN_COPY (s[i].p, PTR(p), SIZ(p));
+ if (SIZ(p) < SRC_SIZE(i))
+ MPN_ZERO (s[i].p + SIZ(p), SRC_SIZE(i) - SIZ(p));
+ mpz_clear (p);
+ }
+ }
+ break;
+
+ case DATA_SRC1_HIGHBIT:
+ if (i == 1)
+ {
+ if (tr->size2)
+ s[i].p[size2-1] |= GMP_NUMB_HIGHBIT;
+ else
+ s[i].p[size-1] |= GMP_NUMB_HIGHBIT;
+ }
+ break;
+
+ case DATA_SRC0_HIGHBIT:
+ if (i == 0)
+ {
+ s[i].p[size-1] |= GMP_NUMB_HIGHBIT;
+ }
+ break;
+
+ case DATA_UDIV_QRNND:
+ s[i].p[1] %= divisor;
+ break;
+ case DATA_DIV_QR_1:
+ if (i == 1)
+ s[i].p[0] %= divisor;
+ break;
+ }
+
+ mprotect_region (&s[i].region, PROT_READ);
+ }
+
+ for (i = 0; i < NUM_DESTS; i++)
+ {
+ if (! tr->dst[i])
+ continue;
+
+ if (tr->dst0_from_src1 && i==0)
+ {
+ mp_size_t copy = MIN (d[0].size, SRC_SIZE(1));
+ mp_size_t fill = MAX (0, d[0].size - copy);
+ MPN_COPY (fun.d[0].p, s[1].region.ptr, copy);
+ MPN_COPY (ref.d[0].p, s[1].region.ptr, copy);
+ refmpn_fill (fun.d[0].p + copy, fill, DEADVAL);
+ refmpn_fill (ref.d[0].p + copy, fill, DEADVAL);
+ }
+ else if (tr->dst_bytes[i])
+ {
+ memset (ref.d[i].p, 0xBA, d[i].size);
+ memset (fun.d[i].p, 0xBA, d[i].size);
+ }
+ else
+ {
+ refmpn_fill (ref.d[i].p, d[i].size, DEADVAL);
+ refmpn_fill (fun.d[i].p, d[i].size, DEADVAL);
+ }
+ }
+
+ for (i = 0; i < NUM_SOURCES; i++)
+ {
+ if (! tr->src[i])
+ continue;
+
+ if (ref.s[i].p != s[i].p)
+ {
+ refmpn_copyi (ref.s[i].p, s[i].p, SRC_SIZE(i));
+ refmpn_copyi (fun.s[i].p, s[i].p, SRC_SIZE(i));
+ }
+ }
+
+ if (option_print)
+ print_all();
+
+ if (tr->validate != NULL)
+ {
+ trap_location = TRAP_FUN;
+ call (&fun, choice->function);
+ trap_location = TRAP_NOWHERE;
+
+ if (! CALLING_CONVENTIONS_CHECK ())
+ {
+ print_all();
+ abort();
+ }
+
+ (*tr->validate) ();
+ }
+ else
+ {
+ trap_location = TRAP_REF;
+ call (&ref, tr->reference);
+ trap_location = TRAP_FUN;
+ call (&fun, choice->function);
+ trap_location = TRAP_NOWHERE;
+
+ if (! CALLING_CONVENTIONS_CHECK ())
+ {
+ print_all();
+ abort();
+ }
+
+ compare ();
+ }
+}
+
+
+#define SIZE_ITERATION \
+ for (size = MAX3 (option_firstsize, \
+ choice->minsize, \
+ (tr->size == SIZE_ALLOW_ZERO) ? 0 : 1), \
+ size += (tr->size == SIZE_ODD) && !(size & 1); \
+ size <= option_lastsize; \
+ size += (tr->size == SIZE_ODD) ? 2 : 1)
+
+#define SIZE2_FIRST \
+ (tr->size2 == SIZE_2 ? 2 \
+ : tr->size2 == SIZE_FRACTION ? option_firstsize2 \
+ : tr->size2 == SIZE_CEIL_HALF ? ((size + 1) / 2) \
+ : tr->size2 ? \
+ MAX (choice->minsize, (option_firstsize2 != 0 \
+ ? option_firstsize2 : 1)) \
+ : 0)
+
+#define SIZE2_LAST \
+ (tr->size2 == SIZE_2 ? 2 \
+ : tr->size2 == SIZE_FRACTION ? FRACTION_COUNT-1 \
+ : tr->size2 == SIZE_CEIL_HALF ? ((size + 1) / 2) \
+ : tr->size2 ? size \
+ : 0)
+
+#define SIZE2_ITERATION \
+ for (size2 = SIZE2_FIRST; size2 <= SIZE2_LAST; size2++)
+
+#define ALIGN_COUNT(cond) ((cond) ? ALIGNMENTS : 1)
+#define ALIGN_ITERATION(w,n,cond) \
+ for (w[n].align = 0; w[n].align < ALIGN_COUNT(cond); w[n].align++)
+
+#define HIGH_LIMIT(cond) ((cond) != 0)
+#define HIGH_COUNT(cond) (HIGH_LIMIT (cond) + 1)
+#define HIGH_ITERATION(w,n,cond) \
+ for (w[n].high = 0; w[n].high <= HIGH_LIMIT(cond); w[n].high++)
+
+#define SHIFT_LIMIT \
+ ((unsigned long) (tr->shift ? GMP_NUMB_BITS -1 : 1))
+
+#define SHIFT_ITERATION \
+ for (shift = 1; shift <= SHIFT_LIMIT; shift++)
+
+
+void
+try_many (void)
+{
+ int i;
+
+ {
+ unsigned long total = 1;
+
+ total *= option_repetitions;
+ total *= option_lastsize;
+ if (tr->size2 == SIZE_FRACTION) total *= FRACTION_COUNT;
+ else if (tr->size2) total *= (option_lastsize+1)/2;
+
+ total *= SHIFT_LIMIT;
+ total *= MULTIPLIER_COUNT;
+ total *= DIVISOR_COUNT;
+ total *= CARRY_COUNT;
+ total *= T_RAND_COUNT;
+
+ total *= HIGH_COUNT (tr->dst[0]);
+ total *= HIGH_COUNT (tr->dst[1]);
+ total *= HIGH_COUNT (tr->src[0]);
+ total *= HIGH_COUNT (tr->src[1]);
+
+ total *= ALIGN_COUNT (tr->dst[0]);
+ total *= ALIGN_COUNT (tr->dst[1]);
+ total *= ALIGN_COUNT (tr->src[0]);
+ total *= ALIGN_COUNT (tr->src[1]);
+
+ total *= OVERLAP_COUNT;
+
+ printf ("%s %lu\n", choice->name, total);
+ }
+
+ spinner_count = 0;
+
+ for (i = 0; i < option_repetitions; i++)
+ SIZE_ITERATION
+ SIZE2_ITERATION
+
+ SHIFT_ITERATION
+ MULTIPLIER_ITERATION
+ DIVISOR_ITERATION
+ CARRY_ITERATION /* must be after divisor */
+ T_RAND_ITERATION
+
+ HIGH_ITERATION(d,0, tr->dst[0])
+ HIGH_ITERATION(d,1, tr->dst[1])
+ HIGH_ITERATION(s,0, tr->src[0])
+ HIGH_ITERATION(s,1, tr->src[1])
+
+ ALIGN_ITERATION(d,0, tr->dst[0])
+ ALIGN_ITERATION(d,1, tr->dst[1])
+ ALIGN_ITERATION(s,0, tr->src[0])
+ ALIGN_ITERATION(s,1, tr->src[1])
+
+ OVERLAP_ITERATION
+ try_one();
+
+ printf("\n");
+}
+
+
+/* Usually print_all() doesn't show much, but it might give a hint as to
+ where the function was up to when it died. */
+void
+trap (int sig)
+{
+ const char *name = "noname";
+
+ switch (sig) {
+ case SIGILL: name = "SIGILL"; break;
+#ifdef SIGBUS
+ case SIGBUS: name = "SIGBUS"; break;
+#endif
+ case SIGSEGV: name = "SIGSEGV"; break;
+ case SIGFPE: name = "SIGFPE"; break;
+ }
+
+ printf ("\n\nSIGNAL TRAP: %s\n", name);
+
+ switch (trap_location) {
+ case TRAP_REF:
+ printf (" in reference function: %s\n", tr->reference_name);
+ break;
+ case TRAP_FUN:
+ printf (" in test function: %s\n", choice->name);
+ print_all ();
+ break;
+ case TRAP_SETUPS:
+ printf (" in parameter setups\n");
+ print_all ();
+ break;
+ default:
+ printf (" somewhere unknown\n");
+ break;
+ }
+ exit (1);
+}
+
+
+void
+try_init (void)
+{
+#if HAVE_GETPAGESIZE
+ /* Prefer getpagesize() over sysconf(), since on SunOS 4 sysconf() doesn't
+ know _SC_PAGESIZE. */
+ pagesize = getpagesize ();
+#else
+#if HAVE_SYSCONF
+ if ((pagesize = sysconf (_SC_PAGESIZE)) == -1)
+ {
+ /* According to the linux man page, sysconf doesn't set errno */
+ fprintf (stderr, "Cannot get sysconf _SC_PAGESIZE\n");
+ exit (1);
+ }
+#else
+Error, error, cannot get page size
+#endif
+#endif
+
+ printf ("pagesize is 0x%lX bytes\n", pagesize);
+
+ signal (SIGILL, trap);
+#ifdef SIGBUS
+ signal (SIGBUS, trap);
+#endif
+ signal (SIGSEGV, trap);
+ signal (SIGFPE, trap);
+
+ {
+ int i;
+
+ for (i = 0; i < NUM_SOURCES; i++)
+ {
+ malloc_region (&s[i].region, 2*option_lastsize+ALIGNMENTS-1);
+ printf ("s[%d] %p to %p (0x%lX bytes)\n",
+ i, (void *) (s[i].region.ptr),
+ (void *) (s[i].region.ptr + s[i].region.size),
+ (long) s[i].region.size * GMP_LIMB_BYTES);
+ }
+
+#define INIT_EACH(e,es) \
+ for (i = 0; i < NUM_DESTS; i++) \
+ { \
+ malloc_region (&e.d[i].region, 2*option_lastsize+ALIGNMENTS-1); \
+ printf ("%s d[%d] %p to %p (0x%lX bytes)\n", \
+ es, i, (void *) (e.d[i].region.ptr), \
+ (void *) (e.d[i].region.ptr + e.d[i].region.size), \
+ (long) e.d[i].region.size * GMP_LIMB_BYTES); \
+ }
+
+ INIT_EACH(ref, "ref");
+ INIT_EACH(fun, "fun");
+ }
+}
+
+int
+strmatch_wild (const char *pattern, const char *str)
+{
+ size_t plen, slen;
+
+ /* wildcard at start */
+ if (pattern[0] == '*')
+ {
+ pattern++;
+ plen = strlen (pattern);
+ slen = strlen (str);
+ return (plen == 0
+ || (slen >= plen && memcmp (pattern, str+slen-plen, plen) == 0));
+ }
+
+ /* wildcard at end */
+ plen = strlen (pattern);
+ if (plen >= 1 && pattern[plen-1] == '*')
+ return (memcmp (pattern, str, plen-1) == 0);
+
+ /* no wildcards */
+ return (strcmp (pattern, str) == 0);
+}
+
+void
+try_name (const char *name)
+{
+ int found = 0;
+ int i;
+
+ for (i = 0; i < numberof (choice_array); i++)
+ {
+ if (strmatch_wild (name, choice_array[i].name))
+ {
+ choice = &choice_array[i];
+ tr = &param[choice->type];
+ try_many ();
+ found = 1;
+ }
+ }
+
+ if (!found)
+ {
+ printf ("%s unknown\n", name);
+ /* exit (1); */
+ }
+}
+
+
+void
+usage (const char *prog)
+{
+ int col = 0;
+ int i;
+
+ printf ("Usage: %s [options] function...\n", prog);
+ printf (" -1 use limb data 1,2,3,etc\n");
+ printf (" -9 use limb data all 0xFF..FFs\n");
+ printf (" -a zeros use limb data all zeros\n");
+ printf (" -a ffs use limb data all 0xFF..FFs (same as -9)\n");
+ printf (" -a 2fd use data 0x2FFF...FFFD\n");
+ printf (" -p print each case tried (try this if seg faulting)\n");
+ printf (" -R seed random numbers from time()\n");
+ printf (" -r reps set repetitions (default %d)\n", DEFAULT_REPETITIONS);
+ printf (" -s size starting size to test\n");
+ printf (" -S size2 starting size2 to test\n");
+ printf (" -s s1-s2 range of sizes to test\n");
+ printf (" -W don't show the spinner (use this in gdb)\n");
+ printf (" -z disable mprotect() redzones\n");
+ printf ("Default data is refmpn_random() and refmpn_random2().\n");
+ printf ("\n");
+ printf ("Functions that can be tested:\n");
+
+ for (i = 0; i < numberof (choice_array); i++)
+ {
+ if (col + 1 + strlen (choice_array[i].name) > 79)
+ {
+ printf ("\n");
+ col = 0;
+ }
+ printf (" %s", choice_array[i].name);
+ col += 1 + strlen (choice_array[i].name);
+ }
+ printf ("\n");
+
+ exit(1);
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ int i;
+
+ /* unbuffered output */
+ setbuf (stdout, NULL);
+ setbuf (stderr, NULL);
+
+ /* default trace in hex, and in upper-case so can paste into bc */
+ mp_trace_base = -16;
+
+ param_init ();
+
+ {
+ unsigned long seed = 123;
+ int opt;
+
+ while ((opt = getopt(argc, argv, "19a:b:E:pRr:S:s:Wz")) != EOF)
+ {
+ switch (opt) {
+ case '1':
+ /* use limb data values 1, 2, 3, ... etc */
+ option_data = DATA_SEQ;
+ break;
+ case '9':
+ /* use limb data values 0xFFF...FFF always */
+ option_data = DATA_FFS;
+ break;
+ case 'a':
+ if (strcmp (optarg, "zeros") == 0) option_data = DATA_ZEROS;
+ else if (strcmp (optarg, "seq") == 0) option_data = DATA_SEQ;
+ else if (strcmp (optarg, "ffs") == 0) option_data = DATA_FFS;
+ else if (strcmp (optarg, "2fd") == 0) option_data = DATA_2FD;
+ else
+ {
+ fprintf (stderr, "unrecognised data option: %s\n", optarg);
+ exit (1);
+ }
+ break;
+ case 'b':
+ mp_trace_base = atoi (optarg);
+ break;
+ case 'E':
+ /* re-seed */
+ sscanf (optarg, "%lu", &seed);
+ printf ("Re-seeding with %lu\n", seed);
+ break;
+ case 'p':
+ option_print = 1;
+ break;
+ case 'R':
+ /* randomize */
+ seed = time (NULL);
+ printf ("Seeding with %lu, re-run using \"-E %lu\"\n", seed, seed);
+ break;
+ case 'r':
+ option_repetitions = atoi (optarg);
+ break;
+ case 's':
+ {
+ char *p;
+ option_firstsize = strtol (optarg, 0, 0);
+ if ((p = strchr (optarg, '-')) != NULL)
+ option_lastsize = strtol (p+1, 0, 0);
+ }
+ break;
+ case 'S':
+ /* -S <size> sets the starting size for the second of a two size
+ routine (like mpn_mul_basecase) */
+ option_firstsize2 = strtol (optarg, 0, 0);
+ break;
+ case 'W':
+ /* use this when running in the debugger */
+ option_spinner = 0;
+ break;
+ case 'z':
+ /* disable redzones */
+ option_redzones = 0;
+ break;
+ case '?':
+ usage (argv[0]);
+ break;
+ }
+ }
+
+ gmp_randinit_default (__gmp_rands);
+ __gmp_rands_initialized = 1;
+ gmp_randseed_ui (__gmp_rands, seed);
+ }
+
+ try_init();
+
+ if (argc <= optind)
+ usage (argv[0]);
+
+ for (i = optind; i < argc; i++)
+ try_name (argv[i]);
+
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/memory.c b/vendor/gmp-6.3.0/tests/memory.c
new file mode 100644
index 0000000..4ab54b7
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/memory.c
@@ -0,0 +1,246 @@
+/* Memory allocation used during tests.
+
+Copyright 2001, 2002, 2007, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h> /* for abort */
+#include <string.h> /* for memcpy, memcmp */
+#include "gmp-impl.h"
+#include "tests.h"
+
+#if GMP_LIMB_BITS == 64
+#define PATTERN1 CNST_LIMB(0xcafebabedeadbeef)
+#define PATTERN2 CNST_LIMB(0xabacadabaedeedab)
+#else
+#define PATTERN1 CNST_LIMB(0xcafebabe)
+#define PATTERN2 CNST_LIMB(0xdeadbeef)
+#endif
+
+#if HAVE_INTPTR_T
+#define PTRLIMB(p) ((mp_limb_t) (intptr_t) p)
+#else
+#define PTRLIMB(p) ((mp_limb_t) (size_t) p)
+#endif
+
+/* Each block allocated is a separate malloc, for the benefit of a redzoning
+ malloc debugger during development or when bug hunting.
+
+ Sizes passed when reallocating or freeing are checked (the default
+ routines don't care about these).
+
+ Memory leaks are checked by requiring that all blocks have been freed
+ when tests_memory_end() is called. Test programs must be sure to have
+ "clear"s for all temporary variables used. */
+
+
+struct header {
+ void *ptr;
+ size_t size;
+ struct header *next;
+};
+
+struct header *tests_memory_list = NULL;
+
+/* Return a pointer to a pointer to the found block (so it can be updated
+ when unlinking). */
+struct header **
+tests_memory_find (void *ptr)
+{
+ struct header **hp;
+
+ for (hp = &tests_memory_list; *hp != NULL; hp = &((*hp)->next))
+ if ((*hp)->ptr == ptr)
+ return hp;
+
+ return NULL;
+}
+
+int
+tests_memory_valid (void *ptr)
+{
+ return (tests_memory_find (ptr) != NULL);
+}
+
+void *
+tests_allocate (size_t size)
+{
+ struct header *h;
+ void *rptr, *ptr;
+ mp_limb_t PATTERN2_var;
+
+ if (size == 0)
+ {
+ fprintf (stderr, "tests_allocate(): attempt to allocate 0 bytes\n");
+ abort ();
+ }
+
+ h = (struct header *) __gmp_default_allocate (sizeof (*h));
+ h->next = tests_memory_list;
+ tests_memory_list = h;
+
+ rptr = __gmp_default_allocate (size + 2 * sizeof (mp_limb_t));
+ ptr = (void *) ((gmp_intptr_t) rptr + sizeof (mp_limb_t));
+
+ *((mp_limb_t *) ((gmp_intptr_t) ptr - sizeof (mp_limb_t)))
+ = PATTERN1 - PTRLIMB (ptr);
+ PATTERN2_var = PATTERN2 - PTRLIMB (ptr);
+ memcpy ((void *) ((gmp_intptr_t) ptr + size), &PATTERN2_var, sizeof (mp_limb_t));
+
+ h->size = size;
+ h->ptr = ptr;
+ return h->ptr;
+}
+
+void *
+tests_reallocate (void *ptr, size_t old_size, size_t new_size)
+{
+ struct header **hp, *h;
+ void *rptr;
+ mp_limb_t PATTERN2_var;
+
+ if (new_size == 0)
+ {
+ fprintf (stderr, "tests_reallocate(): attempt to reallocate %p to 0 bytes\n",
+ ptr);
+ abort ();
+ }
+
+ hp = tests_memory_find (ptr);
+ if (hp == NULL)
+ {
+ fprintf (stderr, "tests_reallocate(): attempt to reallocate bad pointer %p\n",
+ ptr);
+ abort ();
+ }
+ h = *hp;
+
+ if (h->size != old_size)
+ {
+ fprintf (stderr, "tests_reallocate(): bad old size %lu, should be %lu\n",
+ (unsigned long) old_size, (unsigned long) h->size);
+ abort ();
+ }
+
+ if (*((mp_limb_t *) ((gmp_intptr_t) ptr - sizeof (mp_limb_t)))
+ != PATTERN1 - PTRLIMB (ptr))
+ {
+ fprintf (stderr, "in realloc: redzone clobbered before block\n");
+ abort ();
+ }
+ PATTERN2_var = PATTERN2 - PTRLIMB (ptr);
+ if (memcmp ((void *) ((gmp_intptr_t) ptr + h->size), &PATTERN2_var, sizeof (mp_limb_t)))
+ {
+ fprintf (stderr, "in realloc: redzone clobbered after block\n");
+ abort ();
+ }
+
+ rptr = __gmp_default_reallocate ((void *) ((gmp_intptr_t) ptr - sizeof (mp_limb_t)),
+ old_size + 2 * sizeof (mp_limb_t),
+ new_size + 2 * sizeof (mp_limb_t));
+ ptr = (void *) ((gmp_intptr_t) rptr + sizeof (mp_limb_t));
+
+ *((mp_limb_t *) ((gmp_intptr_t) ptr - sizeof (mp_limb_t)))
+ = PATTERN1 - PTRLIMB (ptr);
+ PATTERN2_var = PATTERN2 - PTRLIMB (ptr);
+ memcpy ((void *) ((gmp_intptr_t) ptr + new_size), &PATTERN2_var, sizeof (mp_limb_t));
+
+ h->size = new_size;
+ h->ptr = ptr;
+ return h->ptr;
+}
+
+struct header **
+tests_free_find (void *ptr)
+{
+ struct header **hp = tests_memory_find (ptr);
+ if (hp == NULL)
+ {
+ fprintf (stderr, "tests_free(): attempt to free bad pointer %p\n",
+ ptr);
+ abort ();
+ }
+ return hp;
+}
+
+void
+tests_free_nosize (void *ptr)
+{
+ struct header **hp = tests_free_find (ptr);
+ struct header *h = *hp;
+ mp_limb_t PATTERN2_var;
+
+ *hp = h->next; /* unlink */
+
+ if (*((mp_limb_t *) ((gmp_intptr_t) ptr - sizeof (mp_limb_t)))
+ != PATTERN1 - PTRLIMB (ptr))
+ {
+ fprintf (stderr, "in free: redzone clobbered before block\n");
+ abort ();
+ }
+ PATTERN2_var = PATTERN2 - PTRLIMB (ptr);
+ if (memcmp ((void *) ((gmp_intptr_t) ptr + h->size), &PATTERN2_var, sizeof (mp_limb_t)))
+ {
+ fprintf (stderr, "in free: redzone clobbered after block\n");
+ abort ();
+ }
+
+ __gmp_default_free ((void *) ((gmp_intptr_t) ptr - sizeof(mp_limb_t)),
+ h->size + 2 * sizeof (mp_limb_t));
+ __gmp_default_free (h, sizeof (*h));
+}
+
+void
+tests_free (void *ptr, size_t size)
+{
+ struct header **hp = tests_free_find (ptr);
+ struct header *h = *hp;
+
+ if (h->size != size)
+ {
+ fprintf (stderr, "tests_free(): bad size %lu, should be %lu\n",
+ (unsigned long) size, (unsigned long) h->size);
+ abort ();
+ }
+
+ tests_free_nosize (ptr);
+}
+
+void
+tests_memory_start (void)
+{
+ mp_set_memory_functions (tests_allocate, tests_reallocate, tests_free);
+}
+
+void
+tests_memory_end (void)
+{
+ if (tests_memory_list != NULL)
+ {
+ struct header *h;
+ unsigned count;
+
+ fprintf (stderr, "tests_memory_end(): not all memory freed\n");
+
+ count = 0;
+ for (h = tests_memory_list; h != NULL; h = h->next)
+ count++;
+
+ fprintf (stderr, " %u blocks remaining\n", count);
+ abort ();
+ }
+}
diff --git a/vendor/gmp-6.3.0/tests/misc.c b/vendor/gmp-6.3.0/tests/misc.c
new file mode 100644
index 0000000..6c40d78
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/misc.c
@@ -0,0 +1,608 @@
+/* Miscellaneous test program support routines.
+
+Copyright 2000-2003, 2005, 2013, 2015, 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <ctype.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h> /* for getenv */
+#include <string.h>
+
+#if HAVE_FLOAT_H
+#include <float.h> /* for DBL_MANT_DIG */
+#endif
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h> /* for struct timeval */
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+/* The various tests setups and final checks, collected up together. */
+void
+tests_start (void)
+{
+ char version[10];
+ snprintf (version, 10, "%u.%u.%u",
+ __GNU_MP_VERSION,
+ __GNU_MP_VERSION_MINOR,
+ __GNU_MP_VERSION_PATCHLEVEL);
+
+ if (strcmp (gmp_version, version) != 0)
+ {
+ fprintf (stderr, "tests are not linked to the newly compiled library\n");
+ fprintf (stderr, " local version is: %s\n", version);
+ fprintf (stderr, " linked version is: %s\n", gmp_version);
+ abort ();
+ }
+
+ /* don't buffer, so output is not lost if a test causes a segv etc */
+ setbuf (stdout, NULL);
+ setbuf (stderr, NULL);
+
+ tests_memory_start ();
+ tests_rand_start ();
+}
+void
+tests_end (void)
+{
+ tests_rand_end ();
+ tests_memory_end ();
+}
+
+static void
+seed_from_tod (gmp_randstate_ptr rands)
+{
+ unsigned long seed;
+#if HAVE_GETTIMEOFDAY
+ struct timeval tv;
+ gettimeofday (&tv, NULL);
+ seed = tv.tv_sec ^ ((unsigned long) tv.tv_usec << 12);
+ seed &= 0xffffffff;
+#else
+ time_t tv;
+ time (&tv);
+ seed = tv;
+#endif
+ gmp_randseed_ui (rands, seed);
+ printf ("Seed GMP_CHECK_RANDOMIZE=%lu (include this in bug reports)\n", seed);
+}
+
+static void
+seed_from_urandom (gmp_randstate_ptr rands, FILE *fs)
+{
+ mpz_t seed;
+ unsigned char buf[6];
+ fread (buf, 1, 6, fs);
+ mpz_init (seed);
+ mpz_import (seed, 6, 1, 1, 0, 0, buf);
+ gmp_randseed (rands, seed);
+ gmp_printf ("Seed GMP_CHECK_RANDOMIZE=%Zd (include this in bug reports)\n", seed);
+ mpz_clear (seed);
+}
+
+void
+tests_rand_start (void)
+{
+ gmp_randstate_ptr rands;
+ char *seed_string;
+
+ if (__gmp_rands_initialized)
+ {
+ printf ("Please let tests_start() initialize the global __gmp_rands.\n");
+ printf ("ie. ensure that function is called before the first use of RANDS.\n");
+ abort ();
+ }
+
+ gmp_randinit_default (__gmp_rands);
+ __gmp_rands_initialized = 1;
+ rands = __gmp_rands;
+
+ seed_string = getenv ("GMP_CHECK_RANDOMIZE");
+ if (seed_string != NULL)
+ {
+ if (strcmp (seed_string, "0") != 0 &&
+ strcmp (seed_string, "1") != 0)
+ {
+ mpz_t seed;
+ mpz_init_set_str (seed, seed_string, 0);
+ gmp_printf ("Re-seeding with GMP_CHECK_RANDOMIZE=%Zd\n", seed);
+ gmp_randseed (rands, seed);
+ mpz_clear (seed);
+ }
+ else
+ {
+ FILE *fs = fopen ("/dev/urandom", "r");
+ if (fs != NULL)
+ {
+ seed_from_urandom (rands, fs);
+ fclose (fs);
+ }
+ else
+ seed_from_tod (rands);
+ }
+ fflush (stdout);
+ }
+}
+void
+tests_rand_end (void)
+{
+ RANDS_CLEAR ();
+}
+
+
+/* Only used if CPU calling conventions checking is available. */
+mp_limb_t (*calling_conventions_function) (ANYARGS);
+
+
+/* Return p advanced to the next multiple of "align" bytes. "align" must be
+ a power of 2. Care is taken not to assume sizeof(int)==sizeof(pointer).
+ Using "unsigned long" avoids a warning on hpux. */
+void *
+align_pointer (void *p, size_t align)
+{
+ gmp_intptr_t d;
+ d = ((gmp_intptr_t) p) & (align-1);
+ d = (d != 0 ? align-d : 0);
+ return (void *) (((char *) p) + d);
+}
+
+
+/* Note that memory allocated with this function can never be freed, because
+ the start address of the block allocated is lost. */
+void *
+__gmp_allocate_func_aligned (size_t bytes, size_t align)
+{
+ return align_pointer ((*__gmp_allocate_func) (bytes + align-1), align);
+}
+
+
+void *
+__gmp_allocate_or_reallocate (void *ptr, size_t oldsize, size_t newsize)
+{
+ if (ptr == NULL)
+ return (*__gmp_allocate_func) (newsize);
+ else
+ return (*__gmp_reallocate_func) (ptr, oldsize, newsize);
+}
+
+char *
+__gmp_allocate_strdup (const char *s)
+{
+ size_t len;
+ char *t;
+ len = strlen (s);
+ t = (char *) (*__gmp_allocate_func) (len+1);
+ memcpy (t, s, len+1);
+ return t;
+}
+
+
+char *
+strtoupper (char *s_orig)
+{
+ char *s;
+ for (s = s_orig; *s != '\0'; s++)
+ if (islower (*s))
+ *s = toupper (*s);
+ return s_orig;
+}
+
+
+void
+mpz_set_n (mpz_ptr z, mp_srcptr p, mp_size_t size)
+{
+ ASSERT (size >= 0);
+ MPN_NORMALIZE (p, size);
+ MPZ_REALLOC (z, size);
+ MPN_COPY (PTR(z), p, size);
+ SIZ(z) = size;
+}
+
+void
+mpz_init_set_n (mpz_ptr z, mp_srcptr p, mp_size_t size)
+{
+ ASSERT (size >= 0);
+
+ MPN_NORMALIZE (p, size);
+ ALLOC(z) = MAX (size, 1);
+ PTR(z) = __GMP_ALLOCATE_FUNC_LIMBS (ALLOC(z));
+ SIZ(z) = size;
+ MPN_COPY (PTR(z), p, size);
+}
+
+
+/* Find least significant limb position where p1,size and p2,size differ. */
+mp_size_t
+mpn_diff_lowest (mp_srcptr p1, mp_srcptr p2, mp_size_t size)
+{
+ mp_size_t i;
+
+ for (i = 0; i < size; i++)
+ if (p1[i] != p2[i])
+ return i;
+
+ /* no differences */
+ return -1;
+}
+
+
+/* Find most significant limb position where p1,size and p2,size differ. */
+mp_size_t
+mpn_diff_highest (mp_srcptr p1, mp_srcptr p2, mp_size_t size)
+{
+ mp_size_t i;
+
+ for (i = size-1; i >= 0; i--)
+ if (p1[i] != p2[i])
+ return i;
+
+ /* no differences */
+ return -1;
+}
+
+
+/* Find least significant byte position where p1,size and p2,size differ. */
+mp_size_t
+byte_diff_lowest (const void *p1, const void *p2, mp_size_t size)
+{
+ mp_size_t i;
+
+ for (i = 0; i < size; i++)
+ if (((const char *) p1)[i] != ((const char *) p2)[i])
+ return i;
+
+ /* no differences */
+ return -1;
+}
+
+
+/* Find most significant byte position where p1,size and p2,size differ. */
+mp_size_t
+byte_diff_highest (const void *p1, const void *p2, mp_size_t size)
+{
+ mp_size_t i;
+
+ for (i = size-1; i >= 0; i--)
+ if (((const char *) p1)[i] != ((const char *) p2)[i])
+ return i;
+
+ /* no differences */
+ return -1;
+}
+
+
+void
+mpz_set_str_or_abort (mpz_ptr z, const char *str, int base)
+{
+ if (mpz_set_str (z, str, base) != 0)
+ {
+ fprintf (stderr, "ERROR: mpz_set_str failed\n");
+ fprintf (stderr, " str = \"%s\"\n", str);
+ fprintf (stderr, " base = %d\n", base);
+ abort();
+ }
+}
+
+void
+mpq_set_str_or_abort (mpq_ptr q, const char *str, int base)
+{
+ if (mpq_set_str (q, str, base) != 0)
+ {
+ fprintf (stderr, "ERROR: mpq_set_str failed\n");
+ fprintf (stderr, " str = \"%s\"\n", str);
+ fprintf (stderr, " base = %d\n", base);
+ abort();
+ }
+}
+
+void
+mpf_set_str_or_abort (mpf_ptr f, const char *str, int base)
+{
+ if (mpf_set_str (f, str, base) != 0)
+ {
+ fprintf (stderr, "ERROR mpf_set_str failed\n");
+ fprintf (stderr, " str = \"%s\"\n", str);
+ fprintf (stderr, " base = %d\n", base);
+ abort();
+ }
+}
+
+
+/* Whether the absolute value of z is a power of 2. */
+int
+mpz_pow2abs_p (mpz_srcptr z)
+{
+ mp_size_t size, i;
+ mp_srcptr ptr;
+
+ size = SIZ (z);
+ if (size == 0)
+ return 0; /* zero is not a power of 2 */
+ size = ABS (size);
+
+ ptr = PTR (z);
+ for (i = 0; i < size-1; i++)
+ if (ptr[i] != 0)
+ return 0; /* non-zero low limb means not a power of 2 */
+
+ return POW2_P (ptr[i]); /* high limb power of 2 */
+}
+
+
+/* Exponentially distributed between 0 and 2^nbits-1, meaning the number of
+ bits in the result is uniformly distributed between 0 and nbits-1.
+
+ FIXME: This is not a proper exponential distribution, since the
+ probability function will have a stepped shape due to using a uniform
+ distribution after choosing how many bits. */
+
+void
+mpz_erandomb (mpz_ptr rop, gmp_randstate_t rstate, unsigned long nbits)
+{
+ mpz_urandomb (rop, rstate, gmp_urandomm_ui (rstate, nbits));
+}
+
+void
+mpz_erandomb_nonzero (mpz_ptr rop, gmp_randstate_t rstate, unsigned long nbits)
+{
+ mpz_erandomb (rop, rstate, nbits);
+ if (mpz_sgn (rop) == 0)
+ mpz_set_ui (rop, 1L);
+}
+
+void
+mpz_errandomb (mpz_ptr rop, gmp_randstate_t rstate, unsigned long nbits)
+{
+ mpz_rrandomb (rop, rstate, gmp_urandomm_ui (rstate, nbits));
+}
+
+void
+mpz_errandomb_nonzero (mpz_ptr rop, gmp_randstate_t rstate, unsigned long nbits)
+{
+ mpz_errandomb (rop, rstate, nbits);
+ if (mpz_sgn (rop) == 0)
+ mpz_set_ui (rop, 1L);
+}
+
+void
+mpz_negrandom (mpz_ptr rop, gmp_randstate_t rstate)
+{
+ mp_limb_t n;
+ _gmp_rand (&n, rstate, 1);
+ if (n != 0)
+ mpz_neg (rop, rop);
+}
+
+void
+mpz_clobber(mpz_ptr rop)
+{
+ MPN_ZERO(PTR(rop), ALLOC(rop));
+ PTR(rop)[0] = 0xDEADBEEF;
+ SIZ(rop) = 0xDEFACE;
+}
+
+mp_limb_t
+urandom (void)
+{
+#if GMP_NAIL_BITS == 0
+ mp_limb_t n;
+ _gmp_rand (&n, RANDS, GMP_LIMB_BITS);
+ return n;
+#else
+ mp_limb_t n[2];
+ _gmp_rand (n, RANDS, GMP_LIMB_BITS);
+ return n[0] + (n[1] << GMP_NUMB_BITS);
+#endif
+}
+
+
+/* Call (*func)() with various random number generators. */
+void
+call_rand_algs (void (*func) (const char *, gmp_randstate_ptr))
+{
+ gmp_randstate_t rstate;
+ mpz_t a;
+
+ mpz_init (a);
+
+ gmp_randinit_default (rstate);
+ (*func) ("gmp_randinit_default", rstate);
+ gmp_randclear (rstate);
+
+ gmp_randinit_mt (rstate);
+ (*func) ("gmp_randinit_mt", rstate);
+ gmp_randclear (rstate);
+
+ gmp_randinit_lc_2exp_size (rstate, 8L);
+ (*func) ("gmp_randinit_lc_2exp_size 8", rstate);
+ gmp_randclear (rstate);
+
+ gmp_randinit_lc_2exp_size (rstate, 16L);
+ (*func) ("gmp_randinit_lc_2exp_size 16", rstate);
+ gmp_randclear (rstate);
+
+ gmp_randinit_lc_2exp_size (rstate, 128L);
+ (*func) ("gmp_randinit_lc_2exp_size 128", rstate);
+ gmp_randclear (rstate);
+
+ /* degenerate always zeros */
+ mpz_set_ui (a, 0L);
+ gmp_randinit_lc_2exp (rstate, a, 0L, 8L);
+ (*func) ("gmp_randinit_lc_2exp a=0 c=0 m=8", rstate);
+ gmp_randclear (rstate);
+
+ /* degenerate always FFs */
+ mpz_set_ui (a, 0L);
+ gmp_randinit_lc_2exp (rstate, a, 0xFFL, 8L);
+ (*func) ("gmp_randinit_lc_2exp a=0 c=0xFF m=8", rstate);
+ gmp_randclear (rstate);
+
+ mpz_clear (a);
+}
+
+
+/* Return +infinity if available, or 0 if not.
+ We don't want to use libm, so INFINITY or other system values are not
+ used here. */
+double
+tests_infinity_d (void)
+{
+#if _GMP_IEEE_FLOATS
+ union ieee_double_extract x;
+ x.s.exp = 2047;
+ x.s.manl = 0;
+ x.s.manh = 0;
+ x.s.sig = 0;
+ return x.d;
+#else
+ return 0;
+#endif
+}
+
+
+/* Return non-zero if d is an infinity (either positive or negative).
+ Don't want libm, so don't use isinf() or other system tests. */
+int
+tests_isinf (double d)
+{
+#if _GMP_IEEE_FLOATS
+ union ieee_double_extract x;
+ x.d = d;
+ return (x.s.exp == 2047 && x.s.manl == 0 && x.s.manh == 0);
+#else
+ return 0;
+#endif
+}
+
+
+/* Set the hardware floating point rounding mode. Same mode values as mpfr,
+ namely 0=nearest, 1=tozero, 2=up, 3=down. Return 1 if successful, 0 if
+ not. */
+int
+tests_hardware_setround (int mode)
+{
+#if ! defined NO_ASM && HAVE_HOST_CPU_FAMILY_x86
+ int rc;
+ switch (mode) {
+ case 0: rc = 0; break; /* nearest */
+ case 1: rc = 3; break; /* tozero */
+ case 2: rc = 2; break; /* up */
+ case 3: rc = 1; break; /* down */
+ default:
+ return 0;
+ }
+ x86_fldcw ((x86_fstcw () & ~0xC00) | (rc << 10));
+ return 1;
+#endif
+
+ return 0;
+}
+
+/* Return the hardware floating point rounding mode, or -1 if unknown. */
+int
+tests_hardware_getround (void)
+{
+#if ! defined NO_ASM && HAVE_HOST_CPU_FAMILY_x86
+ switch ((x86_fstcw () & ~0xC00) >> 10) {
+ case 0: return 0; break; /* nearest */
+ case 1: return 3; break; /* down */
+ case 2: return 2; break; /* up */
+ case 3: return 1; break; /* tozero */
+ }
+#endif
+
+ return -1;
+}
+
+
+/* tests_dbl_mant_bits() determines by experiment the number of bits in the
+ mantissa of a "double". If it's not possible to find a value (perhaps
+ due to the compiler optimizing too aggressively), then return 0.
+
+ This code is used rather than DBL_MANT_DIG from <float.h> since ancient
+ systems like SunOS don't have that file, and since one GNU/Linux ARM
+ system was seen where the float emulation seemed to have only 32 working
+ bits, not the 53 float.h claimed. */
+
+int
+tests_dbl_mant_bits (void)
+{
+ static int n = -1;
+ volatile double x, y, d;
+
+ if (n != -1)
+ return n;
+
+ n = 1;
+ x = 2.0;
+ for (;;)
+ {
+ /* see if 2^(n+1)+1 can be formed without rounding, if so then
+ continue, if not then "n" is the answer */
+ y = x + 1.0;
+ d = y - x;
+ if (d != 1.0)
+ {
+#if defined (DBL_MANT_DIG) && DBL_RADIX == 2
+ if (n != DBL_MANT_DIG)
+ printf ("Warning, tests_dbl_mant_bits got %d but DBL_MANT_DIG says %d\n", n, DBL_MANT_DIG);
+#endif
+ break;
+ }
+
+ x *= 2;
+ n++;
+
+ if (n > 1000)
+ {
+ printf ("Oops, tests_dbl_mant_bits can't determine mantissa size\n");
+ n = 0;
+ break;
+ }
+ }
+ return n;
+}
+
+
+/* See tests_setjmp_sigfpe in tests.h. */
+
+jmp_buf tests_sigfpe_target;
+
+RETSIGTYPE
+tests_sigfpe_handler (int sig)
+{
+ longjmp (tests_sigfpe_target, 1);
+}
+
+void
+tests_sigfpe_done (void)
+{
+ signal (SIGFPE, SIG_DFL);
+}
diff --git a/vendor/gmp-6.3.0/tests/misc/Makefile.am b/vendor/gmp-6.3.0/tests/misc/Makefile.am
new file mode 100644
index 0000000..9fe6efb
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/misc/Makefile.am
@@ -0,0 +1,34 @@
+## Process this file with automake to generate Makefile.in
+
+# Copyright 2001, 2002 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+
+
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
+AM_LDFLAGS = -no-install
+LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
+
+check_PROGRAMS = t-printf t-scanf t-locale
+TESTS = $(check_PROGRAMS)
+
+# Temporary files used by the tests. Removed automatically if the tests
+# pass, but ensure they're cleaned if they fail.
+#
+CLEANFILES = *.tmp
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
diff --git a/vendor/gmp-6.3.0/tests/misc/Makefile.in b/vendor/gmp-6.3.0/tests/misc/Makefile.in
new file mode 100644
index 0000000..62a5f04
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/misc/Makefile.in
@@ -0,0 +1,1041 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 2001, 2002 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+check_PROGRAMS = t-printf$(EXEEXT) t-scanf$(EXEEXT) t-locale$(EXEEXT)
+subdir = tests/misc
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+t_locale_SOURCES = t-locale.c
+t_locale_OBJECTS = t-locale.$(OBJEXT)
+t_locale_LDADD = $(LDADD)
+t_locale_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+t_printf_SOURCES = t-printf.c
+t_printf_OBJECTS = t-printf.$(OBJEXT)
+t_printf_LDADD = $(LDADD)
+t_printf_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_scanf_SOURCES = t-scanf.c
+t_scanf_OBJECTS = t-scanf.$(OBJEXT)
+t_scanf_LDADD = $(LDADD)
+t_scanf_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = t-locale.c t-printf.c t-scanf.c
+DIST_SOURCES = t-locale.c t-printf.c t-scanf.c
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = { \
+ $(am__tty_colors_dummy); \
+ if test "X$(AM_COLOR_TESTS)" = Xno; then \
+ am__color_tests=no; \
+ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+ am__color_tests=yes; \
+ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+ am__color_tests=yes; \
+ fi; \
+ if test $$am__color_tests = yes; then \
+ red=''; \
+ grn=''; \
+ lgn=''; \
+ blu=''; \
+ mgn=''; \
+ brg=''; \
+ std=''; \
+ fi; \
+}
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__recheck_rx = ^[ ]*:recheck:[ ]*
+am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
+am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+ recheck = 1; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ { \
+ if ((getline line2 < ($$0 ".log")) < 0) \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+ { \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+ { \
+ break; \
+ } \
+ }; \
+ if (recheck) \
+ print $$0; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+ print "fatal: making $@: " msg | "cat >&2"; \
+ exit 1; \
+} \
+function rst_section(header) \
+{ \
+ print header; \
+ len = length(header); \
+ for (i = 1; i <= len; i = i + 1) \
+ printf "="; \
+ printf "\n\n"; \
+} \
+{ \
+ copy_in_global_log = 1; \
+ global_test_result = "RUN"; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".trs"); \
+ if (line ~ /$(am__global_test_result_rx)/) \
+ { \
+ sub("$(am__global_test_result_rx)", "", line); \
+ sub("[ ]*$$", "", line); \
+ global_test_result = line; \
+ } \
+ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+ copy_in_global_log = 0; \
+ }; \
+ if (copy_in_global_log) \
+ { \
+ rst_section(global_test_result ": " $$0); \
+ while ((rc = (getline line < ($$0 ".log"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".log"); \
+ print line; \
+ }; \
+ printf "\n"; \
+ }; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+ --color-tests "$$am__color_tests" \
+ --enable-hard-errors "$$am__enable_hard_errors" \
+ --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test. Creates the
+# directory for the log if needed. Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log. Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT. Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup); \
+$(am__vpath_adj_setup) $(am__vpath_adj) \
+$(am__tty_colors); \
+srcdir=$(srcdir); export srcdir; \
+case "$@" in \
+ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \
+ *) am__odir=.;; \
+esac; \
+test "x$$am__odir" = x"." || test -d "$$am__odir" \
+ || $(MKDIR_P) "$$am__odir" || exit $$?; \
+if test -f "./$$f"; then dir=./; \
+elif test -f "$$f"; then dir=; \
+else dir="$(srcdir)/"; fi; \
+tst=$$dir$$f; log='$@'; \
+if test -n '$(DISABLE_HARD_ERRORS)'; then \
+ am__enable_hard_errors=no; \
+else \
+ am__enable_hard_errors=yes; \
+fi; \
+case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
+ am__expect_failure=yes;; \
+ *) \
+ am__expect_failure=no;; \
+esac; \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed). The result is saved in the shell variable
+# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+ bases='$(TEST_LOGS)'; \
+ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+ bases=`echo $$bases`
+RECHECK_LOGS = $(TEST_LOGS)
+AM_RECURSIVE_TARGETS = check recheck
+TEST_SUITE_LOG = test-suite.log
+TEST_EXTENSIONS = @EXEEXT@ .test
+LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
+am__set_b = \
+ case '$@' in \
+ */*) \
+ case '$*' in \
+ */*) b='$*';; \
+ *) b=`echo '$@' | sed 's/\.log$$//'`; \
+ esac;; \
+ *) \
+ b='$*';; \
+ esac
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+ $(TEST_LOG_FLAGS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/test-driver
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ABI = @ABI@
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+ASMFLAGS = @ASMFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
+CC = @CC@
+CCAS = @CCAS@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPP_FOR_BUILD = @CPP_FOR_BUILD@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
+DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
+FGREP = @FGREP@
+GMP_LDFLAGS = @GMP_LDFLAGS@
+GMP_LIMB_BITS = @GMP_LIMB_BITS@
+GMP_NAIL_BITS = @GMP_NAIL_BITS@
+GREP = @GREP@
+HAVE_CLOCK_01 = @HAVE_CLOCK_01@
+HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@
+HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@
+HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@
+HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@
+HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@
+HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@
+HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
+HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
+HAVE_STACK_T_01 = @HAVE_STACK_T_01@
+HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBCURSES = @LIBCURSES@
+LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@
+LIBGMP_DLL = @LIBGMP_DLL@
+LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@
+LIBM = @LIBM@
+LIBM_FOR_BUILD = @LIBM_FOR_BUILD@
+LIBOBJS = @LIBOBJS@
+LIBREADLINE = @LIBREADLINE@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+M4 = @M4@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
+STRIP = @STRIP@
+TAL_OBJECT = @TAL_OBJECT@
+TUNE_LIBS = @TUNE_LIBS@
+TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U_FOR_BUILD = @U_FOR_BUILD@
+VERSION = @VERSION@
+WITH_READLINE_01 = @WITH_READLINE_01@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gmp_srclinks = @gmp_srclinks@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mpn_objects = @mpn_objects@
+mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
+AM_LDFLAGS = -no-install
+LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
+TESTS = $(check_PROGRAMS)
+
+# Temporary files used by the tests. Removed automatically if the tests
+# pass, but ensure they're cleaned if they fail.
+#
+CLEANFILES = *.tmp
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/misc/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/misc/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+t-locale$(EXEEXT): $(t_locale_OBJECTS) $(t_locale_DEPENDENCIES) $(EXTRA_t_locale_DEPENDENCIES)
+ @rm -f t-locale$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_locale_OBJECTS) $(t_locale_LDADD) $(LIBS)
+
+t-printf$(EXEEXT): $(t_printf_OBJECTS) $(t_printf_DEPENDENCIES) $(EXTRA_t_printf_DEPENDENCIES)
+ @rm -f t-printf$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_printf_OBJECTS) $(t_printf_LDADD) $(LIBS)
+
+t-scanf$(EXEEXT): $(t_scanf_OBJECTS) $(t_scanf_DEPENDENCIES) $(EXTRA_t_scanf_DEPENDENCIES)
+ @rm -f t-scanf$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_scanf_OBJECTS) $(t_scanf_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+.c.o:
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+ $(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+ rm -f $< $@
+ $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+ @:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+ @$(am__set_TESTS_bases); \
+ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+ redo_bases=`for i in $$bases; do \
+ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+ done`; \
+ if test -n "$$redo_bases"; then \
+ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+ if $(am__make_dryrun); then :; else \
+ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+ fi; \
+ fi; \
+ if test -n "$$am__remaking_logs"; then \
+ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+ "recursion detected" >&2; \
+ elif test -n "$$redo_logs"; then \
+ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+ fi; \
+ if $(am__make_dryrun); then :; else \
+ st=0; \
+ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+ for i in $$redo_bases; do \
+ test -f $$i.trs && test -r $$i.trs \
+ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+ test -f $$i.log && test -r $$i.log \
+ || { echo "$$errmsg $$i.log" >&2; st=1; }; \
+ done; \
+ test $$st -eq 0 || exit 1; \
+ fi
+ @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+ ws='[ ]'; \
+ results=`for b in $$bases; do echo $$b.trs; done`; \
+ test -n "$$results" || results=/dev/null; \
+ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
+ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \
+ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \
+ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \
+ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+ if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+ success=true; \
+ else \
+ success=false; \
+ fi; \
+ br='==================='; br=$$br$$br$$br$$br; \
+ result_count () \
+ { \
+ if test x"$$1" = x"--maybe-color"; then \
+ maybe_colorize=yes; \
+ elif test x"$$1" = x"--no-color"; then \
+ maybe_colorize=no; \
+ else \
+ echo "$@: invalid 'result_count' usage" >&2; exit 4; \
+ fi; \
+ shift; \
+ desc=$$1 count=$$2; \
+ if test $$maybe_colorize = yes && test $$count -gt 0; then \
+ color_start=$$3 color_end=$$std; \
+ else \
+ color_start= color_end=; \
+ fi; \
+ echo "$${color_start}# $$desc $$count$${color_end}"; \
+ }; \
+ create_testsuite_report () \
+ { \
+ result_count $$1 "TOTAL:" $$all "$$brg"; \
+ result_count $$1 "PASS: " $$pass "$$grn"; \
+ result_count $$1 "SKIP: " $$skip "$$blu"; \
+ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+ result_count $$1 "FAIL: " $$fail "$$red"; \
+ result_count $$1 "XPASS:" $$xpass "$$red"; \
+ result_count $$1 "ERROR:" $$error "$$mgn"; \
+ }; \
+ { \
+ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
+ $(am__rst_title); \
+ create_testsuite_report --no-color; \
+ echo; \
+ echo ".. contents:: :depth: 2"; \
+ echo; \
+ for b in $$bases; do echo $$b; done \
+ | $(am__create_global_log); \
+ } >$(TEST_SUITE_LOG).tmp || exit 1; \
+ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
+ if $$success; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
+ fi; \
+ echo "$${col}$$br$${std}"; \
+ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \
+ echo "$${col}$$br$${std}"; \
+ create_testsuite_report --maybe-color; \
+ echo "$$col$$br$$std"; \
+ if $$success; then :; else \
+ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \
+ if test -n "$(PACKAGE_BUGREPORT)"; then \
+ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+ fi; \
+ echo "$$col$$br$$std"; \
+ fi; \
+ $$success || exit 1
+
+check-TESTS:
+ @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
+ @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+ exit $$?;
+recheck: all $(check_PROGRAMS)
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ bases=`for i in $$bases; do echo $$i; done \
+ | $(am__list_recheck_tests)` || exit 1; \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ log_list=`echo $$log_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+ am__force_recheck=am--force-recheck \
+ TEST_LOGS="$$log_list"; \
+ exit $$?
+t-printf.log: t-printf$(EXEEXT)
+ @p='t-printf$(EXEEXT)'; \
+ b='t-printf'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-scanf.log: t-scanf$(EXEEXT)
+ @p='t-scanf$(EXEEXT)'; \
+ b='t-scanf'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-locale.log: t-locale$(EXEEXT)
+ @p='t-locale$(EXEEXT)'; \
+ b='t-locale'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+.test.log:
+ @p='$<'; \
+ $(am__set_b); \
+ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+@am__EXEEXT_TRUE@.test$(EXEEXT).log:
+@am__EXEEXT_TRUE@ @p='$<'; \
+@am__EXEEXT_TRUE@ $(am__set_b); \
+@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
+@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+ -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+ -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+ -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
+ ctags ctags-am distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ recheck tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/vendor/gmp-6.3.0/tests/misc/t-locale.c b/vendor/gmp-6.3.0/tests/misc/t-locale.c
new file mode 100644
index 0000000..c5b0b3c
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/misc/t-locale.c
@@ -0,0 +1,197 @@
+/* Test locale support, or attempt to do so.
+
+Copyright 2001, 2002, 2011, 2014, 2020 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#define _GNU_SOURCE /* for DECIMAL_POINT in glibc langinfo.h */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if HAVE_NL_TYPES_H
+#include <nl_types.h> /* for nl_item (on netbsd 1.4.1 at least) */
+#endif
+
+#if HAVE_LANGINFO_H
+#include <langinfo.h> /* for nl_langinfo */
+#endif
+
+#if HAVE_LOCALE_H
+#include <locale.h> /* for lconv */
+#endif
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+const char *decimal_point;
+
+/* Replace the libc localeconv with one we can manipulate. */
+#if HAVE_LOCALECONV && ! defined __MINGW32__
+struct lconv *
+localeconv (void)
+#if defined __cplusplus && defined __GLIBC__
+ throw()
+#endif
+{
+ static struct lconv l;
+ l.decimal_point = (char *) decimal_point;
+ return &l;
+}
+#endif
+
+/* Replace the libc nl_langinfo with one we can manipulate. */
+#if HAVE_NL_LANGINFO && ! defined __TERMUX__
+char *
+nl_langinfo (nl_item n)
+#if defined __cplusplus && defined __GLIBC__
+ throw()
+#endif
+{
+#if defined (DECIMAL_POINT)
+ if (n == DECIMAL_POINT)
+ return (char *) decimal_point;
+#endif
+#if defined (RADIXCHAR)
+ if (n == RADIXCHAR)
+ return (char *) decimal_point;
+#endif
+ return (char *) "";
+}
+#endif
+
+void
+check_input (void)
+{
+ static const char *point[] = {
+ ".", ",", "WU", "STR", "ZTV***"
+ };
+
+ static const struct {
+ const char *str;
+ double d;
+ } data[] = {
+
+ { "1%s", 1.0 },
+ { "1%s0", 1.0 },
+ { "1%s00", 1.0 },
+
+ { "%s5", 0.5 },
+ { "0%s5", 0.5 },
+ { "00%s5", 0.5 },
+ { "00%s50", 0.5 },
+
+ { "1%s5", 1.5 },
+ { "1%s5e1", 15.0 },
+ };
+
+ int i, j, neg, ret;
+ char str[128];
+ mpf_t f;
+ double d;
+
+ mpf_init (f);
+
+ for (i = 0; i < numberof (point); i++)
+ {
+ decimal_point = (const char *) point[i];
+
+ for (neg = 0; neg <= 1; neg++)
+ {
+ for (j = 0; j < numberof (data); j++)
+ {
+ strcpy (str, neg ? "-" : "");
+ sprintf (str+strlen(str), data[j].str, decimal_point);
+
+ d = data[j].d;
+ if (neg)
+ d = -d;
+
+ mpf_set_d (f, 123.0);
+ if (mpf_set_str (f, str, 10) != 0)
+ {
+ printf ("mpf_set_str error\n");
+ printf (" point %s\n", decimal_point);
+ printf (" str %s\n", str);
+ abort ();
+ }
+ if (mpf_cmp_d (f, d) != 0)
+ {
+ printf ("mpf_set_str wrong result\n");
+ printf (" point %s\n", decimal_point);
+ printf (" str %s\n", str);
+ mpf_trace (" f", f);
+ printf (" d=%g\n", d);
+ abort ();
+ }
+
+ mpf_set_d (f, 123.0);
+ ret = gmp_sscanf (str, "%Ff", f);
+ if (ret != 1)
+ {
+ printf ("gmp_sscanf wrong return value\n");
+ printf (" point %s\n", decimal_point);
+ printf (" str %s\n", str);
+ printf (" ret %d\n", ret);
+ abort ();
+ }
+ if (mpf_cmp_d (f, d) != 0)
+ {
+ printf ("gmp_sscanf wrong result\n");
+ printf (" point %s\n", decimal_point);
+ printf (" str %s\n", str);
+ mpf_trace (" f", f);
+ printf (" d=%g\n", d);
+ abort ();
+ }
+ }
+ }
+ }
+ mpf_clear (f);
+}
+
+int
+main (void)
+{
+ /* The localeconv replacement breaks printf "%lu" on SunOS 4, so we can't
+ print the seed in tests_rand_start(). Nothing random is used in this
+ program though, so just use the memory tests alone. */
+ tests_memory_start ();
+
+ {
+ mpf_t f;
+ char buf[128];
+ mpf_init (f);
+ decimal_point = ",";
+ mpf_set_d (f, 1.5);
+ gmp_snprintf (buf, sizeof(buf), "%.1Ff", f);
+ mpf_clear (f);
+ if (strcmp (buf, "1,5") != 0)
+ {
+ printf ("Test skipped, replacing localeconv/nl_langinfo doesn't work\n");
+ goto done;
+ }
+ }
+
+ check_input ();
+
+ done:
+ tests_memory_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/misc/t-printf.c b/vendor/gmp-6.3.0/tests/misc/t-printf.c
new file mode 100644
index 0000000..ef104ba
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/misc/t-printf.c
@@ -0,0 +1,955 @@
+/* Test gmp_printf and related functions.
+
+Copyright 2001-2003, 2015 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+/* Usage: t-printf [-s]
+
+ -s Check the data against the system printf, where possible. This is
+ only an option since we don't want to fail if the system printf is
+ faulty or strange. */
+
+
+#include "config.h" /* needed for the HAVE_, could also move gmp incls */
+
+#include <stdarg.h>
+#include <stddef.h> /* for ptrdiff_t */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if HAVE_OBSTACK_VPRINTF
+#define obstack_chunk_alloc tests_allocate
+#define obstack_chunk_free tests_free_nosize
+#include <obstack.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h> /* for intmax_t */
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
+#endif
+
+#if HAVE_UNISTD_H
+#include <unistd.h> /* for unlink */
+#endif
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+int option_check_printf = 0;
+
+
+#define CHECK_VFPRINTF_FILENAME "t-printf.tmp"
+FILE *check_vfprintf_fp;
+
+
+/* From any of the tests run here. */
+#define MAX_OUTPUT 1024
+
+
+void
+check_plain (const char *want, const char *fmt_orig, ...)
+{
+ char got[MAX_OUTPUT];
+ int got_len, want_len;
+ size_t fmtsize;
+ char *fmt, *q;
+ const char *p;
+ va_list ap;
+ va_start (ap, fmt_orig);
+
+ if (! option_check_printf)
+ return;
+
+ fmtsize = strlen (fmt_orig) + 1;
+ fmt = (char *) (*__gmp_allocate_func) (fmtsize);
+
+ for (p = fmt_orig, q = fmt; *p != '\0'; p++)
+ {
+ switch (*p) {
+ case 'a':
+ case 'A':
+ /* The exact value of the exponent isn't guaranteed in glibc, and it
+ and gmp_printf do slightly different things, so don't compare
+ directly. */
+ goto done;
+ case 'F':
+ if (p > fmt_orig && *(p-1) == '.')
+ goto done; /* don't test the "all digits" cases */
+ /* discard 'F' type */
+ break;
+ case 'Z':
+ /* transmute */
+ *q++ = 'l';
+ break;
+ default:
+ *q++ = *p;
+ break;
+ }
+ }
+ *q = '\0';
+
+ want_len = strlen (want);
+ ASSERT_ALWAYS (want_len < sizeof(got));
+
+ got_len = vsprintf (got, fmt, ap);
+
+ if (got_len != want_len || strcmp (got, want) != 0)
+ {
+ printf ("wanted data doesn't match plain vsprintf\n");
+ printf (" fmt |%s|\n", fmt);
+ printf (" got |%s|\n", got);
+ printf (" want |%s|\n", want);
+ printf (" got_len %d\n", got_len);
+ printf (" want_len %d\n", want_len);
+ abort ();
+ }
+
+ done:
+ (*__gmp_free_func) (fmt, fmtsize);
+}
+
+void
+check_vsprintf (const char *want, const char *fmt, va_list ap)
+{
+ char got[MAX_OUTPUT];
+ int got_len, want_len;
+
+ want_len = strlen (want);
+ got_len = gmp_vsprintf (got, fmt, ap);
+
+ if (got_len != want_len || strcmp (got, want) != 0)
+ {
+ printf ("gmp_vsprintf wrong\n");
+ printf (" fmt |%s|\n", fmt);
+ printf (" got |%s|\n", got);
+ printf (" want |%s|\n", want);
+ printf (" got_len %d\n", got_len);
+ printf (" want_len %d\n", want_len);
+ abort ();
+ }
+}
+
+void
+check_vfprintf (const char *want, const char *fmt, va_list ap)
+{
+ char got[MAX_OUTPUT];
+ int got_len, want_len, fread_len;
+ long ftell_len;
+
+ want_len = strlen (want);
+
+ rewind (check_vfprintf_fp);
+ got_len = gmp_vfprintf (check_vfprintf_fp, fmt, ap);
+ ASSERT_ALWAYS (got_len != -1);
+ ASSERT_ALWAYS (fflush (check_vfprintf_fp) == 0);
+
+ ftell_len = ftell (check_vfprintf_fp);
+ ASSERT_ALWAYS (ftell_len != -1);
+
+ rewind (check_vfprintf_fp);
+ ASSERT_ALWAYS (ftell_len <= sizeof(got));
+ fread_len = fread (got, 1, ftell_len, check_vfprintf_fp);
+
+ if (got_len != want_len
+ || ftell_len != want_len
+ || fread_len != want_len
+ || memcmp (got, want, want_len) != 0)
+ {
+ printf ("gmp_vfprintf wrong\n");
+ printf (" fmt |%s|\n", fmt);
+ printf (" got |%.*s|\n", fread_len, got);
+ printf (" want |%s|\n", want);
+ printf (" got_len %d\n", got_len);
+ printf (" ftell_len %ld\n", ftell_len);
+ printf (" fread_len %d\n", fread_len);
+ printf (" want_len %d\n", want_len);
+ abort ();
+ }
+}
+
+void
+check_vsnprintf (const char *want, const char *fmt, va_list ap)
+{
+ char got[MAX_OUTPUT+1];
+ int ret, got_len, want_len;
+ size_t bufsize;
+
+ want_len = strlen (want);
+
+ bufsize = -1;
+ for (;;)
+ {
+ /* do 0 to 5, then want-5 to want+5 */
+ bufsize++;
+ if (bufsize > 5 && bufsize < want_len-5)
+ bufsize = want_len-5;
+ if (bufsize > want_len + 5)
+ break;
+ ASSERT_ALWAYS (bufsize+1 <= sizeof (got));
+
+ got[bufsize] = '!';
+ ret = gmp_vsnprintf (got, bufsize, fmt, ap);
+
+ got_len = MIN (MAX(1,bufsize)-1, want_len);
+
+ if (got[bufsize] != '!')
+ {
+ printf ("gmp_vsnprintf overwrote bufsize sentinel\n");
+ goto error;
+ }
+
+ if (ret != want_len)
+ {
+ printf ("gmp_vsnprintf return value wrong\n");
+ goto error;
+ }
+
+ if (bufsize > 0)
+ {
+ if (memcmp (got, want, got_len) != 0 || got[got_len] != '\0')
+ {
+ printf ("gmp_vsnprintf wrong result string\n");
+ error:
+ printf (" fmt |%s|\n", fmt);
+ printf (" bufsize %lu\n", (unsigned long) bufsize);
+ printf (" got |%s|\n", got);
+ printf (" want |%.*s|\n", got_len, want);
+ printf (" want full |%s|\n", want);
+ printf (" ret %d\n", ret);
+ printf (" want_len %d\n", want_len);
+ abort ();
+ }
+ }
+ }
+}
+
+void
+check_vasprintf (const char *want, const char *fmt, va_list ap)
+{
+ char *got;
+ int got_len, want_len;
+
+ want_len = strlen (want);
+ got_len = gmp_vasprintf (&got, fmt, ap);
+
+ if (got_len != want_len || strcmp (got, want) != 0)
+ {
+ printf ("gmp_vasprintf wrong\n");
+ printf (" fmt |%s|\n", fmt);
+ printf (" got |%s|\n", got);
+ printf (" want |%s|\n", want);
+ printf (" got_len %d\n", got_len);
+ printf (" want_len %d\n", want_len);
+ abort ();
+ }
+ (*__gmp_free_func) (got, strlen(got)+1);
+}
+
+void
+check_obstack_vprintf (const char *want, const char *fmt, va_list ap)
+{
+#if HAVE_OBSTACK_VPRINTF
+ struct obstack ob;
+ int got_len, want_len, ob_len;
+ char *got;
+
+ want_len = strlen (want);
+
+ obstack_init (&ob);
+ got_len = gmp_obstack_vprintf (&ob, fmt, ap);
+ got = (char *) obstack_base (&ob);
+ ob_len = obstack_object_size (&ob);
+
+ if (got_len != want_len
+ || ob_len != want_len
+ || memcmp (got, want, want_len) != 0)
+ {
+ printf ("gmp_obstack_vprintf wrong\n");
+ printf (" fmt |%s|\n", fmt);
+ printf (" got |%s|\n", got);
+ printf (" want |%s|\n", want);
+ printf (" got_len %d\n", got_len);
+ printf (" ob_len %d\n", ob_len);
+ printf (" want_len %d\n", want_len);
+ abort ();
+ }
+ obstack_free (&ob, NULL);
+#endif
+}
+
+
+void
+check_one (const char *want, const char *fmt, ...)
+{
+ va_list ap;
+ va_start (ap, fmt);
+
+ /* simplest first */
+ check_vsprintf (want, fmt, ap);
+ check_vfprintf (want, fmt, ap);
+ check_vsnprintf (want, fmt, ap);
+ check_vasprintf (want, fmt, ap);
+ check_obstack_vprintf (want, fmt, ap);
+}
+
+
+#define hex_or_octal_p(fmt) \
+ (strchr (fmt, 'x') != NULL \
+ || strchr (fmt, 'X') != NULL \
+ || strchr (fmt, 'o') != NULL)
+
+void
+check_z (void)
+{
+ static const struct {
+ const char *fmt;
+ const char *z;
+ const char *want;
+ } data[] = {
+ { "%Zd", "0", "0" },
+ { "%Zd", "1", "1" },
+ { "%Zd", "123", "123" },
+ { "%Zd", "-1", "-1" },
+ { "%Zd", "-123", "-123" },
+
+ { "%+Zd", "0", "+0" },
+ { "%+Zd", "123", "+123" },
+ { "%+Zd", "-123", "-123" },
+
+ { "%Zx", "123", "7b" },
+ { "%ZX", "123", "7B" },
+ { "%Zx", "-123", "-7b" },
+ { "%ZX", "-123", "-7B" },
+ { "%Zo", "123", "173" },
+ { "%Zo", "-123", "-173" },
+
+ { "%#Zx", "0", "0" },
+ { "%#ZX", "0", "0" },
+ { "%#Zx", "123", "0x7b" },
+ { "%#ZX", "123", "0X7B" },
+ { "%#Zx", "-123", "-0x7b" },
+ { "%#ZX", "-123", "-0X7B" },
+
+ { "%#Zo", "0", "0" },
+ { "%#Zo", "123", "0173" },
+ { "%#Zo", "-123", "-0173" },
+
+ { "%10Zd", "0", " 0" },
+ { "%10Zd", "123", " 123" },
+ { "%10Zd", "-123", " -123" },
+
+ { "%-10Zd", "0", "0 " },
+ { "%-10Zd", "123", "123 " },
+ { "%-10Zd", "-123", "-123 " },
+
+ { "%+10Zd", "123", " +123" },
+ { "%+-10Zd", "123", "+123 " },
+ { "%+10Zd", "-123", " -123" },
+ { "%+-10Zd", "-123", "-123 " },
+
+ { "%08Zd", "0", "00000000" },
+ { "%08Zd", "123", "00000123" },
+ { "%08Zd", "-123", "-0000123" },
+
+ { "%+08Zd", "0", "+0000000" },
+ { "%+08Zd", "123", "+0000123" },
+ { "%+08Zd", "-123", "-0000123" },
+
+ { "%#08Zx", "0", "00000000" },
+ { "%#08Zx", "123", "0x00007b" },
+ { "%#08Zx", "-123", "-0x0007b" },
+
+ { "%+#08Zx", "0", "+0000000" },
+ { "%+#08Zx", "123", "+0x0007b" },
+ { "%+#08Zx", "-123", "-0x0007b" },
+
+ { "%.0Zd", "0", "" },
+ { "%.1Zd", "0", "0" },
+ { "%.2Zd", "0", "00" },
+ { "%.3Zd", "0", "000" },
+ };
+
+ int i, j;
+ mpz_t z;
+ char *nfmt;
+ mp_size_t nsize, zeros;
+
+ mpz_init (z);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_str_or_abort (z, data[i].z, 0);
+
+ /* don't try negatives or forced sign in hex or octal */
+ if (mpz_fits_slong_p (z)
+ && ! (hex_or_octal_p (data[i].fmt)
+ && (strchr (data[i].fmt, '+') != NULL || mpz_sgn(z) < 0)))
+ {
+ check_plain (data[i].want, data[i].fmt, mpz_get_si (z));
+ }
+
+ check_one (data[i].want, data[i].fmt, z);
+
+ /* Same again, with %N and possibly some high zero limbs */
+ nfmt = __gmp_allocate_strdup (data[i].fmt);
+ for (j = 0; nfmt[j] != '\0'; j++)
+ if (nfmt[j] == 'Z')
+ nfmt[j] = 'N';
+ for (zeros = 0; zeros <= 3; zeros++)
+ {
+ nsize = ABSIZ(z)+zeros;
+ MPZ_REALLOC (z, nsize);
+ nsize = (SIZ(z) >= 0 ? nsize : -nsize);
+ refmpn_zero (PTR(z)+ABSIZ(z), zeros);
+ check_one (data[i].want, nfmt, PTR(z), nsize);
+ }
+ __gmp_free_func (nfmt, strlen(nfmt)+1);
+ }
+
+ mpz_clear (z);
+}
+
+void
+check_q (void)
+{
+ static const struct {
+ const char *fmt;
+ const char *q;
+ const char *want;
+ } data[] = {
+ { "%Qd", "0", "0" },
+ { "%Qd", "1", "1" },
+ { "%Qd", "123", "123" },
+ { "%Qd", "-1", "-1" },
+ { "%Qd", "-123", "-123" },
+ { "%Qd", "3/2", "3/2" },
+ { "%Qd", "-3/2", "-3/2" },
+
+ { "%+Qd", "0", "+0" },
+ { "%+Qd", "123", "+123" },
+ { "%+Qd", "-123", "-123" },
+ { "%+Qd", "5/8", "+5/8" },
+ { "%+Qd", "-5/8", "-5/8" },
+
+ { "%Qx", "123", "7b" },
+ { "%QX", "123", "7B" },
+ { "%Qx", "15/16", "f/10" },
+ { "%QX", "15/16", "F/10" },
+ { "%Qx", "-123", "-7b" },
+ { "%QX", "-123", "-7B" },
+ { "%Qx", "-15/16", "-f/10" },
+ { "%QX", "-15/16", "-F/10" },
+ { "%Qo", "123", "173" },
+ { "%Qo", "-123", "-173" },
+ { "%Qo", "16/17", "20/21" },
+ { "%Qo", "-16/17", "-20/21" },
+
+ { "%#Qx", "0", "0" },
+ { "%#QX", "0", "0" },
+ { "%#Qx", "123", "0x7b" },
+ { "%#QX", "123", "0X7B" },
+ { "%#Qx", "5/8", "0x5/0x8" },
+ { "%#QX", "5/8", "0X5/0X8" },
+ { "%#Qx", "-123", "-0x7b" },
+ { "%#QX", "-123", "-0X7B" },
+ { "%#Qx", "-5/8", "-0x5/0x8" },
+ { "%#QX", "-5/8", "-0X5/0X8" },
+ { "%#Qo", "0", "0" },
+ { "%#Qo", "123", "0173" },
+ { "%#Qo", "-123", "-0173" },
+ { "%#Qo", "5/7", "05/07" },
+ { "%#Qo", "-5/7", "-05/07" },
+
+ /* zero denominator and showbase */
+ { "%#10Qo", "0/0", " 0/0" },
+ { "%#10Qd", "0/0", " 0/0" },
+ { "%#10Qx", "0/0", " 0/0" },
+ { "%#10Qo", "123/0", " 0173/0" },
+ { "%#10Qd", "123/0", " 123/0" },
+ { "%#10Qx", "123/0", " 0x7b/0" },
+ { "%#10QX", "123/0", " 0X7B/0" },
+ { "%#10Qo", "-123/0", " -0173/0" },
+ { "%#10Qd", "-123/0", " -123/0" },
+ { "%#10Qx", "-123/0", " -0x7b/0" },
+ { "%#10QX", "-123/0", " -0X7B/0" },
+
+ { "%10Qd", "0", " 0" },
+ { "%-10Qd", "0", "0 " },
+ { "%10Qd", "123", " 123" },
+ { "%-10Qd", "123", "123 " },
+ { "%10Qd", "-123", " -123" },
+ { "%-10Qd", "-123", "-123 " },
+
+ { "%+10Qd", "123", " +123" },
+ { "%+-10Qd", "123", "+123 " },
+ { "%+10Qd", "-123", " -123" },
+ { "%+-10Qd", "-123", "-123 " },
+
+ { "%08Qd", "0", "00000000" },
+ { "%08Qd", "123", "00000123" },
+ { "%08Qd", "-123", "-0000123" },
+
+ { "%+08Qd", "0", "+0000000" },
+ { "%+08Qd", "123", "+0000123" },
+ { "%+08Qd", "-123", "-0000123" },
+
+ { "%#08Qx", "0", "00000000" },
+ { "%#08Qx", "123", "0x00007b" },
+ { "%#08Qx", "-123", "-0x0007b" },
+
+ { "%+#08Qx", "0", "+0000000" },
+ { "%+#08Qx", "123", "+0x0007b" },
+ { "%+#08Qx", "-123", "-0x0007b" },
+ };
+
+ int i;
+ mpq_t q;
+
+ mpq_init (q);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpq_set_str_or_abort (q, data[i].q, 0);
+ check_one (data[i].want, data[i].fmt, q);
+ }
+
+ mpq_clear (q);
+}
+
+void
+check_f (void)
+{
+ static const struct {
+ const char *fmt;
+ const char *f;
+ const char *want;
+
+ } data[] = {
+
+ { "%Ff", "0", "0.000000" },
+ { "%Ff", "123", "123.000000" },
+ { "%Ff", "-123", "-123.000000" },
+
+ { "%+Ff", "0", "+0.000000" },
+ { "%+Ff", "123", "+123.000000" },
+ { "%+Ff", "-123", "-123.000000" },
+
+ { "%.0Ff", "0", "0" },
+ { "%.0Ff", "123", "123" },
+ { "%.0Ff", "-123", "-123" },
+
+ { "%8.0Ff", "0", " 0" },
+ { "%8.0Ff", "123", " 123" },
+ { "%8.0Ff", "-123", " -123" },
+
+ { "%08.0Ff", "0", "00000000" },
+ { "%08.0Ff", "123", "00000123" },
+ { "%08.0Ff", "-123", "-0000123" },
+
+ { "%10.2Ff", "0", " 0.00" },
+ { "%10.2Ff", "0.25", " 0.25" },
+ { "%10.2Ff", "123.25", " 123.25" },
+ { "%10.2Ff", "-123.25", " -123.25" },
+
+ { "%-10.2Ff", "0", "0.00 " },
+ { "%-10.2Ff", "0.25", "0.25 " },
+ { "%-10.2Ff", "123.25", "123.25 " },
+ { "%-10.2Ff", "-123.25", "-123.25 " },
+
+ { "%.2Ff", "0.00000000000001", "0.00" },
+ { "%.2Ff", "0.002", "0.00" },
+ { "%.2Ff", "0.008", "0.01" },
+
+ { "%.0Ff", "123.00000000000001", "123" },
+ { "%.0Ff", "123.2", "123" },
+ { "%.0Ff", "123.8", "124" },
+
+ { "%.0Ff", "999999.9", "1000000" },
+ { "%.0Ff", "3999999.9", "4000000" },
+
+ { "%Fe", "0", "0.000000e+00" },
+ { "%Fe", "1", "1.000000e+00" },
+ { "%Fe", "123", "1.230000e+02" },
+
+ { "%FE", "0", "0.000000E+00" },
+ { "%FE", "1", "1.000000E+00" },
+ { "%FE", "123", "1.230000E+02" },
+
+ { "%Fe", "0", "0.000000e+00" },
+ { "%Fe", "1", "1.000000e+00" },
+
+ { "%.0Fe", "10000000000", "1e+10" },
+ { "%.0Fe", "-10000000000", "-1e+10" },
+
+ { "%.2Fe", "10000000000", "1.00e+10" },
+ { "%.2Fe", "-10000000000", "-1.00e+10" },
+
+ { "%8.0Fe", "10000000000", " 1e+10" },
+ { "%8.0Fe", "-10000000000", " -1e+10" },
+
+ { "%-8.0Fe", "10000000000", "1e+10 " },
+ { "%-8.0Fe", "-10000000000", "-1e+10 " },
+
+ { "%12.2Fe", "10000000000", " 1.00e+10" },
+ { "%12.2Fe", "-10000000000", " -1.00e+10" },
+
+ { "%012.2Fe", "10000000000", "00001.00e+10" },
+ { "%012.2Fe", "-10000000000", "-0001.00e+10" },
+
+ { "%Fg", "0", "0" },
+ { "%Fg", "1", "1" },
+ { "%Fg", "-1", "-1" },
+
+ { "%.0Fg", "0", "0" },
+ { "%.0Fg", "1", "1" },
+ { "%.0Fg", "-1", "-1" },
+
+ { "%.1Fg", "100", "1e+02" },
+ { "%.2Fg", "100", "1e+02" },
+ { "%.3Fg", "100", "100" },
+ { "%.4Fg", "100", "100" },
+
+ { "%Fg", "0.001", "0.001" },
+ { "%Fg", "0.0001", "0.0001" },
+ { "%Fg", "0.00001", "1e-05" },
+ { "%Fg", "0.000001", "1e-06" },
+
+ { "%.4Fg", "1.00000000000001", "1" },
+ { "%.4Fg", "100000000000001", "1e+14" },
+
+ { "%.4Fg", "12345678", "1.235e+07" },
+
+ { "%Fa", "0","0x0p+0" },
+ { "%FA", "0","0X0P+0" },
+
+ { "%Fa", "1","0x1p+0" },
+ { "%Fa", "65535","0xf.fffp+12" },
+ { "%Fa", "65536","0x1p+16" },
+ { "%F.10a", "65536","0x1.0000000000p+16" },
+ { "%F.1a", "65535","0x1.0p+16" },
+ { "%F.0a", "65535","0x1p+16" },
+
+ { "%.2Ff", "0.99609375", "1.00" },
+ { "%.Ff", "0.99609375", "0.99609375" },
+ { "%.Fe", "0.99609375", "9.9609375e-01" },
+ { "%.Fg", "0.99609375", "0.99609375" },
+ { "%.20Fg", "1000000", "1000000" },
+ { "%.Fg", "1000000", "1000000" },
+
+ { "%#.0Ff", "1", "1." },
+ { "%#.0Fe", "1", "1.e+00" },
+ { "%#.0Fg", "1", "1." },
+
+ { "%#.1Ff", "1", "1.0" },
+ { "%#.1Fe", "1", "1.0e+00" },
+ { "%#.1Fg", "1", "1." },
+
+ { "%#.4Ff", "1234", "1234.0000" },
+ { "%#.4Fe", "1234", "1.2340e+03" },
+ { "%#.4Fg", "1234", "1234." },
+
+ { "%#.8Ff", "1234", "1234.00000000" },
+ { "%#.8Fe", "1234", "1.23400000e+03" },
+ { "%#.8Fg", "1234", "1234.0000" },
+
+ };
+
+ int i;
+ mpf_t f;
+ double d;
+
+ mpf_init2 (f, 256L);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ if (data[i].f[0] == '0' && data[i].f[1] == 'x')
+ mpf_set_str_or_abort (f, data[i].f, 16);
+ else
+ mpf_set_str_or_abort (f, data[i].f, 10);
+
+ /* if mpf->double doesn't truncate, then expect same result */
+ d = mpf_get_d (f);
+ if (mpf_cmp_d (f, d) == 0)
+ check_plain (data[i].want, data[i].fmt, d);
+
+ check_one (data[i].want, data[i].fmt, f);
+ }
+
+ mpf_clear (f);
+}
+
+
+void
+check_limb (void)
+{
+ int i;
+ mp_limb_t limb;
+ mpz_t z;
+ char *s;
+
+ check_one ("0", "%Md", CNST_LIMB(0));
+ check_one ("1", "%Md", CNST_LIMB(1));
+
+ /* "i" many 1 bits, tested against mpz_get_str in decimal and hex */
+ limb = 1;
+ mpz_init_set_ui (z, 1L);
+ for (i = 1; i <= GMP_LIMB_BITS; i++)
+ {
+ s = mpz_get_str (NULL, 10, z);
+ check_one (s, "%Mu", limb);
+ (*__gmp_free_func) (s, strlen (s) + 1);
+
+ s = mpz_get_str (NULL, 16, z);
+ check_one (s, "%Mx", limb);
+ (*__gmp_free_func) (s, strlen (s) + 1);
+
+ s = mpz_get_str (NULL, -16, z);
+ check_one (s, "%MX", limb);
+ (*__gmp_free_func) (s, strlen (s) + 1);
+
+ limb = 2*limb + 1;
+ mpz_mul_2exp (z, z, 1L);
+ mpz_add_ui (z, z, 1L);
+ }
+
+ mpz_clear (z);
+}
+
+
+void
+check_n (void)
+{
+ {
+ int n = -1;
+ check_one ("blah", "%nblah", &n);
+ ASSERT_ALWAYS (n == 0);
+ }
+
+ {
+ int n = -1;
+ check_one ("hello ", "hello %n", &n);
+ ASSERT_ALWAYS (n == 6);
+ }
+
+ {
+ int n = -1;
+ check_one ("hello world", "hello %n world", &n);
+ ASSERT_ALWAYS (n == 6);
+ }
+
+#define CHECK_N(type, string) \
+ do { \
+ type x[2]; \
+ char fmt[128]; \
+ \
+ x[0] = ~ (type) 0; \
+ x[1] = ~ (type) 0; \
+ sprintf (fmt, "%%d%%%sn%%d", string); \
+ check_one ("123456", fmt, 123, &x[0], 456); \
+ \
+ /* should write whole of x[0] and none of x[1] */ \
+ ASSERT_ALWAYS (x[0] == 3); \
+ ASSERT_ALWAYS (x[1] == (type) ~ (type) 0); \
+ \
+ } while (0)
+
+ CHECK_N (mp_limb_t, "M");
+ CHECK_N (char, "hh");
+ CHECK_N (long, "l");
+#if HAVE_LONG_LONG
+ CHECK_N (long long, "L");
+#endif
+#if HAVE_INTMAX_T
+ CHECK_N (intmax_t, "j");
+#endif
+#if HAVE_PTRDIFF_T
+ CHECK_N (ptrdiff_t, "t");
+#endif
+ CHECK_N (short, "h");
+ CHECK_N (size_t, "z");
+
+ {
+ mpz_t x[2];
+ mpz_init_set_si (x[0], -987L);
+ mpz_init_set_si (x[1], 654L);
+ check_one ("123456", "%d%Zn%d", 123, x[0], 456);
+ MPZ_CHECK_FORMAT (x[0]);
+ MPZ_CHECK_FORMAT (x[1]);
+ ASSERT_ALWAYS (mpz_cmp_ui (x[0], 3L) == 0);
+ ASSERT_ALWAYS (mpz_cmp_ui (x[1], 654L) == 0);
+ mpz_clear (x[0]);
+ mpz_clear (x[1]);
+ }
+
+ {
+ mpq_t x[2];
+ mpq_init (x[0]);
+ mpq_init (x[1]);
+ mpq_set_ui (x[0], 987L, 654L);
+ mpq_set_ui (x[1], 4115L, 226L);
+ check_one ("123456", "%d%Qn%d", 123, x[0], 456);
+ MPQ_CHECK_FORMAT (x[0]);
+ MPQ_CHECK_FORMAT (x[1]);
+ ASSERT_ALWAYS (mpq_cmp_ui (x[0], 3L, 1L) == 0);
+ ASSERT_ALWAYS (mpq_cmp_ui (x[1], 4115L, 226L) == 0);
+ mpq_clear (x[0]);
+ mpq_clear (x[1]);
+ }
+
+ {
+ mpf_t x[2];
+ mpf_init (x[0]);
+ mpf_init (x[1]);
+ mpf_set_ui (x[0], 987L);
+ mpf_set_ui (x[1], 654L);
+ check_one ("123456", "%d%Fn%d", 123, x[0], 456);
+ MPF_CHECK_FORMAT (x[0]);
+ MPF_CHECK_FORMAT (x[1]);
+ ASSERT_ALWAYS (mpf_cmp_ui (x[0], 3L) == 0);
+ ASSERT_ALWAYS (mpf_cmp_ui (x[1], 654L) == 0);
+ mpf_clear (x[0]);
+ mpf_clear (x[1]);
+ }
+
+ {
+ mp_limb_t a[5];
+ mp_limb_t a_want[numberof(a)];
+ mp_size_t i;
+
+ a[0] = 123;
+ check_one ("blah", "bl%Nnah", a, (mp_size_t) 0);
+ ASSERT_ALWAYS (a[0] == 123);
+
+ MPN_ZERO (a_want, numberof (a_want));
+ for (i = 1; i < numberof (a); i++)
+ {
+ check_one ("blah", "bl%Nnah", a, i);
+ a_want[0] = 2;
+ ASSERT_ALWAYS (mpn_cmp (a, a_want, i) == 0);
+ }
+ }
+}
+
+
+void
+check_misc (void)
+{
+ mpz_t z;
+ mpf_t f;
+
+ mpz_init (z);
+ mpf_init2 (f, 128L);
+
+ check_one ("!", "%c", '!');
+
+ check_one ("hello world", "hello %s", "world");
+ check_one ("hello:", "%s:", "hello");
+ mpz_set_ui (z, 0L);
+ check_one ("hello0", "%s%Zd", "hello", z, z);
+
+ {
+ static char xs[801];
+ memset (xs, 'x', sizeof(xs)-1);
+ check_one (xs, "%s", xs);
+ }
+ {
+ char *xs;
+ xs = (char *) (*__gmp_allocate_func) (MAX_OUTPUT * 2 - 12);
+ memset (xs, '%', MAX_OUTPUT * 2 - 14);
+ xs [MAX_OUTPUT * 2 - 13] = '\0';
+ xs [MAX_OUTPUT * 2 - 14] = 'x';
+ check_one (xs + MAX_OUTPUT - 7, xs, NULL);
+ (*__gmp_free_func) (xs, MAX_OUTPUT * 2 - 12);
+ }
+
+ mpz_set_ui (z, 12345L);
+ check_one (" 12345", "%*Zd", 10, z);
+ check_one ("0000012345", "%0*Zd", 10, z);
+ check_one ("12345 ", "%*Zd", -10, z);
+ check_one ("12345 and 678", "%Zd and %d", z, 678);
+ check_one ("12345,1,12345,2,12345", "%Zd,%d,%Zd,%d,%Zd", z, 1, z, 2, z);
+
+ /* from the glibc info docs */
+ mpz_set_si (z, 0L);
+ check_one ("| 0|0 | +0|+0 | 0|00000| | 00|0|",
+ "|%5Zd|%-5Zd|%+5Zd|%+-5Zd|% 5Zd|%05Zd|%5.0Zd|%5.2Zd|%Zd|",
+ /**/ z, z, z, z, z, z, z, z, z);
+ mpz_set_si (z, 1L);
+ check_one ("| 1|1 | +1|+1 | 1|00001| 1| 01|1|",
+ "|%5Zd|%-5Zd|%+5Zd|%+-5Zd|% 5Zd|%05Zd|%5.0Zd|%5.2Zd|%Zd|",
+ /**/ z, z, z, z, z, z, z, z, z);
+ mpz_set_si (z, -1L);
+ check_one ("| -1|-1 | -1|-1 | -1|-0001| -1| -01|-1|",
+ "|%5Zd|%-5Zd|%+5Zd|%+-5Zd|% 5Zd|%05Zd|%5.0Zd|%5.2Zd|%Zd|",
+ /**/ z, z, z, z, z, z, z, z, z);
+ mpz_set_si (z, 100000L);
+ check_one ("|100000|100000|+100000|+100000| 100000|100000|100000|100000|100000|",
+ "|%5Zd|%-5Zd|%+5Zd|%+-5Zd|% 5Zd|%05Zd|%5.0Zd|%5.2Zd|%Zd|",
+ /**/ z, z, z, z, z, z, z, z, z);
+ mpz_set_si (z, 0L);
+ check_one ("| 0| 0| 0| 0| 0| 0| 00000000|",
+ "|%5Zo|%5Zx|%5ZX|%#5Zo|%#5Zx|%#5ZX|%#10.8Zx|",
+ /**/ z, z, z, z, z, z, z);
+ mpz_set_si (z, 1L);
+ check_one ("| 1| 1| 1| 01| 0x1| 0X1|0x00000001|",
+ "|%5Zo|%5Zx|%5ZX|%#5Zo|%#5Zx|%#5ZX|%#10.8Zx|",
+ /**/ z, z, z, z, z, z, z);
+ mpz_set_si (z, 100000L);
+ check_one ("|303240|186a0|186A0|0303240|0x186a0|0X186A0|0x000186a0|",
+ "|%5Zo|%5Zx|%5ZX|%#5Zo|%#5Zx|%#5ZX|%#10.8Zx|",
+ /**/ z, z, z, z, z, z, z);
+
+ /* %zd for size_t won't be available on old systems, and running something
+ to see if it works might be bad, so only try it on glibc, and only on a
+ new enough version (glibc 2.0 doesn't have %zd) */
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 0)
+ mpz_set_ui (z, 789L);
+ check_one ("456 789 blah", "%zd %Zd blah", (size_t) 456, z);
+#endif
+
+ mpz_clear (z);
+ mpf_clear (f);
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ if (argc > 1 && strcmp (argv[1], "-s") == 0)
+ option_check_printf = 1;
+
+ tests_start ();
+ check_vfprintf_fp = fopen (CHECK_VFPRINTF_FILENAME, "w+");
+ ASSERT_ALWAYS (check_vfprintf_fp != NULL);
+
+ check_z ();
+ check_q ();
+ check_f ();
+ check_limb ();
+ check_n ();
+ check_misc ();
+
+ ASSERT_ALWAYS (fclose (check_vfprintf_fp) == 0);
+ unlink (CHECK_VFPRINTF_FILENAME);
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/misc/t-scanf.c b/vendor/gmp-6.3.0/tests/misc/t-scanf.c
new file mode 100644
index 0000000..8b82f1e
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/misc/t-scanf.c
@@ -0,0 +1,1615 @@
+/* Test gmp_scanf and related functions.
+
+Copyright 2001-2004 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+/* Usage: t-scanf [-s]
+
+ -s Check the data against the system scanf, where possible. This is
+ only an option since we don't want to fail if the system scanf is
+ faulty or strange.
+
+ There's some fairly unattractive repetition between check_z, check_q and
+ check_f, but enough differences to make a common loop or a set of macros
+ seem like too much trouble. */
+
+#include "config.h" /* needed for the HAVE_, could also move gmp incls */
+
+#include <stdarg.h>
+
+#include <stddef.h> /* for ptrdiff_t */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h> /* for intmax_t */
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
+#endif
+
+#if HAVE_UNISTD_H
+#include <unistd.h> /* for unlink */
+#endif
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+#define TEMPFILE "t-scanf.tmp"
+
+int option_libc_scanf = 0;
+
+typedef int (*fun_t) (const char *, const char *, void *, void *);
+
+
+/* This problem was seen on powerpc7450-apple-darwin7.0.0, sscanf returns 0
+ where it should return EOF. A workaround in gmp_sscanf would be a bit
+ tedious, and since this is a rather obvious libc bug, quite likely
+ affecting other programs, we'll just suppress affected tests for now. */
+int
+test_sscanf_eof_ok (void)
+{
+ static int result = -1;
+
+ if (result == -1)
+ {
+ int x;
+ if (sscanf ("", "%d", &x) == EOF)
+ {
+ result = 1;
+ }
+ else
+ {
+ printf ("Warning, sscanf(\"\",\"%%d\",&x) doesn't return EOF.\n");
+ printf ("This affects gmp_sscanf, tests involving it will be suppressed.\n");
+ printf ("You should try to get a fix for your libc.\n");
+ result = 0;
+ }
+ }
+ return result;
+}
+
+
+/* Convert fmt from a GMP scanf format string to an equivalent for a plain
+ libc scanf, for example "%Zd" becomes "%ld". Return 1 if this succeeds,
+ 0 if it cannot (or should not) be done. */
+int
+libc_scanf_convert (char *fmt)
+{
+ char *p = fmt;
+
+ if (! option_libc_scanf)
+ return 0;
+
+ for ( ; *fmt != '\0'; fmt++)
+ {
+ switch (*fmt) {
+ case 'F':
+ case 'Q':
+ case 'Z':
+ /* transmute */
+ *p++ = 'l';
+ break;
+ default:
+ *p++ = *fmt;
+ break;
+ }
+ }
+ *p = '\0';
+ return 1;
+}
+
+
+long got_ftell;
+int fromstring_next_c;
+
+/* Call gmp_fscanf, reading the "input" string data provided. */
+int
+fromstring_gmp_fscanf (const char *input, const char *fmt, ...)
+{
+ va_list ap;
+ FILE *fp;
+ int ret;
+ va_start (ap, fmt);
+
+ fp = fopen (TEMPFILE, "w+");
+ ASSERT_ALWAYS (fp != NULL);
+ ASSERT_ALWAYS (fputs (input, fp) != EOF);
+ ASSERT_ALWAYS (fflush (fp) == 0);
+ rewind (fp);
+
+ ret = gmp_vfscanf (fp, fmt, ap);
+ got_ftell = ftell (fp);
+ ASSERT_ALWAYS (got_ftell != -1L);
+
+ fromstring_next_c = getc (fp);
+
+ ASSERT_ALWAYS (fclose (fp) == 0);
+ va_end (ap);
+ return ret;
+}
+
+
+int
+fun_gmp_sscanf (const char *input, const char *fmt, void *a1, void *a2)
+{
+ if (a2 == NULL)
+ return gmp_sscanf (input, fmt, a1);
+ else
+ return gmp_sscanf (input, fmt, a1, a2);
+}
+
+int
+fun_gmp_fscanf (const char *input, const char *fmt, void *a1, void *a2)
+{
+ if (a2 == NULL)
+ return fromstring_gmp_fscanf (input, fmt, a1);
+ else
+ return fromstring_gmp_fscanf (input, fmt, a1, a2);
+}
+
+
+int
+fun_fscanf (const char *input, const char *fmt, void *a1, void *a2)
+{
+ FILE *fp;
+ int ret;
+
+ fp = fopen (TEMPFILE, "w+");
+ ASSERT_ALWAYS (fp != NULL);
+ ASSERT_ALWAYS (fputs (input, fp) != EOF);
+ ASSERT_ALWAYS (fflush (fp) == 0);
+ rewind (fp);
+
+ if (a2 == NULL)
+ ret = fscanf (fp, fmt, a1);
+ else
+ ret = fscanf (fp, fmt, a1, a2);
+
+ got_ftell = ftell (fp);
+ ASSERT_ALWAYS (got_ftell != -1L);
+
+ fromstring_next_c = getc (fp);
+
+ ASSERT_ALWAYS (fclose (fp) == 0);
+ return ret;
+}
+
+
+/* On various old systems, for instance HP-UX 9, the C library sscanf needs
+ to be able to write into the input string. Ensure that this is possible,
+ when gcc is putting the test data into a read-only section.
+
+ Actually we ought to only need this under SSCANF_WRITABLE_INPUT from
+ configure, but it's just as easy to do it unconditionally, and in any
+ case this code is only executed under the -s option. */
+
+int
+fun_sscanf (const char *input, const char *fmt, void *a1, void *a2)
+{
+ char *input_writable;
+ size_t size;
+ int ret;
+
+ size = strlen (input) + 1;
+ input_writable = (char *) (*__gmp_allocate_func) (size);
+ memcpy (input_writable, input, size);
+
+ if (a2 == NULL)
+ ret = sscanf (input_writable, fmt, a1);
+ else
+ ret = sscanf (input_writable, fmt, a1, a2);
+
+ (*__gmp_free_func) (input_writable, size);
+ return ret;
+}
+
+
+/* whether the format string consists entirely of ignored fields */
+int
+fmt_allignore (const char *fmt)
+{
+ int saw_star = 1;
+ for ( ; *fmt != '\0'; fmt++)
+ {
+ switch (*fmt) {
+ case '%':
+ if (! saw_star)
+ return 0;
+ saw_star = 0;
+ break;
+ case '*':
+ saw_star = 1;
+ break;
+ }
+ }
+ return 1;
+}
+
+void
+check_z (void)
+{
+ static const struct {
+ const char *fmt;
+ const char *input;
+ const char *want;
+ int want_ret;
+ long want_ftell;
+ int want_upto;
+ int not_glibc;
+
+ } data[] = {
+
+ { "%Zd", "0", "0", 1, -1, -1 },
+ { "%Zd", "1", "1", 1, -1, -1 },
+ { "%Zd", "123", "123", 1, -1, -1 },
+ { "%Zd", "+0", "0", 1, -1, -1 },
+ { "%Zd", "+1", "1", 1, -1, -1 },
+ { "%Zd", "+123", "123", 1, -1, -1 },
+ { "%Zd", "-0", "0", 1, -1, -1 },
+ { "%Zd", "-1", "-1", 1, -1, -1 },
+ { "%Zd", "-123", "-123", 1, -1, -1 },
+
+ { "%Zo", "0", "0", 1, -1, -1 },
+ { "%Zo", "173", "123", 1, -1, -1 },
+ { "%Zo", "+0", "0", 1, -1, -1 },
+ { "%Zo", "+173", "123", 1, -1, -1 },
+ { "%Zo", "-0", "0", 1, -1, -1 },
+ { "%Zo", "-173", "-123", 1, -1, -1 },
+
+ { "%Zx", "0", "0", 1, -1, -1 },
+ { "%Zx", "7b", "123", 1, -1, -1 },
+ { "%Zx", "7b", "123", 1, -1, -1 },
+ { "%Zx", "+0", "0", 1, -1, -1 },
+ { "%Zx", "+7b", "123", 1, -1, -1 },
+ { "%Zx", "+7b", "123", 1, -1, -1 },
+ { "%Zx", "-0", "-0", 1, -1, -1 },
+ { "%Zx", "-7b", "-123", 1, -1, -1 },
+ { "%Zx", "-7b", "-123", 1, -1, -1 },
+ { "%ZX", "0", "0", 1, -1, -1 },
+ { "%ZX", "7b", "123", 1, -1, -1 },
+ { "%ZX", "7b", "123", 1, -1, -1 },
+ { "%ZX", "+0", "0", 1, -1, -1 },
+ { "%ZX", "+7b", "123", 1, -1, -1 },
+ { "%ZX", "+7b", "123", 1, -1, -1 },
+ { "%ZX", "-0", "-0", 1, -1, -1 },
+ { "%ZX", "-7b", "-123", 1, -1, -1 },
+ { "%ZX", "-7b", "-123", 1, -1, -1 },
+ { "%Zx", "0", "0", 1, -1, -1 },
+ { "%Zx", "7B", "123", 1, -1, -1 },
+ { "%Zx", "7B", "123", 1, -1, -1 },
+ { "%Zx", "+0", "0", 1, -1, -1 },
+ { "%Zx", "+7B", "123", 1, -1, -1 },
+ { "%Zx", "+7B", "123", 1, -1, -1 },
+ { "%Zx", "-0", "-0", 1, -1, -1 },
+ { "%Zx", "-7B", "-123", 1, -1, -1 },
+ { "%Zx", "-7B", "-123", 1, -1, -1 },
+ { "%ZX", "0", "0", 1, -1, -1 },
+ { "%ZX", "7B", "123", 1, -1, -1 },
+ { "%ZX", "7B", "123", 1, -1, -1 },
+ { "%ZX", "+0", "0", 1, -1, -1 },
+ { "%ZX", "+7B", "123", 1, -1, -1 },
+ { "%ZX", "+7B", "123", 1, -1, -1 },
+ { "%ZX", "-0", "-0", 1, -1, -1 },
+ { "%ZX", "-7B", "-123", 1, -1, -1 },
+ { "%ZX", "-7B", "-123", 1, -1, -1 },
+
+ { "%Zi", "0", "0", 1, -1, -1 },
+ { "%Zi", "1", "1", 1, -1, -1 },
+ { "%Zi", "123", "123", 1, -1, -1 },
+ { "%Zi", "+0", "0", 1, -1, -1 },
+ { "%Zi", "+1", "1", 1, -1, -1 },
+ { "%Zi", "+123", "123", 1, -1, -1 },
+ { "%Zi", "-0", "0", 1, -1, -1 },
+ { "%Zi", "-1", "-1", 1, -1, -1 },
+ { "%Zi", "-123", "-123", 1, -1, -1 },
+
+ { "%Zi", "00", "0", 1, -1, -1 },
+ { "%Zi", "0173", "123", 1, -1, -1 },
+ { "%Zi", "+00", "0", 1, -1, -1 },
+ { "%Zi", "+0173", "123", 1, -1, -1 },
+ { "%Zi", "-00", "0", 1, -1, -1 },
+ { "%Zi", "-0173", "-123", 1, -1, -1 },
+
+ { "%Zi", "0x0", "0", 1, -1, -1 },
+ { "%Zi", "0x7b", "123", 1, -1, -1 },
+ { "%Zi", "0x7b", "123", 1, -1, -1 },
+ { "%Zi", "+0x0", "0", 1, -1, -1 },
+ { "%Zi", "+0x7b", "123", 1, -1, -1 },
+ { "%Zi", "+0x7b", "123", 1, -1, -1 },
+ { "%Zi", "-0x0", "-0", 1, -1, -1 },
+ { "%Zi", "-0x7b", "-123", 1, -1, -1 },
+ { "%Zi", "-0x7b", "-123", 1, -1, -1 },
+ { "%Zi", "0X0", "0", 1, -1, -1 },
+ { "%Zi", "0X7b", "123", 1, -1, -1 },
+ { "%Zi", "0X7b", "123", 1, -1, -1 },
+ { "%Zi", "+0X0", "0", 1, -1, -1 },
+ { "%Zi", "+0X7b", "123", 1, -1, -1 },
+ { "%Zi", "+0X7b", "123", 1, -1, -1 },
+ { "%Zi", "-0X0", "-0", 1, -1, -1 },
+ { "%Zi", "-0X7b", "-123", 1, -1, -1 },
+ { "%Zi", "-0X7b", "-123", 1, -1, -1 },
+ { "%Zi", "0x0", "0", 1, -1, -1 },
+ { "%Zi", "0x7B", "123", 1, -1, -1 },
+ { "%Zi", "0x7B", "123", 1, -1, -1 },
+ { "%Zi", "+0x0", "0", 1, -1, -1 },
+ { "%Zi", "+0x7B", "123", 1, -1, -1 },
+ { "%Zi", "+0x7B", "123", 1, -1, -1 },
+ { "%Zi", "-0x0", "-0", 1, -1, -1 },
+ { "%Zi", "-0x7B", "-123", 1, -1, -1 },
+ { "%Zi", "-0x7B", "-123", 1, -1, -1 },
+ { "%Zi", "0X0", "0", 1, -1, -1 },
+ { "%Zi", "0X7B", "123", 1, -1, -1 },
+ { "%Zi", "0X7B", "123", 1, -1, -1 },
+ { "%Zi", "+0X0", "0", 1, -1, -1 },
+ { "%Zi", "+0X7B", "123", 1, -1, -1 },
+ { "%Zi", "+0X7B", "123", 1, -1, -1 },
+ { "%Zi", "-0X0", "-0", 1, -1, -1 },
+ { "%Zi", "-0X7B", "-123", 1, -1, -1 },
+ { "%Zi", "-0X7B", "-123", 1, -1, -1 },
+
+ { "%Zd", " 0", "0", 1, -1, -1 },
+ { "%Zd", " 0", "0", 1, -1, -1 },
+ { "%Zd", " 0", "0", 1, -1, -1 },
+ { "%Zd", "\t0", "0", 1, -1, -1 },
+ { "%Zd", "\t\t0", "0", 1, -1, -1 },
+
+ { "hello%Zd", "hello0", "0", 1, -1, -1 },
+ { "hello%Zd", "hello 0", "0", 1, -1, -1 },
+ { "hello%Zd", "hello \t0", "0", 1, -1, -1 },
+ { "hello%Zdworld", "hello 0world", "0", 1, -1, -1 },
+
+ { "hello%*Zd", "hello0", "-999", 0, -1, -1 },
+ { "hello%*Zd", "hello 0", "-999", 0, -1, -1 },
+ { "hello%*Zd", "hello \t0", "-999", 0, -1, -1 },
+ { "hello%*Zdworld", "hello 0world", "-999", 0, -1, -1 },
+
+ { "%Zd", "", "-999", -1, -1, -555 },
+ { "%Zd", " ", "-999", -1, -1, -555 },
+ { " %Zd", "", "-999", -1, -1, -555 },
+ { "xyz%Zd", "", "-999", -1, -1, -555 },
+
+ { "%*Zd", "", "-999", -1, -1, -555 },
+ { " %*Zd", "", "-999", -1, -1, -555 },
+ { "xyz%*Zd", "", "-999", -1, -1, -555 },
+
+ { "%Zd", "xyz", "0", 0, 0, -555 },
+
+ /* match something, but invalid */
+ { "%Zd", "-", "-999", 0, 1, -555 },
+ { "%Zd", "+", "-999", 0, 1, -555 },
+ { "xyz%Zd", "xyz-", "-999", 0, 4, -555 },
+ { "xyz%Zd", "xyz+", "-999", 0, 4, -555 },
+ { "%Zi", "0x", "-999", 0, 2, -555 },
+ { "%Zi", "0X", "-999", 0, 2, -555 },
+ { "%Zi", "0x-", "-999", 0, 2, -555 },
+ { "%Zi", "0X+", "-999", 0, 2, -555 },
+ { "%Zi", "-0x", "-999", 0, 3, -555 },
+ { "%Zi", "-0X", "-999", 0, 3, -555 },
+ { "%Zi", "+0x", "-999", 0, 3, -555 },
+ { "%Zi", "+0X", "-999", 0, 3, -555 },
+
+ { "%1Zi", "1234", "1", 1, 1, 1 },
+ { "%2Zi", "1234", "12", 1, 2, 2 },
+ { "%3Zi", "1234", "123", 1, 3, 3 },
+ { "%4Zi", "1234", "1234", 1, 4, 4 },
+ { "%5Zi", "1234", "1234", 1, 4, 4 },
+ { "%6Zi", "1234", "1234", 1, 4, 4 },
+
+ { "%1Zi", "01234", "0", 1, 1, 1 },
+ { "%2Zi", "01234", "01", 1, 2, 2 },
+ { "%3Zi", "01234", "012", 1, 3, 3 },
+ { "%4Zi", "01234", "0123", 1, 4, 4 },
+ { "%5Zi", "01234", "01234", 1, 5, 5 },
+ { "%6Zi", "01234", "01234", 1, 5, 5 },
+ { "%7Zi", "01234", "01234", 1, 5, 5 },
+
+ { "%1Zi", "0x1234", "0", 1, 1, 1 },
+ { "%2Zi", "0x1234", "-999", 0, 2, -555 },
+ { "%3Zi", "0x1234", "0x1", 1, 3, 3 },
+ { "%4Zi", "0x1234", "0x12", 1, 4, 4 },
+ { "%5Zi", "0x1234", "0x123", 1, 5, 5 },
+ { "%6Zi", "0x1234", "0x1234", 1, 6, 6 },
+ { "%7Zi", "0x1234", "0x1234", 1, 6, 6 },
+ { "%8Zi", "0x1234", "0x1234", 1, 6, 6 },
+
+ { "%%xyz%Zd", "%xyz123", "123", 1, -1, -1 },
+ { "12%%34%Zd", "12%34567", "567", 1, -1, -1 },
+ { "%%%%%Zd", "%%123", "123", 1, -1, -1 },
+
+ /* various subtle EOF cases */
+ { "x", "", "-999", EOF, 0, -555 },
+ { " x", "", "-999", EOF, 0, -555 },
+ { "xyz", "", "-999", EOF, 0, -555 },
+ { " ", "", "-999", 0, 0, 0 },
+ { " ", " ", "-999", 0, 1, 1 },
+ { "%*Zd%Zd", "", "-999", EOF, 0, -555 },
+ { "%*Zd%Zd", "123", "-999", EOF, 3, -555 },
+ { "x", "x", "-999", 0, 1, 1 },
+ { "xyz", "x", "-999", EOF, 1, -555 },
+ { "xyz", "xy", "-999", EOF, 2, -555 },
+ { "xyz", "xyz", "-999", 0, 3, 3 },
+ { "%Zn", "", "0", 0, 0, 0 },
+ { " %Zn", "", "0", 0, 0, 0 },
+ { " x%Zn", "", "-999", EOF, 0, -555 },
+ { "xyz%Zn", "", "-999", EOF, 0, -555 },
+ { " x%Zn", "", "-999", EOF, 0, -555 },
+ { " %Zn x", " ", "-999", EOF, 1, -555 },
+
+ /* these seem to tickle a bug in glibc 2.2.4 */
+ { " x", " ", "-999", EOF, 1, -555, 1 },
+ { " xyz", " ", "-999", EOF, 1, -555, 1 },
+ { " x%Zn", " ", "-999", EOF, 1, -555, 1 },
+ };
+
+ int i, j, ignore;
+ int got_ret, want_ret, got_upto, want_upto;
+ mpz_t got, want;
+ long got_l, want_ftell;
+ int error = 0;
+ fun_t fun;
+ const char *name;
+ char fmt[128];
+
+ mpz_init (got);
+ mpz_init (want);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_str_or_abort (want, data[i].want, 0);
+
+ ASSERT_ALWAYS (strlen (data[i].fmt) + 2 < sizeof (fmt));
+ strcpy (fmt, data[i].fmt);
+ strcat (fmt, "%n");
+
+ ignore = fmt_allignore (fmt);
+
+ for (j = 0; j <= 3; j++)
+ {
+ want_ret = data[i].want_ret;
+
+ want_ftell = data[i].want_ftell;
+ if (want_ftell == -1)
+ want_ftell = strlen (data[i].input);
+
+ want_upto = data[i].want_upto;
+ if (want_upto == -1)
+ want_upto = strlen (data[i].input);
+
+ switch (j) {
+ case 0:
+ name = "gmp_sscanf";
+ fun = fun_gmp_sscanf;
+ break;
+ case 1:
+ name = "gmp_fscanf";
+ fun = fun_gmp_fscanf;
+ break;
+ case 2:
+#ifdef __GLIBC__
+ if (data[i].not_glibc)
+ continue;
+#endif
+ if (! libc_scanf_convert (fmt))
+ continue;
+ name = "standard sscanf";
+ fun = fun_sscanf;
+ break;
+ case 3:
+#ifdef __GLIBC__
+ if (data[i].not_glibc)
+ continue;
+#endif
+ if (! libc_scanf_convert (fmt))
+ continue;
+ name = "standard fscanf";
+ fun = fun_fscanf;
+ break;
+ default:
+ ASSERT_ALWAYS (0);
+ break;
+ }
+
+ got_upto = -555;
+ got_ftell = -1L;
+
+ switch (j) {
+ case 0:
+ case 1:
+ mpz_set_si (got, -999L);
+ if (ignore)
+ got_ret = (*fun) (data[i].input, fmt, &got_upto, NULL);
+ else
+ got_ret = (*fun) (data[i].input, fmt, got, &got_upto);
+ break;
+ case 2:
+ case 3:
+ got_l = -999L;
+ if (ignore)
+ got_ret = (*fun) (data[i].input, fmt, &got_upto, NULL);
+ else
+ got_ret = (*fun) (data[i].input, fmt, &got_l, &got_upto);
+ mpz_set_si (got, got_l);
+ break;
+ default:
+ ASSERT_ALWAYS (0);
+ break;
+ }
+
+ MPZ_CHECK_FORMAT (got);
+
+ if (got_ret != want_ret)
+ {
+ printf ("%s wrong return value\n", name);
+ error = 1;
+ }
+ if (want_ret == 1 && mpz_cmp (want, got) != 0)
+ {
+ printf ("%s wrong result\n", name);
+ error = 1;
+ }
+ if (got_upto != want_upto)
+ {
+ printf ("%s wrong upto\n", name);
+ error = 1;
+ }
+ if (got_ftell != -1 && want_ftell != -1 && got_ftell != want_ftell)
+ {
+ printf ("%s wrong ftell\n", name);
+ error = 1;
+ }
+ if (error)
+ {
+ printf (" fmt \"%s\"\n", data[i].fmt);
+ printf (" input \"%s\"\n", data[i].input);
+ printf (" ignore %d\n", ignore);
+ printf (" ret want=%d\n", want_ret);
+ printf (" got =%d\n", got_ret);
+ mpz_trace (" value want", want);
+ mpz_trace (" got ", got);
+ printf (" upto want =%d\n", want_upto);
+ printf (" got =%d\n", got_upto);
+ if (got_ftell != -1)
+ {
+ printf (" ftell want =%ld\n", want_ftell);
+ printf (" got =%ld\n", got_ftell);
+ }
+ abort ();
+ }
+ }
+ }
+
+ mpz_clear (got);
+ mpz_clear (want);
+}
+
+void
+check_q (void)
+{
+ static const struct {
+ const char *fmt;
+ const char *input;
+ const char *want;
+ int ret;
+ long ftell;
+
+ } data[] = {
+
+ { "%Qd", "0", "0", 1, -1 },
+ { "%Qd", "1", "1", 1, -1 },
+ { "%Qd", "123", "123", 1, -1 },
+ { "%Qd", "+0", "0", 1, -1 },
+ { "%Qd", "+1", "1", 1, -1 },
+ { "%Qd", "+123", "123", 1, -1 },
+ { "%Qd", "-0", "0", 1, -1 },
+ { "%Qd", "-1", "-1", 1, -1 },
+ { "%Qd", "-123", "-123", 1, -1 },
+
+ { "%Qo", "0", "0", 1, -1 },
+ { "%Qo", "173", "123", 1, -1 },
+ { "%Qo", "+0", "0", 1, -1 },
+ { "%Qo", "+173", "123", 1, -1 },
+ { "%Qo", "-0", "0", 1, -1 },
+ { "%Qo", "-173", "-123", 1, -1 },
+
+ { "%Qx", "0", "0", 1, -1 },
+ { "%Qx", "7b", "123", 1, -1 },
+ { "%Qx", "7b", "123", 1, -1 },
+ { "%Qx", "+0", "0", 1, -1 },
+ { "%Qx", "+7b", "123", 1, -1 },
+ { "%Qx", "+7b", "123", 1, -1 },
+ { "%Qx", "-0", "-0", 1, -1 },
+ { "%Qx", "-7b", "-123", 1, -1 },
+ { "%Qx", "-7b", "-123", 1, -1 },
+ { "%QX", "0", "0", 1, -1 },
+ { "%QX", "7b", "123", 1, -1 },
+ { "%QX", "7b", "123", 1, -1 },
+ { "%QX", "+0", "0", 1, -1 },
+ { "%QX", "+7b", "123", 1, -1 },
+ { "%QX", "+7b", "123", 1, -1 },
+ { "%QX", "-0", "-0", 1, -1 },
+ { "%QX", "-7b", "-123", 1, -1 },
+ { "%QX", "-7b", "-123", 1, -1 },
+ { "%Qx", "0", "0", 1, -1 },
+ { "%Qx", "7B", "123", 1, -1 },
+ { "%Qx", "7B", "123", 1, -1 },
+ { "%Qx", "+0", "0", 1, -1 },
+ { "%Qx", "+7B", "123", 1, -1 },
+ { "%Qx", "+7B", "123", 1, -1 },
+ { "%Qx", "-0", "-0", 1, -1 },
+ { "%Qx", "-7B", "-123", 1, -1 },
+ { "%Qx", "-7B", "-123", 1, -1 },
+ { "%QX", "0", "0", 1, -1 },
+ { "%QX", "7B", "123", 1, -1 },
+ { "%QX", "7B", "123", 1, -1 },
+ { "%QX", "+0", "0", 1, -1 },
+ { "%QX", "+7B", "123", 1, -1 },
+ { "%QX", "+7B", "123", 1, -1 },
+ { "%QX", "-0", "-0", 1, -1 },
+ { "%QX", "-7B", "-123", 1, -1 },
+ { "%QX", "-7B", "-123", 1, -1 },
+
+ { "%Qi", "0", "0", 1, -1 },
+ { "%Qi", "1", "1", 1, -1 },
+ { "%Qi", "123", "123", 1, -1 },
+ { "%Qi", "+0", "0", 1, -1 },
+ { "%Qi", "+1", "1", 1, -1 },
+ { "%Qi", "+123", "123", 1, -1 },
+ { "%Qi", "-0", "0", 1, -1 },
+ { "%Qi", "-1", "-1", 1, -1 },
+ { "%Qi", "-123", "-123", 1, -1 },
+
+ { "%Qi", "00", "0", 1, -1 },
+ { "%Qi", "0173", "123", 1, -1 },
+ { "%Qi", "+00", "0", 1, -1 },
+ { "%Qi", "+0173", "123", 1, -1 },
+ { "%Qi", "-00", "0", 1, -1 },
+ { "%Qi", "-0173", "-123", 1, -1 },
+
+ { "%Qi", "0x0", "0", 1, -1 },
+ { "%Qi", "0x7b", "123", 1, -1 },
+ { "%Qi", "0x7b", "123", 1, -1 },
+ { "%Qi", "+0x0", "0", 1, -1 },
+ { "%Qi", "+0x7b", "123", 1, -1 },
+ { "%Qi", "+0x7b", "123", 1, -1 },
+ { "%Qi", "-0x0", "-0", 1, -1 },
+ { "%Qi", "-0x7b", "-123", 1, -1 },
+ { "%Qi", "-0x7b", "-123", 1, -1 },
+ { "%Qi", "0X0", "0", 1, -1 },
+ { "%Qi", "0X7b", "123", 1, -1 },
+ { "%Qi", "0X7b", "123", 1, -1 },
+ { "%Qi", "+0X0", "0", 1, -1 },
+ { "%Qi", "+0X7b", "123", 1, -1 },
+ { "%Qi", "+0X7b", "123", 1, -1 },
+ { "%Qi", "-0X0", "-0", 1, -1 },
+ { "%Qi", "-0X7b", "-123", 1, -1 },
+ { "%Qi", "-0X7b", "-123", 1, -1 },
+ { "%Qi", "0x0", "0", 1, -1 },
+ { "%Qi", "0x7B", "123", 1, -1 },
+ { "%Qi", "0x7B", "123", 1, -1 },
+ { "%Qi", "+0x0", "0", 1, -1 },
+ { "%Qi", "+0x7B", "123", 1, -1 },
+ { "%Qi", "+0x7B", "123", 1, -1 },
+ { "%Qi", "-0x0", "-0", 1, -1 },
+ { "%Qi", "-0x7B", "-123", 1, -1 },
+ { "%Qi", "-0x7B", "-123", 1, -1 },
+ { "%Qi", "0X0", "0", 1, -1 },
+ { "%Qi", "0X7B", "123", 1, -1 },
+ { "%Qi", "0X7B", "123", 1, -1 },
+ { "%Qi", "+0X0", "0", 1, -1 },
+ { "%Qi", "+0X7B", "123", 1, -1 },
+ { "%Qi", "+0X7B", "123", 1, -1 },
+ { "%Qi", "-0X0", "-0", 1, -1 },
+ { "%Qi", "-0X7B", "-123", 1, -1 },
+ { "%Qi", "-0X7B", "-123", 1, -1 },
+
+ { "%Qd", " 0", "0", 1, -1 },
+ { "%Qd", " 0", "0", 1, -1 },
+ { "%Qd", " 0", "0", 1, -1 },
+ { "%Qd", "\t0", "0", 1, -1 },
+ { "%Qd", "\t\t0", "0", 1, -1 },
+
+ { "%Qd", "3/2", "3/2", 1, -1 },
+ { "%Qd", "+3/2", "3/2", 1, -1 },
+ { "%Qd", "-3/2", "-3/2", 1, -1 },
+
+ { "%Qx", "f/10", "15/16", 1, -1 },
+ { "%Qx", "F/10", "15/16", 1, -1 },
+ { "%QX", "f/10", "15/16", 1, -1 },
+ { "%QX", "F/10", "15/16", 1, -1 },
+
+ { "%Qo", "20/21", "16/17", 1, -1 },
+ { "%Qo", "-20/21", "-16/17", 1, -1 },
+
+ { "%Qi", "10/11", "10/11", 1, -1 },
+ { "%Qi", "+10/11", "10/11", 1, -1 },
+ { "%Qi", "-10/11", "-10/11", 1, -1 },
+ { "%Qi", "010/11", "8/11", 1, -1 },
+ { "%Qi", "+010/11", "8/11", 1, -1 },
+ { "%Qi", "-010/11", "-8/11", 1, -1 },
+ { "%Qi", "0x10/11", "16/11", 1, -1 },
+ { "%Qi", "+0x10/11", "16/11", 1, -1 },
+ { "%Qi", "-0x10/11", "-16/11", 1, -1 },
+
+ { "%Qi", "10/011", "10/9", 1, -1 },
+ { "%Qi", "+10/011", "10/9", 1, -1 },
+ { "%Qi", "-10/011", "-10/9", 1, -1 },
+ { "%Qi", "010/011", "8/9", 1, -1 },
+ { "%Qi", "+010/011", "8/9", 1, -1 },
+ { "%Qi", "-010/011", "-8/9", 1, -1 },
+ { "%Qi", "0x10/011", "16/9", 1, -1 },
+ { "%Qi", "+0x10/011", "16/9", 1, -1 },
+ { "%Qi", "-0x10/011", "-16/9", 1, -1 },
+
+ { "%Qi", "10/0x11", "10/17", 1, -1 },
+ { "%Qi", "+10/0x11", "10/17", 1, -1 },
+ { "%Qi", "-10/0x11", "-10/17", 1, -1 },
+ { "%Qi", "010/0x11", "8/17", 1, -1 },
+ { "%Qi", "+010/0x11", "8/17", 1, -1 },
+ { "%Qi", "-010/0x11", "-8/17", 1, -1 },
+ { "%Qi", "0x10/0x11", "16/17", 1, -1 },
+ { "%Qi", "+0x10/0x11", "16/17", 1, -1 },
+ { "%Qi", "-0x10/0x11", "-16/17", 1, -1 },
+
+ { "hello%Qd", "hello0", "0", 1, -1 },
+ { "hello%Qd", "hello 0", "0", 1, -1 },
+ { "hello%Qd", "hello \t0", "0", 1, -1 },
+ { "hello%Qdworld", "hello 0world", "0", 1, -1 },
+ { "hello%Qd", "hello3/2", "3/2", 1, -1 },
+
+ { "hello%*Qd", "hello0", "-999/121", 0, -1 },
+ { "hello%*Qd", "hello 0", "-999/121", 0, -1 },
+ { "hello%*Qd", "hello \t0", "-999/121", 0, -1 },
+ { "hello%*Qdworld", "hello 0world", "-999/121", 0, -1 },
+ { "hello%*Qdworld", "hello3/2world", "-999/121", 0, -1 },
+
+ { "%Qd", "", "-999/121", -1, -1 },
+ { "%Qd", " ", "-999/121", -1, -1 },
+ { " %Qd", "", "-999/121", -1, -1 },
+ { "xyz%Qd", "", "-999/121", -1, -1 },
+
+ { "%*Qd", "", "-999/121", -1, -1 },
+ { " %*Qd", "", "-999/121", -1, -1 },
+ { "xyz%*Qd", "", "-999/121", -1, -1 },
+
+ /* match something, but invalid */
+ { "%Qd", "-", "-999/121", 0, 1 },
+ { "%Qd", "+", "-999/121", 0, 1 },
+ { "%Qd", "/-", "-999/121", 0, 1 },
+ { "%Qd", "/+", "-999/121", 0, 1 },
+ { "%Qd", "-/", "-999/121", 0, 1 },
+ { "%Qd", "+/", "-999/121", 0, 1 },
+ { "%Qd", "-/-", "-999/121", 0, 1 },
+ { "%Qd", "-/+", "-999/121", 0, 1 },
+ { "%Qd", "+/+", "-999/121", 0, 1 },
+ { "%Qd", "/123", "-999/121", 0, 1 },
+ { "%Qd", "-/123", "-999/121", 0, 1 },
+ { "%Qd", "+/123", "-999/121", 0, 1 },
+ { "%Qd", "123/", "-999/121", 0, 1 },
+ { "%Qd", "123/-", "-999/121", 0, 1 },
+ { "%Qd", "123/+", "-999/121", 0, 1 },
+ { "xyz%Qd", "xyz-", "-999/121", 0, 4 },
+ { "xyz%Qd", "xyz+", "-999/121", 0, 4 },
+
+ { "%1Qi", "12/57", "1", 1, 1 },
+ { "%2Qi", "12/57", "12", 1, 2 },
+ { "%3Qi", "12/57", "-999/121", 0, -1 },
+ { "%4Qi", "12/57", "12/5", 1, 4 },
+ { "%5Qi", "12/57", "12/57", 1, 5 },
+ { "%6Qi", "12/57", "12/57", 1, 5 },
+ { "%7Qi", "12/57", "12/57", 1, 5 },
+
+ { "%1Qi", "012/057", "0", 1, 1 },
+ { "%2Qi", "012/057", "01", 1, 2 },
+ { "%3Qi", "012/057", "012", 1, 3 },
+ { "%4Qi", "012/057", "-999/121", 0, -1 },
+ { "%5Qi", "012/057", "012/0", 1, 5 },
+ { "%6Qi", "012/057", "012/5", 1, 6 },
+ { "%7Qi", "012/057", "012/057", 1, 7 },
+ { "%8Qi", "012/057", "012/057", 1, 7 },
+ { "%9Qi", "012/057", "012/057", 1, 7 },
+
+ { "%1Qi", "0x12/0x57", "0", 1, 1 },
+ { "%2Qi", "0x12/0x57", "-999", 0, 2 },
+ { "%3Qi", "0x12/0x57", "0x1", 1, 3 },
+ { "%4Qi", "0x12/0x57", "0x12", 1, 4 },
+ { "%5Qi", "0x12/0x57", "-999/121", 0, 5 },
+ { "%6Qi", "0x12/0x57", "0x12/0", 1, 6 },
+ { "%7Qi", "0x12/0x57", "-999/121", 0, 7 },
+ { "%8Qi", "0x12/0x57", "0x12/0x5", 1, 8 },
+ { "%9Qi", "0x12/0x57", "0x12/0x57", 1, 9 },
+ { "%10Qi", "0x12/0x57", "0x12/0x57", 1, 9 },
+ { "%11Qi", "0x12/0x57", "0x12/0x57", 1, 9 },
+
+ { "%Qd", "xyz", "0", 0, 0 },
+ };
+
+ int i, j, ignore, got_ret, want_ret, got_upto, want_upto;
+ mpq_t got, want;
+ long got_l, want_ftell;
+ int error = 0;
+ fun_t fun;
+ const char *name;
+ char fmt[128];
+
+ mpq_init (got);
+ mpq_init (want);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpq_set_str_or_abort (want, data[i].want, 0);
+
+ ASSERT_ALWAYS (strlen (data[i].fmt) + 2 < sizeof (fmt));
+ strcpy (fmt, data[i].fmt);
+ strcat (fmt, "%n");
+
+ ignore = (strchr (fmt, '*') != NULL);
+
+ for (j = 0; j <= 3; j++)
+ {
+ want_ret = data[i].ret;
+
+ want_ftell = data[i].ftell;
+ if (want_ftell == -1)
+ want_ftell = strlen (data[i].input);
+ want_upto = want_ftell;
+
+ if (want_ret == -1 || (want_ret == 0 && ! ignore))
+ {
+ want_ftell = -1;
+ want_upto = -555;
+ }
+
+ switch (j) {
+ case 0:
+ name = "gmp_sscanf";
+ fun = fun_gmp_sscanf;
+ break;
+ case 1:
+ name = "gmp_fscanf";
+ fun = fun_gmp_fscanf;
+ break;
+ case 2:
+ if (strchr (data[i].input, '/') != NULL)
+ continue;
+ if (! libc_scanf_convert (fmt))
+ continue;
+ name = "standard sscanf";
+ fun = fun_sscanf;
+ break;
+ case 3:
+ if (strchr (data[i].input, '/') != NULL)
+ continue;
+ if (! libc_scanf_convert (fmt))
+ continue;
+ name = "standard fscanf";
+ fun = fun_fscanf;
+ break;
+ default:
+ ASSERT_ALWAYS (0);
+ break;
+ }
+
+ got_upto = -555;
+ got_ftell = -1;
+
+ switch (j) {
+ case 0:
+ case 1:
+ mpq_set_si (got, -999L, 121L);
+ if (ignore)
+ got_ret = (*fun) (data[i].input, fmt, &got_upto, NULL);
+ else
+ got_ret = (*fun) (data[i].input, fmt, got, &got_upto);
+ break;
+ case 2:
+ case 3:
+ got_l = -999L;
+ if (ignore)
+ got_ret = (*fun) (data[i].input, fmt, &got_upto, NULL);
+ else
+ got_ret = (*fun) (data[i].input, fmt, &got_l, &got_upto);
+ mpq_set_si (got, got_l, (got_l == -999L ? 121L : 1L));
+ break;
+ default:
+ ASSERT_ALWAYS (0);
+ break;
+ }
+
+ MPZ_CHECK_FORMAT (mpq_numref (got));
+ MPZ_CHECK_FORMAT (mpq_denref (got));
+
+ if (got_ret != want_ret)
+ {
+ printf ("%s wrong return value\n", name);
+ error = 1;
+ }
+ /* use direct mpz compares, since some of the test data is
+ non-canonical and can trip ASSERTs in mpq_equal */
+ if (want_ret == 1
+ && ! (mpz_cmp (mpq_numref(want), mpq_numref(got)) == 0
+ && mpz_cmp (mpq_denref(want), mpq_denref(got)) == 0))
+ {
+ printf ("%s wrong result\n", name);
+ error = 1;
+ }
+ if (got_upto != want_upto)
+ {
+ printf ("%s wrong upto\n", name);
+ error = 1;
+ }
+ if (got_ftell != -1 && want_ftell != -1 && got_ftell != want_ftell)
+ {
+ printf ("%s wrong ftell\n", name);
+ error = 1;
+ }
+ if (error)
+ {
+ printf (" fmt \"%s\"\n", data[i].fmt);
+ printf (" input \"%s\"\n", data[i].input);
+ printf (" ret want=%d\n", want_ret);
+ printf (" got =%d\n", got_ret);
+ mpq_trace (" value want", want);
+ mpq_trace (" got ", got);
+ printf (" upto want=%d\n", want_upto);
+ printf (" got =%d\n", got_upto);
+ if (got_ftell != -1)
+ {
+ printf (" ftell want =%ld\n", want_ftell);
+ printf (" got =%ld\n", got_ftell);
+ }
+ abort ();
+ }
+ }
+ }
+
+ mpq_clear (got);
+ mpq_clear (want);
+}
+
+void
+check_f (void)
+{
+ static const struct {
+ const char *fmt;
+ const char *input;
+ const char *want;
+ int ret;
+ long ftell; /* or -1 for length of input string */
+
+ } data[] = {
+
+ { "%Ff", "0", "0", 1, -1 },
+ { "%Fe", "0", "0", 1, -1 },
+ { "%FE", "0", "0", 1, -1 },
+ { "%Fg", "0", "0", 1, -1 },
+ { "%FG", "0", "0", 1, -1 },
+
+ { "%Ff", "123", "123", 1, -1 },
+ { "%Ff", "+123", "123", 1, -1 },
+ { "%Ff", "-123", "-123", 1, -1 },
+ { "%Ff", "123.", "123", 1, -1 },
+ { "%Ff", "+123.", "123", 1, -1 },
+ { "%Ff", "-123.", "-123", 1, -1 },
+ { "%Ff", "123.0", "123", 1, -1 },
+ { "%Ff", "+123.0", "123", 1, -1 },
+ { "%Ff", "-123.0", "-123", 1, -1 },
+ { "%Ff", "0123", "123", 1, -1 },
+ { "%Ff", "-0123", "-123", 1, -1 },
+
+ { "%Ff", "123.456e3", "123456", 1, -1 },
+ { "%Ff", "-123.456e3", "-123456", 1, -1 },
+ { "%Ff", "123.456e+3", "123456", 1, -1 },
+ { "%Ff", "-123.456e+3", "-123456", 1, -1 },
+ { "%Ff", "123000e-3", "123", 1, -1 },
+ { "%Ff", "-123000e-3", "-123", 1, -1 },
+ { "%Ff", "123000.e-3", "123", 1, -1 },
+ { "%Ff", "-123000.e-3", "-123", 1, -1 },
+
+ { "%Ff", "123.456E3", "123456", 1, -1 },
+ { "%Ff", "-123.456E3", "-123456", 1, -1 },
+ { "%Ff", "123.456E+3", "123456", 1, -1 },
+ { "%Ff", "-123.456E+3", "-123456", 1, -1 },
+ { "%Ff", "123000E-3", "123", 1, -1 },
+ { "%Ff", "-123000E-3", "-123", 1, -1 },
+ { "%Ff", "123000.E-3", "123", 1, -1 },
+ { "%Ff", "-123000.E-3", "-123", 1, -1 },
+
+ { "%Ff", ".456e3", "456", 1, -1 },
+ { "%Ff", "-.456e3", "-456", 1, -1 },
+ { "%Ff", ".456e+3", "456", 1, -1 },
+ { "%Ff", "-.456e+3", "-456", 1, -1 },
+
+ { "%Ff", " 0", "0", 1, -1 },
+ { "%Ff", " 0", "0", 1, -1 },
+ { "%Ff", " 0", "0", 1, -1 },
+ { "%Ff", "\t0", "0", 1, -1 },
+ { "%Ff", "\t\t0", "0", 1, -1 },
+
+ { "hello%Fg", "hello0", "0", 1, -1 },
+ { "hello%Fg", "hello 0", "0", 1, -1 },
+ { "hello%Fg", "hello \t0", "0", 1, -1 },
+ { "hello%Fgworld", "hello 0world", "0", 1, -1 },
+ { "hello%Fg", "hello3.0", "3.0", 1, -1 },
+
+ { "hello%*Fg", "hello0", "-999", 0, -1 },
+ { "hello%*Fg", "hello 0", "-999", 0, -1 },
+ { "hello%*Fg", "hello \t0", "-999", 0, -1 },
+ { "hello%*Fgworld", "hello 0world", "-999", 0, -1 },
+ { "hello%*Fgworld", "hello3.0world", "-999", 0, -1 },
+
+ { "%Ff", "", "-999", -1, -1 },
+ { "%Ff", " ", "-999", -1, -1 },
+ { "%Ff", "\t", "-999", -1, -1 },
+ { "%Ff", " \t", "-999", -1, -1 },
+ { " %Ff", "", "-999", -1, -1 },
+ { "xyz%Ff", "", "-999", -1, -1 },
+
+ { "%*Ff", "", "-999", -1, -1 },
+ { " %*Ff", "", "-999", -1, -1 },
+ { "xyz%*Ff", "", "-999", -1, -1 },
+
+ { "%Ff", "xyz", "0", 0 },
+
+ /* various non-empty but invalid */
+ { "%Ff", "-", "-999", 0, 1 },
+ { "%Ff", "+", "-999", 0, 1 },
+ { "xyz%Ff", "xyz-", "-999", 0, 4 },
+ { "xyz%Ff", "xyz+", "-999", 0, 4 },
+ { "%Ff", "-.", "-999", 0, 2 },
+ { "%Ff", "+.", "-999", 0, 2 },
+ { "%Ff", ".e", "-999", 0, 1 },
+ { "%Ff", "-.e", "-999", 0, 2 },
+ { "%Ff", "+.e", "-999", 0, 2 },
+ { "%Ff", ".E", "-999", 0, 1 },
+ { "%Ff", "-.E", "-999", 0, 2 },
+ { "%Ff", "+.E", "-999", 0, 2 },
+ { "%Ff", ".e123", "-999", 0, 1 },
+ { "%Ff", "-.e123", "-999", 0, 2 },
+ { "%Ff", "+.e123", "-999", 0, 2 },
+ { "%Ff", "123e", "-999", 0, 4 },
+ { "%Ff", "-123e", "-999", 0, 5 },
+ { "%Ff", "123e-", "-999", 0, 5 },
+ { "%Ff", "-123e-", "-999", 0, 6 },
+ { "%Ff", "123e+", "-999", 0, 5 },
+ { "%Ff", "-123e+", "-999", 0, 6 },
+ { "%Ff", "123e-Z", "-999", 0, 5 },
+
+ /* hex floats */
+ { "%Ff", "0x123p0", "291", 1, -1 },
+ { "%Ff", "0x123P0", "291", 1, -1 },
+ { "%Ff", "0X123p0", "291", 1, -1 },
+ { "%Ff", "0X123P0", "291", 1, -1 },
+ { "%Ff", "-0x123p0", "-291", 1, -1 },
+ { "%Ff", "+0x123p0", "291", 1, -1 },
+ { "%Ff", "0x123.p0", "291", 1, -1 },
+ { "%Ff", "0x12.3p4", "291", 1, -1 },
+ { "%Ff", "-0x12.3p4", "-291", 1, -1 },
+ { "%Ff", "+0x12.3p4", "291", 1, -1 },
+ { "%Ff", "0x1230p-4", "291", 1, -1 },
+ { "%Ff", "-0x1230p-4", "-291", 1, -1 },
+ { "%Ff", "+0x1230p-4", "291", 1, -1 },
+ { "%Ff", "+0x.1230p12", "291", 1, -1 },
+ { "%Ff", "+0x123000p-12", "291", 1, -1 },
+ { "%Ff", "0x123 p12", "291", 1, 5 },
+ { "%Ff", "0x9 9", "9", 1, 3 },
+ { "%Ff", "0x01", "1", 1, 4 },
+ { "%Ff", "0x23", "35", 1, 4 },
+ { "%Ff", "0x45", "69", 1, 4 },
+ { "%Ff", "0x67", "103", 1, 4 },
+ { "%Ff", "0x89", "137", 1, 4 },
+ { "%Ff", "0xAB", "171", 1, 4 },
+ { "%Ff", "0xCD", "205", 1, 4 },
+ { "%Ff", "0xEF", "239", 1, 4 },
+ { "%Ff", "0xab", "171", 1, 4 },
+ { "%Ff", "0xcd", "205", 1, 4 },
+ { "%Ff", "0xef", "239", 1, 4 },
+ { "%Ff", "0x100p0A", "256", 1, 7 },
+ { "%Ff", "0x1p9", "512", 1, -1 },
+
+ /* invalid hex floats */
+ { "%Ff", "0x", "-999", 0, 2 },
+ { "%Ff", "-0x", "-999", 0, 3 },
+ { "%Ff", "+0x", "-999", 0, 3 },
+ { "%Ff", "0x-", "-999", 0, 2 },
+ { "%Ff", "0x+", "-999", 0, 2 },
+ { "%Ff", "0x.", "-999", 0, 3 },
+ { "%Ff", "-0x.", "-999", 0, 4 },
+ { "%Ff", "+0x.", "-999", 0, 4 },
+ { "%Ff", "0x.p", "-999", 0, 3 },
+ { "%Ff", "-0x.p", "-999", 0, 4 },
+ { "%Ff", "+0x.p", "-999", 0, 4 },
+ { "%Ff", "0x.P", "-999", 0, 3 },
+ { "%Ff", "-0x.P", "-999", 0, 4 },
+ { "%Ff", "+0x.P", "-999", 0, 4 },
+ { "%Ff", ".p123", "-999", 0, 1 },
+ { "%Ff", "-.p123", "-999", 0, 2 },
+ { "%Ff", "+.p123", "-999", 0, 2 },
+ { "%Ff", "0x1p", "-999", 0, 4 },
+ { "%Ff", "0x1p-", "-999", 0, 5 },
+ { "%Ff", "0x1p+", "-999", 0, 5 },
+ { "%Ff", "0x123p 12", "291", 0, 6 },
+ { "%Ff", "0x 123p12", "291", 0, 2 },
+
+ };
+
+ int i, j, ignore, got_ret, want_ret, got_upto, want_upto;
+ mpf_t got, want;
+ double got_d;
+ long want_ftell;
+ int error = 0;
+ fun_t fun;
+ const char *name;
+ char fmt[128];
+
+ mpf_init (got);
+ mpf_init (want);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpf_set_str_or_abort (want, data[i].want, 10);
+
+ ASSERT_ALWAYS (strlen (data[i].fmt) + 2 < sizeof (fmt));
+ strcpy (fmt, data[i].fmt);
+ strcat (fmt, "%n");
+
+ ignore = (strchr (fmt, '*') != NULL);
+
+ for (j = 0; j <= 3; j++)
+ {
+ want_ret = data[i].ret;
+
+ want_ftell = data[i].ftell;
+ if (want_ftell == -1)
+ want_ftell = strlen (data[i].input);
+ want_upto = want_ftell;
+
+ if (want_ret == -1 || (want_ret == 0 && ! ignore))
+ want_upto = -555;
+
+ switch (j) {
+ case 0:
+ name = "gmp_sscanf";
+ fun = fun_gmp_sscanf;
+ break;
+ case 1:
+ name = "gmp_fscanf";
+ fun = fun_gmp_fscanf;
+ break;
+ case 2:
+ if (! libc_scanf_convert (fmt))
+ continue;
+ name = "standard sscanf";
+ fun = fun_sscanf;
+ break;
+ case 3:
+ if (! libc_scanf_convert (fmt))
+ continue;
+ name = "standard fscanf";
+ fun = fun_fscanf;
+ break;
+ default:
+ ASSERT_ALWAYS (0);
+ break;
+ }
+
+ got_upto = -555;
+ got_ftell = -1;
+
+ switch (j) {
+ case 0:
+ case 1:
+ mpf_set_si (got, -999L);
+ if (ignore)
+ got_ret = (*fun) (data[i].input, fmt, &got_upto, NULL);
+ else
+ got_ret = (*fun) (data[i].input, fmt, got, &got_upto);
+ break;
+ case 2:
+ case 3:
+ got_d = -999L;
+ if (ignore)
+ got_ret = (*fun) (data[i].input, fmt, &got_upto, NULL);
+ else
+ got_ret = (*fun) (data[i].input, fmt, &got_d, &got_upto);
+ mpf_set_d (got, got_d);
+ break;
+ default:
+ ASSERT_ALWAYS (0);
+ break;
+ }
+
+ MPF_CHECK_FORMAT (got);
+
+ if (got_ret != want_ret)
+ {
+ printf ("%s wrong return value\n", name);
+ error = 1;
+ }
+ if (want_ret == 1 && mpf_cmp (want, got) != 0)
+ {
+ printf ("%s wrong result\n", name);
+ error = 1;
+ }
+ if (got_upto != want_upto)
+ {
+ printf ("%s wrong upto\n", name);
+ error = 1;
+ }
+ if (got_ftell != -1 && want_ftell != -1 && got_ftell != want_ftell)
+ {
+ printf ("%s wrong ftell\n", name);
+ error = 1;
+ }
+ if (error)
+ {
+ printf (" fmt \"%s\"\n", data[i].fmt);
+ printf (" input \"%s\"\n", data[i].input);
+ printf (" ret want=%d\n", want_ret);
+ printf (" got =%d\n", got_ret);
+ mpf_trace (" value want", want);
+ mpf_trace (" got ", got);
+ printf (" upto want=%d\n", want_upto);
+ printf (" got =%d\n", got_upto);
+ if (got_ftell != -1)
+ {
+ printf (" ftell want =%ld\n", want_ftell);
+ printf (" got =%ld\n", got_ftell);
+ }
+ abort ();
+ }
+ }
+ }
+
+ mpf_clear (got);
+ mpf_clear (want);
+}
+
+
+void
+check_n (void)
+{
+ int ret;
+
+ /* %n suppressed */
+ {
+ int n = 123;
+ gmp_sscanf (" ", " %*n", &n);
+ ASSERT_ALWAYS (n == 123);
+ }
+ {
+ int n = 123;
+ fromstring_gmp_fscanf (" ", " %*n", &n);
+ ASSERT_ALWAYS (n == 123);
+ }
+
+
+#define CHECK_N(type, string) \
+ do { \
+ type x[2]; \
+ char fmt[128]; \
+ int ret; \
+ \
+ x[0] = ~ (type) 0; \
+ x[1] = ~ (type) 0; \
+ sprintf (fmt, "abc%%%sn", string); \
+ ret = gmp_sscanf ("abc", fmt, &x[0]); \
+ \
+ ASSERT_ALWAYS (ret == 0); \
+ \
+ /* should write whole of x[0] and none of x[1] */ \
+ ASSERT_ALWAYS (x[0] == 3); \
+ ASSERT_ALWAYS (x[1] == (type) ~ (type) 0); \
+ \
+ } while (0)
+
+ CHECK_N (char, "hh");
+ CHECK_N (long, "l");
+#if HAVE_LONG_LONG
+ CHECK_N (long long, "L");
+#endif
+#if HAVE_INTMAX_T
+ CHECK_N (intmax_t, "j");
+#endif
+#if HAVE_PTRDIFF_T
+ CHECK_N (ptrdiff_t, "t");
+#endif
+ CHECK_N (short, "h");
+ CHECK_N (size_t, "z");
+
+ /* %Zn */
+ {
+ mpz_t x[2];
+ mpz_init_set_si (x[0], -987L);
+ mpz_init_set_si (x[1], 654L);
+ ret = gmp_sscanf ("xyz ", "xyz%Zn", x[0]);
+ MPZ_CHECK_FORMAT (x[0]);
+ MPZ_CHECK_FORMAT (x[1]);
+ ASSERT_ALWAYS (ret == 0);
+ ASSERT_ALWAYS (mpz_cmp_ui (x[0], 3L) == 0);
+ ASSERT_ALWAYS (mpz_cmp_ui (x[1], 654L) == 0);
+ mpz_clear (x[0]);
+ mpz_clear (x[1]);
+ }
+ {
+ mpz_t x;
+ mpz_init (x);
+ ret = fromstring_gmp_fscanf ("xyz ", "xyz%Zn", x);
+ ASSERT_ALWAYS (ret == 0);
+ ASSERT_ALWAYS (mpz_cmp_ui (x, 3L) == 0);
+ mpz_clear (x);
+ }
+
+ /* %Qn */
+ {
+ mpq_t x[2];
+ mpq_init (x[0]);
+ mpq_init (x[1]);
+ mpq_set_ui (x[0], 987L, 654L);
+ mpq_set_ui (x[1], 4115L, 226L);
+ ret = gmp_sscanf ("xyz ", "xyz%Qn", x[0]);
+ MPQ_CHECK_FORMAT (x[0]);
+ MPQ_CHECK_FORMAT (x[1]);
+ ASSERT_ALWAYS (ret == 0);
+ ASSERT_ALWAYS (mpq_cmp_ui (x[0], 3L, 1L) == 0);
+ ASSERT_ALWAYS (mpq_cmp_ui (x[1], 4115L, 226L) == 0);
+ mpq_clear (x[0]);
+ mpq_clear (x[1]);
+ }
+ {
+ mpq_t x;
+ mpq_init (x);
+ ret = fromstring_gmp_fscanf ("xyz ", "xyz%Qn", x);
+ ASSERT_ALWAYS (ret == 0);
+ ASSERT_ALWAYS (mpq_cmp_ui (x, 3L, 1L) == 0);
+ mpq_clear (x);
+ }
+
+ /* %Fn */
+ {
+ mpf_t x[2];
+ mpf_init (x[0]);
+ mpf_init (x[1]);
+ mpf_set_ui (x[0], 987L);
+ mpf_set_ui (x[1], 654L);
+ ret = gmp_sscanf ("xyz ", "xyz%Fn", x[0]);
+ MPF_CHECK_FORMAT (x[0]);
+ MPF_CHECK_FORMAT (x[1]);
+ ASSERT_ALWAYS (ret == 0);
+ ASSERT_ALWAYS (mpf_cmp_ui (x[0], 3L) == 0);
+ ASSERT_ALWAYS (mpf_cmp_ui (x[1], 654L) == 0);
+ mpf_clear (x[0]);
+ mpf_clear (x[1]);
+ }
+ {
+ mpf_t x;
+ mpf_init (x);
+ ret = fromstring_gmp_fscanf ("xyz ", "xyz%Fn", x);
+ ASSERT_ALWAYS (ret == 0);
+ ASSERT_ALWAYS (mpf_cmp_ui (x, 3L) == 0);
+ mpf_clear (x);
+ }
+}
+
+
+void
+check_misc (void)
+{
+ int ret, cmp;
+ {
+ int a=9, b=8, c=7, n=66;
+ mpz_t z;
+ mpz_init (z);
+ ret = gmp_sscanf ("1 2 3 4", "%d %d %d %Zd%n",
+ &a, &b, &c, z, &n);
+ ASSERT_ALWAYS (ret == 4);
+ ASSERT_ALWAYS (a == 1);
+ ASSERT_ALWAYS (b == 2);
+ ASSERT_ALWAYS (c == 3);
+ ASSERT_ALWAYS (n == 7);
+ ASSERT_ALWAYS (mpz_cmp_ui (z, 4L) == 0);
+ mpz_clear (z);
+ }
+ {
+ int a=9, b=8, c=7, n=66;
+ mpz_t z;
+ mpz_init (z);
+ ret = fromstring_gmp_fscanf ("1 2 3 4", "%d %d %d %Zd%n",
+ &a, &b, &c, z, &n);
+ ASSERT_ALWAYS (ret == 4);
+ ASSERT_ALWAYS (a == 1);
+ ASSERT_ALWAYS (b == 2);
+ ASSERT_ALWAYS (c == 3);
+ ASSERT_ALWAYS (mpz_cmp_ui (z, 4L) == 0);
+ ASSERT_ALWAYS (n == 7);
+ ASSERT_ALWAYS (got_ftell == 7);
+ mpz_clear (z);
+ }
+
+ {
+ int a=9, n=8;
+ mpz_t z;
+ mpz_init (z);
+ ret = gmp_sscanf ("1 2 3 4", "%d %*d %*d %Zd%n", &a, z, &n);
+ ASSERT_ALWAYS (ret == 2);
+ ASSERT_ALWAYS (a == 1);
+ ASSERT_ALWAYS (mpz_cmp_ui (z, 4L) == 0);
+ ASSERT_ALWAYS (n == 7);
+ mpz_clear (z);
+ }
+ {
+ int a=9, n=8;
+ mpz_t z;
+ mpz_init (z);
+ ret = fromstring_gmp_fscanf ("1 2 3 4", "%d %*d %*d %Zd%n",
+ &a, z, &n);
+ ASSERT_ALWAYS (ret == 2);
+ ASSERT_ALWAYS (a == 1);
+ ASSERT_ALWAYS (mpz_cmp_ui (z, 4L) == 0);
+ ASSERT_ALWAYS (n == 7);
+ ASSERT_ALWAYS (got_ftell == 7);
+ mpz_clear (z);
+ }
+
+ /* EOF for no matching */
+ {
+ char buf[128];
+ ret = gmp_sscanf (" ", "%s", buf);
+ ASSERT_ALWAYS (ret == EOF);
+ ret = fromstring_gmp_fscanf (" ", "%s", buf);
+ ASSERT_ALWAYS (ret == EOF);
+ if (option_libc_scanf)
+ {
+ ret = sscanf (" ", "%s", buf);
+ ASSERT_ALWAYS (ret == EOF);
+ ret = fun_fscanf (" ", "%s", buf, NULL);
+ ASSERT_ALWAYS (ret == EOF);
+ }
+ }
+
+ /* suppressed field, then eof */
+ {
+ int x;
+ if (test_sscanf_eof_ok ())
+ {
+ ret = gmp_sscanf ("123", "%*d%d", &x);
+ ASSERT_ALWAYS (ret == EOF);
+ }
+ ret = fromstring_gmp_fscanf ("123", "%*d%d", &x);
+ ASSERT_ALWAYS (ret == EOF);
+ if (option_libc_scanf)
+ {
+ ret = sscanf ("123", "%*d%d", &x);
+ ASSERT_ALWAYS (ret == EOF);
+ ret = fun_fscanf ("123", "%*d%d", &x, NULL);
+ ASSERT_ALWAYS (ret == EOF);
+ }
+ }
+ {
+ mpz_t x;
+ mpz_init (x);
+ ret = gmp_sscanf ("123", "%*Zd%Zd", x);
+ ASSERT_ALWAYS (ret == EOF);
+ ret = fromstring_gmp_fscanf ("123", "%*Zd%Zd", x);
+ ASSERT_ALWAYS (ret == EOF);
+ mpz_clear (x);
+ }
+
+ /* %[...], glibc only */
+#ifdef __GLIBC__
+ {
+ char buf[128];
+ int n = -1;
+ buf[0] = '\0';
+ ret = gmp_sscanf ("abcdefgh", "%[a-d]ef%n", buf, &n);
+ ASSERT_ALWAYS (ret == 1);
+ cmp = strcmp (buf, "abcd");
+ ASSERT_ALWAYS (cmp == 0);
+ ASSERT_ALWAYS (n == 6);
+ }
+ {
+ char buf[128];
+ int n = -1;
+ buf[0] = '\0';
+ ret = gmp_sscanf ("xyza", "%[^a]a%n", buf, &n);
+ ASSERT_ALWAYS (ret == 1);
+ cmp = strcmp (buf, "xyz");
+ ASSERT_ALWAYS (cmp == 0);
+ ASSERT_ALWAYS (n == 4);
+ }
+ {
+ char buf[128];
+ int n = -1;
+ buf[0] = '\0';
+ ret = gmp_sscanf ("ab]ab]", "%[]ab]%n", buf, &n);
+ ASSERT_ALWAYS (ret == 1);
+ cmp = strcmp (buf, "ab]ab]");
+ ASSERT_ALWAYS (cmp == 0);
+ ASSERT_ALWAYS (n == 6);
+ }
+ {
+ char buf[128];
+ int n = -1;
+ buf[0] = '\0';
+ ret = gmp_sscanf ("xyzb", "%[^]ab]b%n", buf, &n);
+ ASSERT_ALWAYS (ret == 1);
+ cmp = strcmp (buf, "xyz");
+ ASSERT_ALWAYS (cmp == 0);
+ ASSERT_ALWAYS (n == 4);
+ }
+#endif
+
+ /* %zd etc won't be accepted by sscanf on old systems, and running
+ something to see if they work might be bad, so only try it on glibc,
+ and only on a new enough version (glibc 2.0 doesn't have %zd) */
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 0)
+ {
+ mpz_t z;
+ size_t s = -1;
+ mpz_init (z);
+ ret = gmp_sscanf ("456 789", "%zd %Zd", &s, z);
+ ASSERT_ALWAYS (ret == 2);
+ ASSERT_ALWAYS (s == 456);
+ ASSERT_ALWAYS (mpz_cmp_ui (z, 789L) == 0);
+ mpz_clear (z);
+ }
+ {
+ mpz_t z;
+ ptrdiff_t d = -1;
+ mpz_init (z);
+ ret = gmp_sscanf ("456 789", "%td %Zd", &d, z);
+ ASSERT_ALWAYS (ret == 2);
+ ASSERT_ALWAYS (d == 456);
+ ASSERT_ALWAYS (mpz_cmp_ui (z, 789L) == 0);
+ mpz_clear (z);
+ }
+ {
+ mpz_t z;
+ long long ll = -1;
+ mpz_init (z);
+ ret = gmp_sscanf ("456 789", "%Ld %Zd", &ll, z);
+ ASSERT_ALWAYS (ret == 2);
+ ASSERT_ALWAYS (ll == 456);
+ ASSERT_ALWAYS (mpz_cmp_ui (z, 789L) == 0);
+ mpz_clear (z);
+ }
+#endif
+}
+
+int
+main (int argc, char *argv[])
+{
+ if (argc > 1 && strcmp (argv[1], "-s") == 0)
+ option_libc_scanf = 1;
+
+ tests_start ();
+
+ mp_trace_base = 16;
+
+ check_z ();
+ check_q ();
+ check_f ();
+ check_n ();
+ check_misc ();
+
+ unlink (TEMPFILE);
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/Makefile.am b/vendor/gmp-6.3.0/tests/mpf/Makefile.am
new file mode 100644
index 0000000..da0e92b
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/Makefile.am
@@ -0,0 +1,32 @@
+## Process this file with automake to generate Makefile.in
+
+# Copyright 1996, 1999-2004, 2015 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+
+
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
+AM_LDFLAGS = -no-install
+LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
+
+check_PROGRAMS = t-dm2exp t-conv t-add t-sub t-sqrt t-sqrt_ui t-muldiv reuse \
+ t-cmp_d t-cmp_si t-div t-fits t-get_d t-get_d_2exp \
+ t-get_si t-get_ui t-gsprec t-inp_str t-int_p t-mul_ui \
+ t-set t-set_q t-set_si t-set_ui t-trunc t-ui_div t-eq t-pow_ui
+TESTS = $(check_PROGRAMS)
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
diff --git a/vendor/gmp-6.3.0/tests/mpf/Makefile.in b/vendor/gmp-6.3.0/tests/mpf/Makefile.in
new file mode 100644
index 0000000..de2aeab
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/Makefile.in
@@ -0,0 +1,1452 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 1996, 1999-2004, 2015 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+check_PROGRAMS = t-dm2exp$(EXEEXT) t-conv$(EXEEXT) t-add$(EXEEXT) \
+ t-sub$(EXEEXT) t-sqrt$(EXEEXT) t-sqrt_ui$(EXEEXT) \
+ t-muldiv$(EXEEXT) reuse$(EXEEXT) t-cmp_d$(EXEEXT) \
+ t-cmp_si$(EXEEXT) t-div$(EXEEXT) t-fits$(EXEEXT) \
+ t-get_d$(EXEEXT) t-get_d_2exp$(EXEEXT) t-get_si$(EXEEXT) \
+ t-get_ui$(EXEEXT) t-gsprec$(EXEEXT) t-inp_str$(EXEEXT) \
+ t-int_p$(EXEEXT) t-mul_ui$(EXEEXT) t-set$(EXEEXT) \
+ t-set_q$(EXEEXT) t-set_si$(EXEEXT) t-set_ui$(EXEEXT) \
+ t-trunc$(EXEEXT) t-ui_div$(EXEEXT) t-eq$(EXEEXT) \
+ t-pow_ui$(EXEEXT)
+subdir = tests/mpf
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+reuse_SOURCES = reuse.c
+reuse_OBJECTS = reuse.$(OBJEXT)
+reuse_LDADD = $(LDADD)
+reuse_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+t_add_SOURCES = t-add.c
+t_add_OBJECTS = t-add.$(OBJEXT)
+t_add_LDADD = $(LDADD)
+t_add_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_cmp_d_SOURCES = t-cmp_d.c
+t_cmp_d_OBJECTS = t-cmp_d.$(OBJEXT)
+t_cmp_d_LDADD = $(LDADD)
+t_cmp_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_cmp_si_SOURCES = t-cmp_si.c
+t_cmp_si_OBJECTS = t-cmp_si.$(OBJEXT)
+t_cmp_si_LDADD = $(LDADD)
+t_cmp_si_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_conv_SOURCES = t-conv.c
+t_conv_OBJECTS = t-conv.$(OBJEXT)
+t_conv_LDADD = $(LDADD)
+t_conv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_div_SOURCES = t-div.c
+t_div_OBJECTS = t-div.$(OBJEXT)
+t_div_LDADD = $(LDADD)
+t_div_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_dm2exp_SOURCES = t-dm2exp.c
+t_dm2exp_OBJECTS = t-dm2exp.$(OBJEXT)
+t_dm2exp_LDADD = $(LDADD)
+t_dm2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_eq_SOURCES = t-eq.c
+t_eq_OBJECTS = t-eq.$(OBJEXT)
+t_eq_LDADD = $(LDADD)
+t_eq_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_fits_SOURCES = t-fits.c
+t_fits_OBJECTS = t-fits.$(OBJEXT)
+t_fits_LDADD = $(LDADD)
+t_fits_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_get_d_SOURCES = t-get_d.c
+t_get_d_OBJECTS = t-get_d.$(OBJEXT)
+t_get_d_LDADD = $(LDADD)
+t_get_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_get_d_2exp_SOURCES = t-get_d_2exp.c
+t_get_d_2exp_OBJECTS = t-get_d_2exp.$(OBJEXT)
+t_get_d_2exp_LDADD = $(LDADD)
+t_get_d_2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_get_si_SOURCES = t-get_si.c
+t_get_si_OBJECTS = t-get_si.$(OBJEXT)
+t_get_si_LDADD = $(LDADD)
+t_get_si_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_get_ui_SOURCES = t-get_ui.c
+t_get_ui_OBJECTS = t-get_ui.$(OBJEXT)
+t_get_ui_LDADD = $(LDADD)
+t_get_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_gsprec_SOURCES = t-gsprec.c
+t_gsprec_OBJECTS = t-gsprec.$(OBJEXT)
+t_gsprec_LDADD = $(LDADD)
+t_gsprec_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_inp_str_SOURCES = t-inp_str.c
+t_inp_str_OBJECTS = t-inp_str.$(OBJEXT)
+t_inp_str_LDADD = $(LDADD)
+t_inp_str_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_int_p_SOURCES = t-int_p.c
+t_int_p_OBJECTS = t-int_p.$(OBJEXT)
+t_int_p_LDADD = $(LDADD)
+t_int_p_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_mul_ui_SOURCES = t-mul_ui.c
+t_mul_ui_OBJECTS = t-mul_ui.$(OBJEXT)
+t_mul_ui_LDADD = $(LDADD)
+t_mul_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_muldiv_SOURCES = t-muldiv.c
+t_muldiv_OBJECTS = t-muldiv.$(OBJEXT)
+t_muldiv_LDADD = $(LDADD)
+t_muldiv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_pow_ui_SOURCES = t-pow_ui.c
+t_pow_ui_OBJECTS = t-pow_ui.$(OBJEXT)
+t_pow_ui_LDADD = $(LDADD)
+t_pow_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_set_SOURCES = t-set.c
+t_set_OBJECTS = t-set.$(OBJEXT)
+t_set_LDADD = $(LDADD)
+t_set_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_set_q_SOURCES = t-set_q.c
+t_set_q_OBJECTS = t-set_q.$(OBJEXT)
+t_set_q_LDADD = $(LDADD)
+t_set_q_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_set_si_SOURCES = t-set_si.c
+t_set_si_OBJECTS = t-set_si.$(OBJEXT)
+t_set_si_LDADD = $(LDADD)
+t_set_si_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_set_ui_SOURCES = t-set_ui.c
+t_set_ui_OBJECTS = t-set_ui.$(OBJEXT)
+t_set_ui_LDADD = $(LDADD)
+t_set_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_sqrt_SOURCES = t-sqrt.c
+t_sqrt_OBJECTS = t-sqrt.$(OBJEXT)
+t_sqrt_LDADD = $(LDADD)
+t_sqrt_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_sqrt_ui_SOURCES = t-sqrt_ui.c
+t_sqrt_ui_OBJECTS = t-sqrt_ui.$(OBJEXT)
+t_sqrt_ui_LDADD = $(LDADD)
+t_sqrt_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_sub_SOURCES = t-sub.c
+t_sub_OBJECTS = t-sub.$(OBJEXT)
+t_sub_LDADD = $(LDADD)
+t_sub_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_trunc_SOURCES = t-trunc.c
+t_trunc_OBJECTS = t-trunc.$(OBJEXT)
+t_trunc_LDADD = $(LDADD)
+t_trunc_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_ui_div_SOURCES = t-ui_div.c
+t_ui_div_OBJECTS = t-ui_div.$(OBJEXT)
+t_ui_div_LDADD = $(LDADD)
+t_ui_div_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = reuse.c t-add.c t-cmp_d.c t-cmp_si.c t-conv.c t-div.c \
+ t-dm2exp.c t-eq.c t-fits.c t-get_d.c t-get_d_2exp.c t-get_si.c \
+ t-get_ui.c t-gsprec.c t-inp_str.c t-int_p.c t-mul_ui.c \
+ t-muldiv.c t-pow_ui.c t-set.c t-set_q.c t-set_si.c t-set_ui.c \
+ t-sqrt.c t-sqrt_ui.c t-sub.c t-trunc.c t-ui_div.c
+DIST_SOURCES = reuse.c t-add.c t-cmp_d.c t-cmp_si.c t-conv.c t-div.c \
+ t-dm2exp.c t-eq.c t-fits.c t-get_d.c t-get_d_2exp.c t-get_si.c \
+ t-get_ui.c t-gsprec.c t-inp_str.c t-int_p.c t-mul_ui.c \
+ t-muldiv.c t-pow_ui.c t-set.c t-set_q.c t-set_si.c t-set_ui.c \
+ t-sqrt.c t-sqrt_ui.c t-sub.c t-trunc.c t-ui_div.c
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = { \
+ $(am__tty_colors_dummy); \
+ if test "X$(AM_COLOR_TESTS)" = Xno; then \
+ am__color_tests=no; \
+ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+ am__color_tests=yes; \
+ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+ am__color_tests=yes; \
+ fi; \
+ if test $$am__color_tests = yes; then \
+ red=''; \
+ grn=''; \
+ lgn=''; \
+ blu=''; \
+ mgn=''; \
+ brg=''; \
+ std=''; \
+ fi; \
+}
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__recheck_rx = ^[ ]*:recheck:[ ]*
+am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
+am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+ recheck = 1; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ { \
+ if ((getline line2 < ($$0 ".log")) < 0) \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+ { \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+ { \
+ break; \
+ } \
+ }; \
+ if (recheck) \
+ print $$0; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+ print "fatal: making $@: " msg | "cat >&2"; \
+ exit 1; \
+} \
+function rst_section(header) \
+{ \
+ print header; \
+ len = length(header); \
+ for (i = 1; i <= len; i = i + 1) \
+ printf "="; \
+ printf "\n\n"; \
+} \
+{ \
+ copy_in_global_log = 1; \
+ global_test_result = "RUN"; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".trs"); \
+ if (line ~ /$(am__global_test_result_rx)/) \
+ { \
+ sub("$(am__global_test_result_rx)", "", line); \
+ sub("[ ]*$$", "", line); \
+ global_test_result = line; \
+ } \
+ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+ copy_in_global_log = 0; \
+ }; \
+ if (copy_in_global_log) \
+ { \
+ rst_section(global_test_result ": " $$0); \
+ while ((rc = (getline line < ($$0 ".log"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".log"); \
+ print line; \
+ }; \
+ printf "\n"; \
+ }; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+ --color-tests "$$am__color_tests" \
+ --enable-hard-errors "$$am__enable_hard_errors" \
+ --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test. Creates the
+# directory for the log if needed. Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log. Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT. Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup); \
+$(am__vpath_adj_setup) $(am__vpath_adj) \
+$(am__tty_colors); \
+srcdir=$(srcdir); export srcdir; \
+case "$@" in \
+ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \
+ *) am__odir=.;; \
+esac; \
+test "x$$am__odir" = x"." || test -d "$$am__odir" \
+ || $(MKDIR_P) "$$am__odir" || exit $$?; \
+if test -f "./$$f"; then dir=./; \
+elif test -f "$$f"; then dir=; \
+else dir="$(srcdir)/"; fi; \
+tst=$$dir$$f; log='$@'; \
+if test -n '$(DISABLE_HARD_ERRORS)'; then \
+ am__enable_hard_errors=no; \
+else \
+ am__enable_hard_errors=yes; \
+fi; \
+case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
+ am__expect_failure=yes;; \
+ *) \
+ am__expect_failure=no;; \
+esac; \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed). The result is saved in the shell variable
+# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+ bases='$(TEST_LOGS)'; \
+ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+ bases=`echo $$bases`
+RECHECK_LOGS = $(TEST_LOGS)
+AM_RECURSIVE_TARGETS = check recheck
+TEST_SUITE_LOG = test-suite.log
+TEST_EXTENSIONS = @EXEEXT@ .test
+LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
+am__set_b = \
+ case '$@' in \
+ */*) \
+ case '$*' in \
+ */*) b='$*';; \
+ *) b=`echo '$@' | sed 's/\.log$$//'`; \
+ esac;; \
+ *) \
+ b='$*';; \
+ esac
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+ $(TEST_LOG_FLAGS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/test-driver
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ABI = @ABI@
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+ASMFLAGS = @ASMFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
+CC = @CC@
+CCAS = @CCAS@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPP_FOR_BUILD = @CPP_FOR_BUILD@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
+DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
+FGREP = @FGREP@
+GMP_LDFLAGS = @GMP_LDFLAGS@
+GMP_LIMB_BITS = @GMP_LIMB_BITS@
+GMP_NAIL_BITS = @GMP_NAIL_BITS@
+GREP = @GREP@
+HAVE_CLOCK_01 = @HAVE_CLOCK_01@
+HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@
+HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@
+HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@
+HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@
+HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@
+HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@
+HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
+HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
+HAVE_STACK_T_01 = @HAVE_STACK_T_01@
+HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBCURSES = @LIBCURSES@
+LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@
+LIBGMP_DLL = @LIBGMP_DLL@
+LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@
+LIBM = @LIBM@
+LIBM_FOR_BUILD = @LIBM_FOR_BUILD@
+LIBOBJS = @LIBOBJS@
+LIBREADLINE = @LIBREADLINE@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+M4 = @M4@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
+STRIP = @STRIP@
+TAL_OBJECT = @TAL_OBJECT@
+TUNE_LIBS = @TUNE_LIBS@
+TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U_FOR_BUILD = @U_FOR_BUILD@
+VERSION = @VERSION@
+WITH_READLINE_01 = @WITH_READLINE_01@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gmp_srclinks = @gmp_srclinks@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mpn_objects = @mpn_objects@
+mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
+AM_LDFLAGS = -no-install
+LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
+TESTS = $(check_PROGRAMS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/mpf/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/mpf/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+reuse$(EXEEXT): $(reuse_OBJECTS) $(reuse_DEPENDENCIES) $(EXTRA_reuse_DEPENDENCIES)
+ @rm -f reuse$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(reuse_OBJECTS) $(reuse_LDADD) $(LIBS)
+
+t-add$(EXEEXT): $(t_add_OBJECTS) $(t_add_DEPENDENCIES) $(EXTRA_t_add_DEPENDENCIES)
+ @rm -f t-add$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_add_OBJECTS) $(t_add_LDADD) $(LIBS)
+
+t-cmp_d$(EXEEXT): $(t_cmp_d_OBJECTS) $(t_cmp_d_DEPENDENCIES) $(EXTRA_t_cmp_d_DEPENDENCIES)
+ @rm -f t-cmp_d$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_cmp_d_OBJECTS) $(t_cmp_d_LDADD) $(LIBS)
+
+t-cmp_si$(EXEEXT): $(t_cmp_si_OBJECTS) $(t_cmp_si_DEPENDENCIES) $(EXTRA_t_cmp_si_DEPENDENCIES)
+ @rm -f t-cmp_si$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_cmp_si_OBJECTS) $(t_cmp_si_LDADD) $(LIBS)
+
+t-conv$(EXEEXT): $(t_conv_OBJECTS) $(t_conv_DEPENDENCIES) $(EXTRA_t_conv_DEPENDENCIES)
+ @rm -f t-conv$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_conv_OBJECTS) $(t_conv_LDADD) $(LIBS)
+
+t-div$(EXEEXT): $(t_div_OBJECTS) $(t_div_DEPENDENCIES) $(EXTRA_t_div_DEPENDENCIES)
+ @rm -f t-div$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_div_OBJECTS) $(t_div_LDADD) $(LIBS)
+
+t-dm2exp$(EXEEXT): $(t_dm2exp_OBJECTS) $(t_dm2exp_DEPENDENCIES) $(EXTRA_t_dm2exp_DEPENDENCIES)
+ @rm -f t-dm2exp$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_dm2exp_OBJECTS) $(t_dm2exp_LDADD) $(LIBS)
+
+t-eq$(EXEEXT): $(t_eq_OBJECTS) $(t_eq_DEPENDENCIES) $(EXTRA_t_eq_DEPENDENCIES)
+ @rm -f t-eq$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_eq_OBJECTS) $(t_eq_LDADD) $(LIBS)
+
+t-fits$(EXEEXT): $(t_fits_OBJECTS) $(t_fits_DEPENDENCIES) $(EXTRA_t_fits_DEPENDENCIES)
+ @rm -f t-fits$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_fits_OBJECTS) $(t_fits_LDADD) $(LIBS)
+
+t-get_d$(EXEEXT): $(t_get_d_OBJECTS) $(t_get_d_DEPENDENCIES) $(EXTRA_t_get_d_DEPENDENCIES)
+ @rm -f t-get_d$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_get_d_OBJECTS) $(t_get_d_LDADD) $(LIBS)
+
+t-get_d_2exp$(EXEEXT): $(t_get_d_2exp_OBJECTS) $(t_get_d_2exp_DEPENDENCIES) $(EXTRA_t_get_d_2exp_DEPENDENCIES)
+ @rm -f t-get_d_2exp$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_get_d_2exp_OBJECTS) $(t_get_d_2exp_LDADD) $(LIBS)
+
+t-get_si$(EXEEXT): $(t_get_si_OBJECTS) $(t_get_si_DEPENDENCIES) $(EXTRA_t_get_si_DEPENDENCIES)
+ @rm -f t-get_si$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_get_si_OBJECTS) $(t_get_si_LDADD) $(LIBS)
+
+t-get_ui$(EXEEXT): $(t_get_ui_OBJECTS) $(t_get_ui_DEPENDENCIES) $(EXTRA_t_get_ui_DEPENDENCIES)
+ @rm -f t-get_ui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_get_ui_OBJECTS) $(t_get_ui_LDADD) $(LIBS)
+
+t-gsprec$(EXEEXT): $(t_gsprec_OBJECTS) $(t_gsprec_DEPENDENCIES) $(EXTRA_t_gsprec_DEPENDENCIES)
+ @rm -f t-gsprec$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_gsprec_OBJECTS) $(t_gsprec_LDADD) $(LIBS)
+
+t-inp_str$(EXEEXT): $(t_inp_str_OBJECTS) $(t_inp_str_DEPENDENCIES) $(EXTRA_t_inp_str_DEPENDENCIES)
+ @rm -f t-inp_str$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_inp_str_OBJECTS) $(t_inp_str_LDADD) $(LIBS)
+
+t-int_p$(EXEEXT): $(t_int_p_OBJECTS) $(t_int_p_DEPENDENCIES) $(EXTRA_t_int_p_DEPENDENCIES)
+ @rm -f t-int_p$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_int_p_OBJECTS) $(t_int_p_LDADD) $(LIBS)
+
+t-mul_ui$(EXEEXT): $(t_mul_ui_OBJECTS) $(t_mul_ui_DEPENDENCIES) $(EXTRA_t_mul_ui_DEPENDENCIES)
+ @rm -f t-mul_ui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_mul_ui_OBJECTS) $(t_mul_ui_LDADD) $(LIBS)
+
+t-muldiv$(EXEEXT): $(t_muldiv_OBJECTS) $(t_muldiv_DEPENDENCIES) $(EXTRA_t_muldiv_DEPENDENCIES)
+ @rm -f t-muldiv$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_muldiv_OBJECTS) $(t_muldiv_LDADD) $(LIBS)
+
+t-pow_ui$(EXEEXT): $(t_pow_ui_OBJECTS) $(t_pow_ui_DEPENDENCIES) $(EXTRA_t_pow_ui_DEPENDENCIES)
+ @rm -f t-pow_ui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_pow_ui_OBJECTS) $(t_pow_ui_LDADD) $(LIBS)
+
+t-set$(EXEEXT): $(t_set_OBJECTS) $(t_set_DEPENDENCIES) $(EXTRA_t_set_DEPENDENCIES)
+ @rm -f t-set$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_set_OBJECTS) $(t_set_LDADD) $(LIBS)
+
+t-set_q$(EXEEXT): $(t_set_q_OBJECTS) $(t_set_q_DEPENDENCIES) $(EXTRA_t_set_q_DEPENDENCIES)
+ @rm -f t-set_q$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_set_q_OBJECTS) $(t_set_q_LDADD) $(LIBS)
+
+t-set_si$(EXEEXT): $(t_set_si_OBJECTS) $(t_set_si_DEPENDENCIES) $(EXTRA_t_set_si_DEPENDENCIES)
+ @rm -f t-set_si$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_set_si_OBJECTS) $(t_set_si_LDADD) $(LIBS)
+
+t-set_ui$(EXEEXT): $(t_set_ui_OBJECTS) $(t_set_ui_DEPENDENCIES) $(EXTRA_t_set_ui_DEPENDENCIES)
+ @rm -f t-set_ui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_set_ui_OBJECTS) $(t_set_ui_LDADD) $(LIBS)
+
+t-sqrt$(EXEEXT): $(t_sqrt_OBJECTS) $(t_sqrt_DEPENDENCIES) $(EXTRA_t_sqrt_DEPENDENCIES)
+ @rm -f t-sqrt$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_sqrt_OBJECTS) $(t_sqrt_LDADD) $(LIBS)
+
+t-sqrt_ui$(EXEEXT): $(t_sqrt_ui_OBJECTS) $(t_sqrt_ui_DEPENDENCIES) $(EXTRA_t_sqrt_ui_DEPENDENCIES)
+ @rm -f t-sqrt_ui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_sqrt_ui_OBJECTS) $(t_sqrt_ui_LDADD) $(LIBS)
+
+t-sub$(EXEEXT): $(t_sub_OBJECTS) $(t_sub_DEPENDENCIES) $(EXTRA_t_sub_DEPENDENCIES)
+ @rm -f t-sub$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_sub_OBJECTS) $(t_sub_LDADD) $(LIBS)
+
+t-trunc$(EXEEXT): $(t_trunc_OBJECTS) $(t_trunc_DEPENDENCIES) $(EXTRA_t_trunc_DEPENDENCIES)
+ @rm -f t-trunc$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_trunc_OBJECTS) $(t_trunc_LDADD) $(LIBS)
+
+t-ui_div$(EXEEXT): $(t_ui_div_OBJECTS) $(t_ui_div_DEPENDENCIES) $(EXTRA_t_ui_div_DEPENDENCIES)
+ @rm -f t-ui_div$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_ui_div_OBJECTS) $(t_ui_div_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+.c.o:
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+ $(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+ rm -f $< $@
+ $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+ @:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+ @$(am__set_TESTS_bases); \
+ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+ redo_bases=`for i in $$bases; do \
+ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+ done`; \
+ if test -n "$$redo_bases"; then \
+ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+ if $(am__make_dryrun); then :; else \
+ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+ fi; \
+ fi; \
+ if test -n "$$am__remaking_logs"; then \
+ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+ "recursion detected" >&2; \
+ elif test -n "$$redo_logs"; then \
+ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+ fi; \
+ if $(am__make_dryrun); then :; else \
+ st=0; \
+ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+ for i in $$redo_bases; do \
+ test -f $$i.trs && test -r $$i.trs \
+ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+ test -f $$i.log && test -r $$i.log \
+ || { echo "$$errmsg $$i.log" >&2; st=1; }; \
+ done; \
+ test $$st -eq 0 || exit 1; \
+ fi
+ @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+ ws='[ ]'; \
+ results=`for b in $$bases; do echo $$b.trs; done`; \
+ test -n "$$results" || results=/dev/null; \
+ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
+ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \
+ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \
+ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \
+ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+ if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+ success=true; \
+ else \
+ success=false; \
+ fi; \
+ br='==================='; br=$$br$$br$$br$$br; \
+ result_count () \
+ { \
+ if test x"$$1" = x"--maybe-color"; then \
+ maybe_colorize=yes; \
+ elif test x"$$1" = x"--no-color"; then \
+ maybe_colorize=no; \
+ else \
+ echo "$@: invalid 'result_count' usage" >&2; exit 4; \
+ fi; \
+ shift; \
+ desc=$$1 count=$$2; \
+ if test $$maybe_colorize = yes && test $$count -gt 0; then \
+ color_start=$$3 color_end=$$std; \
+ else \
+ color_start= color_end=; \
+ fi; \
+ echo "$${color_start}# $$desc $$count$${color_end}"; \
+ }; \
+ create_testsuite_report () \
+ { \
+ result_count $$1 "TOTAL:" $$all "$$brg"; \
+ result_count $$1 "PASS: " $$pass "$$grn"; \
+ result_count $$1 "SKIP: " $$skip "$$blu"; \
+ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+ result_count $$1 "FAIL: " $$fail "$$red"; \
+ result_count $$1 "XPASS:" $$xpass "$$red"; \
+ result_count $$1 "ERROR:" $$error "$$mgn"; \
+ }; \
+ { \
+ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
+ $(am__rst_title); \
+ create_testsuite_report --no-color; \
+ echo; \
+ echo ".. contents:: :depth: 2"; \
+ echo; \
+ for b in $$bases; do echo $$b; done \
+ | $(am__create_global_log); \
+ } >$(TEST_SUITE_LOG).tmp || exit 1; \
+ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
+ if $$success; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
+ fi; \
+ echo "$${col}$$br$${std}"; \
+ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \
+ echo "$${col}$$br$${std}"; \
+ create_testsuite_report --maybe-color; \
+ echo "$$col$$br$$std"; \
+ if $$success; then :; else \
+ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \
+ if test -n "$(PACKAGE_BUGREPORT)"; then \
+ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+ fi; \
+ echo "$$col$$br$$std"; \
+ fi; \
+ $$success || exit 1
+
+check-TESTS:
+ @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
+ @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+ exit $$?;
+recheck: all $(check_PROGRAMS)
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ bases=`for i in $$bases; do echo $$i; done \
+ | $(am__list_recheck_tests)` || exit 1; \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ log_list=`echo $$log_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+ am__force_recheck=am--force-recheck \
+ TEST_LOGS="$$log_list"; \
+ exit $$?
+t-dm2exp.log: t-dm2exp$(EXEEXT)
+ @p='t-dm2exp$(EXEEXT)'; \
+ b='t-dm2exp'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-conv.log: t-conv$(EXEEXT)
+ @p='t-conv$(EXEEXT)'; \
+ b='t-conv'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-add.log: t-add$(EXEEXT)
+ @p='t-add$(EXEEXT)'; \
+ b='t-add'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-sub.log: t-sub$(EXEEXT)
+ @p='t-sub$(EXEEXT)'; \
+ b='t-sub'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-sqrt.log: t-sqrt$(EXEEXT)
+ @p='t-sqrt$(EXEEXT)'; \
+ b='t-sqrt'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-sqrt_ui.log: t-sqrt_ui$(EXEEXT)
+ @p='t-sqrt_ui$(EXEEXT)'; \
+ b='t-sqrt_ui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-muldiv.log: t-muldiv$(EXEEXT)
+ @p='t-muldiv$(EXEEXT)'; \
+ b='t-muldiv'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+reuse.log: reuse$(EXEEXT)
+ @p='reuse$(EXEEXT)'; \
+ b='reuse'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-cmp_d.log: t-cmp_d$(EXEEXT)
+ @p='t-cmp_d$(EXEEXT)'; \
+ b='t-cmp_d'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-cmp_si.log: t-cmp_si$(EXEEXT)
+ @p='t-cmp_si$(EXEEXT)'; \
+ b='t-cmp_si'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-div.log: t-div$(EXEEXT)
+ @p='t-div$(EXEEXT)'; \
+ b='t-div'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-fits.log: t-fits$(EXEEXT)
+ @p='t-fits$(EXEEXT)'; \
+ b='t-fits'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-get_d.log: t-get_d$(EXEEXT)
+ @p='t-get_d$(EXEEXT)'; \
+ b='t-get_d'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-get_d_2exp.log: t-get_d_2exp$(EXEEXT)
+ @p='t-get_d_2exp$(EXEEXT)'; \
+ b='t-get_d_2exp'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-get_si.log: t-get_si$(EXEEXT)
+ @p='t-get_si$(EXEEXT)'; \
+ b='t-get_si'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-get_ui.log: t-get_ui$(EXEEXT)
+ @p='t-get_ui$(EXEEXT)'; \
+ b='t-get_ui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-gsprec.log: t-gsprec$(EXEEXT)
+ @p='t-gsprec$(EXEEXT)'; \
+ b='t-gsprec'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-inp_str.log: t-inp_str$(EXEEXT)
+ @p='t-inp_str$(EXEEXT)'; \
+ b='t-inp_str'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-int_p.log: t-int_p$(EXEEXT)
+ @p='t-int_p$(EXEEXT)'; \
+ b='t-int_p'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-mul_ui.log: t-mul_ui$(EXEEXT)
+ @p='t-mul_ui$(EXEEXT)'; \
+ b='t-mul_ui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-set.log: t-set$(EXEEXT)
+ @p='t-set$(EXEEXT)'; \
+ b='t-set'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-set_q.log: t-set_q$(EXEEXT)
+ @p='t-set_q$(EXEEXT)'; \
+ b='t-set_q'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-set_si.log: t-set_si$(EXEEXT)
+ @p='t-set_si$(EXEEXT)'; \
+ b='t-set_si'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-set_ui.log: t-set_ui$(EXEEXT)
+ @p='t-set_ui$(EXEEXT)'; \
+ b='t-set_ui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-trunc.log: t-trunc$(EXEEXT)
+ @p='t-trunc$(EXEEXT)'; \
+ b='t-trunc'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-ui_div.log: t-ui_div$(EXEEXT)
+ @p='t-ui_div$(EXEEXT)'; \
+ b='t-ui_div'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-eq.log: t-eq$(EXEEXT)
+ @p='t-eq$(EXEEXT)'; \
+ b='t-eq'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-pow_ui.log: t-pow_ui$(EXEEXT)
+ @p='t-pow_ui$(EXEEXT)'; \
+ b='t-pow_ui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+.test.log:
+ @p='$<'; \
+ $(am__set_b); \
+ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+@am__EXEEXT_TRUE@.test$(EXEEXT).log:
+@am__EXEEXT_TRUE@ @p='$<'; \
+@am__EXEEXT_TRUE@ $(am__set_b); \
+@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
+@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+ -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+ -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+ -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
+ ctags ctags-am distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ recheck tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/vendor/gmp-6.3.0/tests/mpf/reuse.c b/vendor/gmp-6.3.0/tests/mpf/reuse.c
new file mode 100644
index 0000000..86db5b3
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/reuse.c
@@ -0,0 +1,218 @@
+/* Test that routines allow reusing a source variable as destination.
+
+Copyright 1996, 2000-2002, 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#if __GMP_LIBGMP_DLL
+
+/* FIXME: When linking to a DLL libgmp, mpf_add etc can't be used as
+ initializers for global variables because they're effectively global
+ variables (function pointers) themselves. Perhaps calling a test
+ function successively with mpf_add etc would be better. */
+
+int
+main (void)
+{
+ printf ("Test suppressed for windows DLL\n");
+ exit (0);
+}
+
+
+#else /* ! DLL_EXPORT */
+
+#ifndef SIZE
+#define SIZE 16
+#endif
+
+#ifndef EXPO
+#define EXPO 32
+#endif
+
+void dump_abort (const char *, mpf_t, mpf_t);
+
+typedef void (*dss_func) (mpf_ptr, mpf_srcptr, mpf_srcptr);
+
+dss_func dss_funcs[] =
+{
+ mpf_div, mpf_add, mpf_mul, mpf_sub,
+};
+
+const char *dss_func_names[] =
+{
+ "mpf_div", "mpf_add", "mpf_mul", "mpf_sub",
+};
+
+typedef void (*dsi_func) (mpf_ptr, mpf_srcptr, unsigned long int);
+
+dsi_func dsi_funcs[] =
+{
+ mpf_div_ui, mpf_add_ui, mpf_mul_ui, mpf_sub_ui,
+ mpf_mul_2exp, mpf_div_2exp, mpf_pow_ui
+};
+
+const char *dsi_func_names[] =
+{
+ "mpf_div_ui", "mpf_add_ui", "mpf_mul_ui", "mpf_sub_ui",
+ "mpf_mul_2exp", "mpf_div_2exp", "mpf_pow_ui"
+};
+
+typedef void (*dis_func) (mpf_ptr, unsigned long int, mpf_srcptr);
+
+dis_func dis_funcs[] =
+{
+ mpf_ui_div, mpf_ui_sub,
+};
+
+const char *dis_func_names[] =
+{
+ "mpf_ui_div", "mpf_ui_sub",
+};
+
+int
+main (int argc, char **argv)
+{
+ int i;
+ int pass, reps = 10000;
+ mpf_t in1, in2, out1;
+ unsigned long int in1i, in2i;
+ mpf_t res1, res2, res3;
+ mp_size_t bprec = 100;
+
+ tests_start ();
+
+ if (argc > 1)
+ {
+ reps = strtol (argv[1], 0, 0);
+ if (argc > 2)
+ bprec = strtol (argv[2], 0, 0);
+ }
+
+ mpf_set_default_prec (bprec);
+
+ mpf_init (in1);
+ mpf_init (in2);
+ mpf_init (out1);
+ mpf_init (res1);
+ mpf_init (res2);
+ mpf_init (res3);
+
+ for (pass = 1; pass <= reps; pass++)
+ {
+ mpf_random2 (in1, urandom () % SIZE - SIZE/2, urandom () % EXPO);
+ mpf_random2 (in2, urandom () % SIZE - SIZE/2, urandom () % EXPO);
+
+ for (i = 0; i < sizeof (dss_funcs) / sizeof (dss_func); i++)
+ {
+ /* Don't divide by 0. */
+ if (i == 0 && mpf_cmp_ui (in2, 0) == 0)
+ continue;
+
+ (dss_funcs[i]) (res1, in1, in2);
+
+ mpf_set (out1, in1);
+ (dss_funcs[i]) (out1, out1, in2);
+ mpf_set (res2, out1);
+
+ mpf_set (out1, in2);
+ (dss_funcs[i]) (out1, in1, out1);
+ mpf_set (res3, out1);
+
+ if (mpf_cmp (res1, res2) != 0)
+ dump_abort (dss_func_names[i], res1, res2);
+ if (mpf_cmp (res1, res3) != 0)
+ dump_abort (dss_func_names[i], res1, res3);
+ }
+
+ in2i = urandom ();
+ for (i = 0; i < sizeof (dsi_funcs) / sizeof (dsi_func); i++)
+ {
+ unsigned long this_in2i = in2i;
+
+ /* Don't divide by 0. */
+ if (i == 0 && this_in2i == 0) /* dsi_funcs[i] == mpf_div_ui */
+ continue;
+
+ /* Avoid overflow/underflow in the exponent. */
+ if (dsi_funcs[i] == mpf_mul_2exp || dsi_funcs[i] == mpf_div_2exp)
+ this_in2i %= 0x100000;
+ else if (dsi_funcs[i] == mpf_pow_ui)
+ this_in2i %= 0x1000;
+
+ (dsi_funcs[i]) (res1, in1, this_in2i);
+
+ mpf_set (out1, in1);
+ (dsi_funcs[i]) (out1, out1, this_in2i);
+ mpf_set (res2, out1);
+
+ if (mpf_cmp (res1, res2) != 0)
+ dump_abort (dsi_func_names[i], res1, res2);
+ }
+
+ in1i = urandom ();
+ for (i = 0; i < sizeof (dis_funcs) / sizeof (dis_func); i++)
+ {
+ /* Don't divide by 0. */
+ if (i == 0 /* dis_funcs[i] == mpf_ui_div */
+ && mpf_cmp_ui (in2, 0) == 0)
+ continue;
+
+ (dis_funcs[i]) (res1, in1i, in2);
+
+ mpf_set (out1, in2);
+ (dis_funcs[i]) (out1, in1i, out1);
+ mpf_set (res2, out1);
+
+ if (mpf_cmp (res1, res2) != 0)
+ dump_abort (dis_func_names[i], res1, res2);
+ }
+
+ }
+
+ mpf_clear (in1);
+ mpf_clear (in2);
+ mpf_clear (out1);
+ mpf_clear (res1);
+ mpf_clear (res2);
+ mpf_clear (res3);
+
+ tests_end ();
+ exit (0);
+}
+
+void
+dump_abort (const char *name, mpf_t res1, mpf_t res2)
+{
+ printf ("failure in %s:\n", name);
+ mpf_dump (res1);
+ mpf_dump (res2);
+ abort ();
+}
+
+#if 0
+void mpf_abs (mpf_ptr, mpf_srcptr);
+void mpf_sqrt (mpf_ptr, mpf_srcptr);
+void mpf_neg (mpf_ptr, mpf_srcptr);
+#endif
+
+#endif /* ! DLL_EXPORT */
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-add.c b/vendor/gmp-6.3.0/tests/mpf/t-add.c
new file mode 100644
index 0000000..eb8bbdc
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-add.c
@@ -0,0 +1,107 @@
+/* Test mpf_add.
+
+Copyright 1996, 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#ifndef SIZE
+#define SIZE 16
+#endif
+
+int
+main (int argc, char **argv)
+{
+ mp_size_t size;
+ mp_exp_t exp;
+ int reps = 20000;
+ int i;
+ mpf_t u, v, w, wref;
+ mp_size_t bprec = 100;
+ mpf_t rerr, max_rerr, limit_rerr;
+
+ tests_start ();
+
+ if (argc > 1)
+ {
+ reps = strtol (argv[1], 0, 0);
+ if (argc > 2)
+ bprec = strtol (argv[2], 0, 0);
+ }
+
+ mpf_set_default_prec (bprec);
+
+ mpf_init_set_ui (limit_rerr, 1);
+ mpf_div_2exp (limit_rerr, limit_rerr, bprec);
+#if VERBOSE
+ mpf_dump (limit_rerr);
+#endif
+ mpf_init (rerr);
+ mpf_init_set_ui (max_rerr, 0);
+
+ mpf_init (u);
+ mpf_init (v);
+ mpf_init (w);
+ mpf_init (wref);
+ for (i = 0; i < reps; i++)
+ {
+ size = urandom () % (2 * SIZE) - SIZE;
+ exp = urandom () % SIZE;
+ mpf_random2 (u, size, exp);
+
+ size = urandom () % (2 * SIZE) - SIZE;
+ exp = urandom () % SIZE;
+ mpf_random2 (v, size, exp);
+
+ mpf_add (w, u, v);
+ refmpf_add (wref, u, v);
+
+ mpf_reldiff (rerr, w, wref);
+ if (mpf_cmp (rerr, max_rerr) > 0)
+ {
+ mpf_set (max_rerr, rerr);
+#if VERBOSE
+ mpf_dump (max_rerr);
+#endif
+ if (mpf_cmp (rerr, limit_rerr) > 0)
+ {
+ printf ("ERROR after %d tests\n", i);
+ printf (" u = "); mpf_dump (u);
+ printf (" v = "); mpf_dump (v);
+ printf ("wref = "); mpf_dump (wref);
+ printf (" w = "); mpf_dump (w);
+ abort ();
+ }
+ }
+ }
+
+ mpf_clear (limit_rerr);
+ mpf_clear (rerr);
+ mpf_clear (max_rerr);
+
+ mpf_clear (u);
+ mpf_clear (v);
+ mpf_clear (w);
+ mpf_clear (wref);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-cmp_d.c b/vendor/gmp-6.3.0/tests/mpf/t-cmp_d.c
new file mode 100644
index 0000000..213c091
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-cmp_d.c
@@ -0,0 +1,103 @@
+/* Test mpf_cmp_d.
+
+Copyright 2001, 2003, 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+#define SGN(n) ((n) > 0 ? 1 : (n) < 0 ? -1 : 0)
+
+void
+check_one (const char *name, mpf_srcptr x, double y, int cmp)
+{
+ int got;
+
+ got = mpf_cmp_d (x, y);
+ if (SGN(got) != cmp)
+ {
+ int i;
+ printf ("mpf_cmp_d wrong (from %s)\n", name);
+ printf (" got %d\n", got);
+ printf (" want %d\n", cmp);
+ mpf_trace (" x", x);
+ printf (" y %g\n", y);
+ mp_trace_base=-16;
+ mpf_trace (" x", x);
+ printf (" y %g\n", y);
+ printf (" y");
+ for (i = 0; i < sizeof(y); i++)
+ printf (" %02X", (unsigned) ((unsigned char *) &y)[i]);
+ printf ("\n");
+ abort ();
+ }
+}
+
+void
+check_infinity (void)
+{
+ mpf_t x;
+ double y = tests_infinity_d ();
+ if (y == 0.0)
+ return;
+
+ mpf_init (x);
+
+ /* 0 cmp inf */
+ mpf_set_ui (x, 0L);
+ check_one ("check_infinity", x, y, -1);
+ check_one ("check_infinity", x, -y, 1);
+
+ /* 123 cmp inf */
+ mpf_set_ui (x, 123L);
+ check_one ("check_infinity", x, y, -1);
+ check_one ("check_infinity", x, -y, 1);
+
+ /* -123 cmp inf */
+ mpf_set_si (x, -123L);
+ check_one ("check_infinity", x, y, -1);
+ check_one ("check_infinity", x, -y, 1);
+
+ /* 2^5000 cmp inf */
+ mpf_set_ui (x, 1L);
+ mpf_mul_2exp (x, x, 5000L);
+ check_one ("check_infinity", x, y, -1);
+ check_one ("check_infinity", x, -y, 1);
+
+ /* -2^5000 cmp inf */
+ mpf_neg (x, x);
+ check_one ("check_infinity", x, y, -1);
+ check_one ("check_infinity", x, -y, 1);
+
+ mpf_clear (x);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+
+ check_infinity ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-cmp_si.c b/vendor/gmp-6.3.0/tests/mpf/t-cmp_si.c
new file mode 100644
index 0000000..29f7cdb
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-cmp_si.c
@@ -0,0 +1,134 @@
+/* Test mpf_cmp_si and mpf_cmp_z.
+
+Copyright 2000, 2001, 2004, 2015 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+#define SGN(x) ((x) < 0 ? -1 : (x) == 0 ? 0 : 1)
+
+void
+check_data (void)
+{
+ static const struct {
+ int a_base;
+ const char *a;
+ const char *b;
+ int want;
+ } data[] = {
+ { 10, "0", "1", -1 },
+ { 10, "0", "0", 0 },
+ { 10, "0", "-1", 1 },
+
+ { 10, "1", "1", 0 },
+ { 10, "1", "0", 1 },
+ { 10, "1", "-1", 1 },
+
+ { 10, "-1", "1", -1 },
+ { 10, "-1", "0", -1 },
+ { 10, "-1", "-1", 0 },
+
+ { 10, "1.5", "2", -1 },
+ { 10, "1.5", "1", 1 },
+ { 10, "0.5", "1", -1 },
+
+ { 10, "-1.5", "-2", 1 },
+ { 10, "-1.5", "-1", -1 },
+ { 10, "-0.5", "-1", 1 },
+
+ { 16, "0", "-0x80000000", 1 },
+ { 16, "80000000", "-0x80000000", 1 },
+ { 16, "80000001", "-0x80000000", 1 },
+ { 16, "-80000000", "-0x80000000", 0 },
+ { 16, "-80000001", "-0x80000000", -1 },
+ { 16, "-FF0080000001", "-0x80000000", -1 },
+
+ { 16, "0", "-0x8000000000000000", 1 },
+ { 16, "8000000000000000", "-0x8000000000000000", 1 },
+ { 16, "8000000000000001", "-0x8000000000000000", 1 },
+ { 16, "-8000000000000000", "-0x8000000000000000", 0 },
+ { 16, "-8000000000000000.1", "-0x8000000000000000", -1 },
+ { 16, "-FF008000000000000001", "-0x8000000000000000", -1 },
+
+ { 16, "0", "-0x876543210FEDCBA9876543210000000", 1 },
+ { 16, "876543210FEDCBA9876543210000000", "-0x876543210FEDCBA9876543210000000", 1 },
+ { 16, "876543210FEDCBA9876543210000001", "-0x876543210FEDCBA9876543210000000", 1 },
+ { 16, "-876543210FEDCBA9876543210000000", "-0x876543210FEDCBA9876543210000000", 0 },
+ { 16, "-876543210FEDCBA9876543210000000.1", "-0x876543210FEDCBA9876543210000000", -1 },
+ { 16, "-FF00876543210FEDCBA9876543210000000", "-0x876543210FEDCBA9876543210000000", -1 },
+ };
+
+ mpf_t a;
+ mpz_t bz;
+ long b;
+ int got;
+ int i;
+
+ mpf_init2 (a, 128);
+ mpz_init (bz);
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpf_set_str_or_abort (a, data[i].a, data[i].a_base);
+ mpz_set_str_or_abort (bz, data[i].b, 0);
+
+ if (mpz_fits_slong_p (bz))
+ {
+ b = mpz_get_si (bz);
+ got = mpf_cmp_si (a, b);
+ if (SGN (got) != data[i].want)
+ {
+ printf ("mpf_cmp_si wrong on data[%d]\n", i);
+ printf (" a="); mpf_out_str (stdout, 10, 0, a);
+ printf (" (%s)\n", data[i].a);
+ printf (" b=%ld (%s)\n", b, data[i].b);
+ printf (" got=%d\n", got);
+ printf (" want=%d\n", data[i].want);
+ abort();
+ }
+ }
+
+ got = mpf_cmp_z (a, bz);
+ if (SGN (got) != data[i].want)
+ {
+ b = mpz_get_si (bz);
+ printf ("mpf_cmp_z wrong on data[%d]\n", i);
+ printf (" a="); mpf_out_str (stdout, 10, 0, a);
+ printf (" (%s)\n", data[i].a);
+ printf (" b=%ld (%s)\n", b, data[i].b);
+ printf (" got=%d\n", got);
+ printf (" want=%d\n", data[i].want);
+ abort();
+ }
+ }
+
+ mpf_clear (a);
+ mpz_clear (bz);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_data ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-conv.c b/vendor/gmp-6.3.0/tests/mpf/t-conv.c
new file mode 100644
index 0000000..2f992af
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-conv.c
@@ -0,0 +1,261 @@
+/* Test mpf_get_str and mpf_set_str.
+
+Copyright 1996, 2000, 2001, 2008, 2019, 2020 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h> /* for strlen */
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#ifndef SIZE
+#define SIZE 10
+#endif
+
+#ifndef EXPO
+#define EXPO 200
+#endif
+
+int
+main (int argc, char **argv)
+{
+ mpf_t x, y;
+ int reps = 20000;
+ int i;
+ mp_size_t bprec = 100;
+ mpf_t d, rerr, max_rerr, limit_rerr;
+ char *str;
+ mp_exp_t bexp;
+ long size, exp;
+ int base;
+ char buf[SIZE * GMP_LIMB_BITS + 5];
+
+ tests_start ();
+
+ if (argc > 1)
+ {
+ reps = strtol (argv[1], 0, 0);
+ if (argc > 2)
+ bprec = strtol (argv[2], 0, 0);
+ }
+
+ mpf_set_default_prec (bprec);
+
+ mpf_init_set_ui (limit_rerr, 1);
+ mpf_div_2exp (limit_rerr, limit_rerr, bprec);
+#if VERBOSE
+ mpf_dump (limit_rerr);
+#endif
+ mpf_init (rerr);
+ mpf_init_set_ui (max_rerr, 0);
+
+ mpf_init (x);
+ mpf_init (y);
+ mpf_init (d);
+
+ /* First test some specific values. */
+
+ mpf_set_str (y, "1.23456", 0);
+ mpf_set_str (x, "1.23456", 10);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "00000000000000000000000000000000000000001.23456", 10);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "0.000000000000000000000000000000000000000123456e40", 10);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, ".000000000000000000000000000000000000000123456e40", 10);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "00000000000000000000.00000000000000000000123456e21", 10);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+
+ mpf_set_str (y, "1.23456e1000", 0);
+ mpf_set_str (x, "1.23456e1000", 10);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "1.23456e+1000", 0);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "1.23456e+1000", 10);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "00000000000000000000000000000000000000001.23456e+1000", 10);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "0.000000000000000000000000000000000000000123456e+1040", 10);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, ".000000000000000000000000000000000000000123456e+1040", 10);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "00000000000000000000.00000000000000000000123456e+1021", 10);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+
+ mpf_set_str (y, "1.23456", 16);
+ mpf_set_str (x, "00000000000000000000000000000000000000001.23456", 16);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "0.000000000000000000000000000000000000000123456@28", 16);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, ".000000000000000000000000000000000000000123456@28", 16);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "00000000000000000000.00000000000000000000123456@15", 16);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+
+ mpf_set_str (y, " 0", 10);
+ mpf_set_str (x, "00000000000000000000000000000000000000000000000000000", 10);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "0000000000000000000000000000000000000000000000000000.", 10);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "000000000000000000000000000000000000000000000000000.0", 10);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, ".0000000000000000000000000000000000000000000000000000", 10);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "0.000000000000000000000000000000000000000000000000000", 10);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+
+ mpf_set_str (x, "00000000000000000000000000000000000000000000000000000", 16);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "0000000000000000000000000000000000000000000000000000.", 16);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "000000000000000000000000000000000000000000000000000.0", 16);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, ".0000000000000000000000000000000000000000000000000000", 16);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "0.000000000000000000000000000000000000000000000000000", 16);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "+00000000000000000000000000000000000000000000000000000e-345", 9);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "-0000000000000000000000000000000000000000000000000000.@AB", 26);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "000000000000000000000000000000000000000000000000000.0@78", 19);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "+.0000000000000000000000000000000000000000000000000000e555", 6);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+ mpf_set_str (x, "-0.000000000000000000000000000000000000000000000000000@-AAAAAAAAAAAAAAAAAAAAAAAA", 17);
+ MPF_CHECK_FORMAT (x);
+ if (mpf_cmp (x, y) != 0)
+ abort ();
+
+ /* Now test random values. */
+
+ for (i = 0; i < reps; i++)
+ {
+ if (i == 0)
+ {
+ /* exercise the special case in get_str for for x==0 */
+ mpf_set_ui (x, 0L);
+ base = 0;
+ }
+ else
+ {
+ size = urandom () % (2 * SIZE) - SIZE;
+ exp = urandom () % EXPO;
+ mpf_random2 (x, size, exp);
+ base = urandom () % 62;
+ base += base > 0;
+ }
+
+ str = mpf_get_str (0, &bexp, base, 0, x);
+
+ if (str[0] == '-')
+ sprintf (buf, "-0.%s@%ld", str + 1, bexp);
+ else
+ sprintf (buf, "0.%s@%ld", str, bexp);
+
+ mpf_set_str_or_abort (y, buf, -base);
+ (*__gmp_free_func) (str, strlen (str) + 1);
+
+ mpf_reldiff (rerr, x, y);
+ if (mpf_cmp (rerr, max_rerr) > 0)
+ {
+ mpf_set (max_rerr, rerr);
+#if VERBOSE
+ mpf_dump (max_rerr);
+#endif
+ if (mpf_cmp (rerr, limit_rerr) > 0)
+ {
+ printf ("ERROR after %d tests\n", i);
+ printf ("base = %d\n", base);
+ printf (" x = "); mpf_dump (x);
+ printf (" y = "); mpf_dump (y);
+ abort ();
+ }
+ }
+ }
+
+ mpf_clear (limit_rerr);
+ mpf_clear (rerr);
+ mpf_clear (max_rerr);
+
+ mpf_clear (x);
+ mpf_clear (y);
+ mpf_clear (d);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-div.c b/vendor/gmp-6.3.0/tests/mpf/t-div.c
new file mode 100644
index 0000000..3214592
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-div.c
@@ -0,0 +1,185 @@
+/* Test mpf_div.
+
+Copyright 2004 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_one (const char *desc, mpf_ptr got, mpf_srcptr u, mpf_srcptr v)
+{
+ if (! refmpf_validate_division ("mpf_div", got, u, v))
+ {
+ mp_trace_base = -16;
+ mpf_trace (" u", u);
+ mpf_trace (" v", v);
+ printf (" %s\n", desc);
+ abort ();
+ }
+}
+
+void
+check_rand (void)
+{
+ unsigned long min_prec = __GMPF_BITS_TO_PREC (1);
+ gmp_randstate_ptr rands = RANDS;
+ unsigned long prec;
+ mpf_t got, u, v;
+ int i;
+
+ mpf_init (got);
+ mpf_init (u);
+ mpf_init (v);
+
+ /* separate */
+ for (i = 0; i < 100; i++)
+ {
+ /* got precision */
+ prec = min_prec + gmp_urandomm_ui (rands, 15L);
+ refmpf_set_prec_limbs (got, prec);
+
+ /* u */
+ prec = min_prec + gmp_urandomm_ui (rands, 15L);
+ refmpf_set_prec_limbs (u, prec);
+ do {
+ mpf_random2 (u, PREC(u), (mp_exp_t) 20);
+ } while (SIZ(u) == 0);
+ if (gmp_urandomb_ui (rands, 1L))
+ mpf_neg (u, u);
+
+ /* v */
+ prec = min_prec + gmp_urandomm_ui (rands, 15L);
+ refmpf_set_prec_limbs (v, prec);
+ do {
+ mpf_random2 (v, PREC(v), (mp_exp_t) 20);
+ } while (SIZ(v) == 0);
+ if (gmp_urandomb_ui (rands, 1L))
+ mpf_neg (v, v);
+
+ switch (i % 3) {
+ case 0:
+ mpf_div (got, u, v);
+ check_one ("separate", got, u, v);
+ break;
+ case 1:
+ prec = refmpf_set_overlap (got, u);
+ mpf_div (got, got, v);
+ check_one ("dst == u", got, u, v);
+ mpf_set_prec_raw (got, prec);
+ break;
+ case 2:
+ prec = refmpf_set_overlap (got, v);
+ mpf_div (got, u, got);
+ check_one ("dst == v", got, u, v);
+ mpf_set_prec_raw (got, prec);
+ break;
+ }
+ }
+
+ mpf_clear (got);
+ mpf_clear (u);
+ mpf_clear (v);
+}
+
+/* Exercise calls mpf(x,x,x) */
+void
+check_reuse_three (void)
+{
+ unsigned long min_prec = __GMPF_BITS_TO_PREC (1);
+ gmp_randstate_ptr rands = RANDS;
+ unsigned long result_prec, input_prec, set_prec;
+ mpf_t got;
+ int i;
+
+ mpf_init (got);
+
+ for (i = 0; i < 8; i++)
+ {
+ result_prec = min_prec + gmp_urandomm_ui (rands, 15L);
+ input_prec = min_prec + gmp_urandomm_ui (rands, 15L);
+
+ set_prec = MAX (result_prec, input_prec);
+ refmpf_set_prec_limbs (got, set_prec);
+
+ /* input, non-zero, possibly negative */
+ PREC(got) = input_prec;
+ do {
+ mpf_random2 (got, input_prec, (mp_exp_t) 20);
+ } while (SIZ(got) == 0);
+ if (gmp_urandomb_ui (rands, 1L))
+ mpf_neg (got, got);
+
+ PREC(got) = result_prec;
+
+ mpf_div (got, got, got);
+
+ /* expect exactly 1.0 always */
+ ASSERT_ALWAYS (mpf_cmp_ui (got, 1L) == 0);
+
+ PREC(got) = set_prec;
+ }
+
+ mpf_clear (got);
+}
+
+void
+check_various (void)
+{
+ mpf_t got, u, v;
+
+ mpf_init (got);
+ mpf_init (u);
+ mpf_init (v);
+
+ /* 100/4 == 25 */
+ mpf_set_prec (got, 20L);
+ mpf_set_ui (u, 100L);
+ mpf_set_ui (v, 4L);
+ mpf_div (got, u, v);
+ MPF_CHECK_FORMAT (got);
+ ASSERT_ALWAYS (mpf_cmp_ui (got, 25L) == 0);
+
+ /* 1/(2^n+1), a case where truncating the divisor would be wrong */
+ mpf_set_prec (got, 500L);
+ mpf_set_prec (v, 900L);
+ mpf_set_ui (v, 1L);
+ mpf_mul_2exp (v, v, 800L);
+ mpf_add_ui (v, v, 1L);
+ mpf_div (got, u, v);
+ check_one ("1/2^n+1, separate", got, u, v);
+
+ mpf_clear (got);
+ mpf_clear (u);
+ mpf_clear (v);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_various ();
+ check_rand ();
+ check_reuse_three ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-dm2exp.c b/vendor/gmp-6.3.0/tests/mpf/t-dm2exp.c
new file mode 100644
index 0000000..d17c9fa
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-dm2exp.c
@@ -0,0 +1,118 @@
+/* Test mpf_div, mpf_div_2exp, mpf_mul_2exp.
+
+Copyright 1996, 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#ifndef SIZE
+#define SIZE 16
+#endif
+
+int
+main (int argc, char **argv)
+{
+ int reps = 100000;
+ int i;
+ mpf_t u, v, w1, w2, w3;
+ mp_size_t bprec = 100;
+ mpf_t rerr, limit_rerr;
+ mp_size_t un;
+ mp_exp_t ue;
+
+ tests_start ();
+
+ if (argc > 1)
+ {
+ reps = strtol (argv[1], 0, 0);
+ if (argc > 2)
+ bprec = strtol (argv[2], 0, 0);
+ }
+
+ mpf_set_default_prec (bprec);
+
+ mpf_init (rerr);
+ mpf_init (limit_rerr);
+
+ mpf_init (u);
+ mpf_init (v);
+ mpf_init (w1);
+ mpf_init (w2);
+ mpf_init (w3);
+
+ for (i = 0; i < reps; i++)
+ {
+ unsigned long int res_prec;
+ unsigned long int pow2;
+
+ res_prec = urandom () % (bprec + 100);
+ mpf_set_prec (w1, res_prec);
+ mpf_set_prec (w2, res_prec);
+ mpf_set_prec (w3, res_prec);
+
+ mpf_set_ui (limit_rerr, 1);
+ mpf_div_2exp (limit_rerr, limit_rerr, res_prec);
+
+ pow2 = urandom () % 0x10000;
+ mpf_set_ui (v, 1);
+ mpf_mul_2exp (v, v, pow2);
+
+ un = urandom () % (2 * SIZE) - SIZE;
+ ue = urandom () % SIZE;
+ mpf_random2 (u, un, ue);
+
+ mpf_div_2exp (w1, u, pow2);
+ mpf_div (w2, u, v);
+ mpf_reldiff (rerr, w1, w2);
+ if (mpf_cmp (rerr, limit_rerr) > 0)
+ {
+ printf ("ERROR in mpf_div or mpf_div_2exp after %d tests\n", i);
+ printf (" u = "); mpf_dump (u);
+ printf (" v = "); mpf_dump (v);
+ printf (" w1 = "); mpf_dump (w1);
+ printf (" w2 = "); mpf_dump (w2);
+ abort ();
+ }
+ mpf_mul_2exp (w3, w1, pow2);
+ mpf_reldiff (rerr, u, w3);
+ if (mpf_cmp (rerr, limit_rerr) > 0)
+ {
+ printf ("ERROR in mpf_mul_2exp after %d tests\n", i);
+ printf (" u = "); mpf_dump (u);
+ printf (" v = "); mpf_dump (v);
+ printf (" w1 = "); mpf_dump (w1);
+ printf (" w3 = "); mpf_dump (w3);
+ abort ();
+ }
+ }
+
+ mpf_clear (rerr);
+ mpf_clear (limit_rerr);
+
+ mpf_clear (u);
+ mpf_clear (v);
+ mpf_clear (w1);
+ mpf_clear (w2);
+ mpf_clear (w3);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-eq.c b/vendor/gmp-6.3.0/tests/mpf/t-eq.c
new file mode 100644
index 0000000..7b80b02
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-eq.c
@@ -0,0 +1,217 @@
+/* Test mpf_eq.
+
+Copyright 2009, 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#define SZ (2 * sizeof(mp_limb_t))
+
+void insert_random_low_zero_limbs (mpf_t, gmp_randstate_ptr);
+void dump_abort (mpf_t, mpf_t, int, int, int, int, int, long);
+void hexdump (mpf_t);
+
+void
+check_data (void)
+{
+ static const struct
+ {
+ struct {
+ int exp, size;
+ mp_limb_t d[10];
+ } x, y;
+ mp_bitcnt_t bits;
+ int want;
+
+ } data[] = {
+ { { 0, 0, { 0 } }, { 0, 0, { 0 } }, 0, 1 },
+
+ { { 0, 1, { 7 } }, { 0, 1, { 7 } }, 0, 1 },
+ { { 0, 1, { 7 } }, { 0, 1, { 7 } }, 17, 1 },
+ { { 0, 1, { 7 } }, { 0, 1, { 7 } }, 4711, 1 },
+
+ { { 0, 1, { 7 } }, { 0, 1, { 6 } }, 0, 1 },
+ { { 0, 1, { 7 } }, { 0, 1, { 6 } }, 2, 1 },
+ { { 0, 1, { 7 } }, { 0, 1, { 6 } }, 3, 0 },
+
+ { { 0, 0, { 0 } }, { 0, 1, { 1 } }, 0, 0 },
+ { { 0, 1, { 1 } }, { 0,-1 ,{ 1 } }, 0, 0 },
+ { { 1, 1, { 1 } }, { 0, 1, { 1 } }, 0, 0 },
+
+ { { 0, 1, { 8 } }, { 0, 1, { 4 } }, 0, 0 },
+
+ { { 0, 2, { 0, 3 } }, { 0, 1, { 3 } }, 1000, 1 },
+ };
+
+ mpf_t x, y;
+ int got, got_swapped;
+ int i;
+ mp_trace_base = 16;
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ PTR(x) = (mp_ptr) data[i].x.d;
+ SIZ(x) = data[i].x.size;
+ EXP(x) = data[i].x.exp;
+ PREC(x) = numberof (data[i].x.d);
+ MPF_CHECK_FORMAT (x);
+
+ PTR(y) = (mp_ptr) data[i].y.d;
+ SIZ(y) = data[i].y.size;
+ EXP(y) = data[i].y.exp;
+ PREC(y) = numberof (data[i].y.d);
+ MPF_CHECK_FORMAT (y);
+
+ got = mpf_eq (x, y, data[i].bits);
+ got_swapped = mpf_eq (y, x, data[i].bits);
+
+ if (got != got_swapped || got != data[i].want)
+ {
+ printf ("check_data() wrong result at data[%d]\n", i);
+ mpf_trace ("x ", x);
+ mpf_trace ("y ", y);
+ printf ("got %d\n", got);
+ printf ("got_swapped %d\n", got_swapped);
+ printf ("want %d\n", data[i].want);
+ abort ();
+ }
+ }
+}
+
+void
+check_random (long reps)
+{
+ unsigned long test;
+ gmp_randstate_ptr rands = RANDS;
+ mpf_t a, b, x;
+ mpz_t ds;
+ int hibits, lshift1, lshift2;
+ int xtra;
+
+#define HIBITS 10
+#define LSHIFT1 10
+#define LSHIFT2 10
+
+ mpf_set_default_prec ((1 << HIBITS) + (1 << LSHIFT1) + (1 << LSHIFT2));
+
+ mpz_init (ds);
+ mpf_inits (a, b, x, NULL);
+
+ for (test = 0; test < reps; test++)
+ {
+ mpz_urandomb (ds, rands, HIBITS);
+ hibits = mpz_get_ui (ds) + 1;
+ mpz_urandomb (ds, rands, hibits);
+ mpz_setbit (ds, hibits - 1); /* make sure msb is set */
+ mpf_set_z (a, ds);
+ mpf_set_z (b, ds);
+
+ mpz_urandomb (ds, rands, LSHIFT1);
+ lshift1 = mpz_get_ui (ds);
+ mpf_mul_2exp (a, a, lshift1 + 1);
+ mpf_mul_2exp (b, b, lshift1 + 1);
+ mpf_add_ui (a, a, 1); /* make a one-bit difference */
+
+ mpz_urandomb (ds, rands, LSHIFT2);
+ lshift2 = mpz_get_ui (ds);
+ mpf_mul_2exp (a, a, lshift2);
+ mpf_mul_2exp (b, b, lshift2);
+ mpz_urandomb (ds, rands, lshift2);
+ mpf_set_z (x, ds);
+ mpf_add (a, a, x);
+ mpf_add (b, b, x);
+
+ insert_random_low_zero_limbs (a, rands);
+ insert_random_low_zero_limbs (b, rands);
+
+ if (mpf_eq (a, b, lshift1 + hibits) == 0 ||
+ mpf_eq (b, a, lshift1 + hibits) == 0)
+ {
+ dump_abort (a, b, lshift1 + hibits, lshift1, lshift2, hibits, 1, test);
+ }
+ for (xtra = 1; xtra < 100; xtra++)
+ if (mpf_eq (a, b, lshift1 + hibits + xtra) != 0 ||
+ mpf_eq (b, a, lshift1 + hibits + xtra) != 0)
+ {
+ dump_abort (a, b, lshift1 + hibits + xtra, lshift1, lshift2, hibits, 0, test);
+ }
+ }
+
+ mpf_clears (a, b, x, NULL);
+ mpz_clear (ds);
+}
+
+void
+insert_random_low_zero_limbs (mpf_t x, gmp_randstate_ptr rands)
+{
+ mp_size_t max = PREC(x) - SIZ(x);
+ mp_size_t s;
+ mpz_t ds; mpz_init (ds);
+ mpz_urandomb (ds, rands, 32);
+ s = mpz_get_ui (ds) % (max + 1);
+ MPN_COPY_DECR (PTR(x) + s, PTR(x), SIZ(x));
+ MPN_ZERO (PTR(x), s);
+ SIZ(x) += s;
+ mpz_clear (ds);
+}
+
+void
+dump_abort (mpf_t a, mpf_t b, int cmp_prec, int lshift1, int lshift2, int hibits, int want, long test)
+{
+ printf ("ERROR in test %ld\n", test);
+ printf ("want %d got %d from mpf_eq\n", want, 1-want);
+ printf ("cmp_prec = %d\n", cmp_prec);
+ printf ("lshift1 = %d\n", lshift1);
+ printf ("lshift2 = %d\n", lshift2);
+ printf ("hibits = %d\n", hibits);
+ hexdump (a); puts ("");
+ hexdump (b); puts ("");
+ abort ();
+}
+
+void
+hexdump (mpf_t x)
+{
+ mp_size_t i;
+ for (i = ABSIZ(x) - 1; i >= 0; i--)
+ {
+ gmp_printf ("%0*MX", SZ, PTR(x)[i]);
+ if (i != 0)
+ printf (" ");
+ }
+}
+
+int
+main (int argc, char *argv[])
+{
+ long reps = 10000;
+
+ if (argc == 2)
+ reps = strtol (argv[1], 0, 0);
+
+ tests_start ();
+
+ check_data ();
+ check_random (reps);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-fits.c b/vendor/gmp-6.3.0/tests/mpf/t-fits.c
new file mode 100644
index 0000000..937e4e6
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-fits.c
@@ -0,0 +1,327 @@
+/* Test mpf_fits_*_p
+
+Copyright 2001, 2002, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+/* Nothing sophisticated here, just exercise mpf_fits_*_p on a small amount
+ of data. */
+
+#define EXPECT_S(fun,name,answer) \
+ got = fun (f); \
+ if (got != answer) \
+ { \
+ printf ("%s (%s) got %d want %d\n", name, expr, got, answer); \
+ printf (" f size %d exp %ld\n", SIZ(f), EXP(f)); \
+ printf (" f dec "); mpf_out_str (stdout, 10, 0, f); printf ("\n"); \
+ printf (" f hex "); mpf_out_str (stdout, 16, 0, f); printf ("\n"); \
+ error = 1; \
+ }
+
+#define EXPECT(fun,answer) EXPECT_S(fun,#fun,answer)
+
+int
+main (void)
+{
+ mpf_t f, f0p5;
+ int got;
+ const char *expr;
+ int error = 0;
+
+ tests_start ();
+ mpf_init2 (f, 200L);
+ mpf_init2 (f0p5, 200L);
+
+ /* 0.5 */
+ mpf_set_ui (f0p5, 1L);
+ mpf_div_2exp (f0p5, f0p5, 1L);
+
+ mpf_set_ui (f, 0L);
+ expr = "0";
+ EXPECT (mpf_fits_ulong_p, 1);
+ EXPECT (mpf_fits_uint_p, 1);
+ EXPECT (mpf_fits_ushort_p, 1);
+ EXPECT (mpf_fits_slong_p, 1);
+ EXPECT (mpf_fits_sint_p, 1);
+ EXPECT (mpf_fits_sshort_p, 1);
+
+ mpf_set_ui (f, 1L);
+ expr = "1";
+ EXPECT (mpf_fits_ulong_p, 1);
+ EXPECT (mpf_fits_uint_p, 1);
+ EXPECT (mpf_fits_ushort_p, 1);
+ EXPECT (mpf_fits_slong_p, 1);
+ EXPECT (mpf_fits_sint_p, 1);
+ EXPECT (mpf_fits_sshort_p, 1);
+
+ mpf_set_si (f, -1L);
+ expr = "-1";
+ EXPECT (mpf_fits_ulong_p, 0);
+ EXPECT (mpf_fits_uint_p, 0);
+ EXPECT (mpf_fits_ushort_p, 0);
+ EXPECT (mpf_fits_slong_p, 1);
+ EXPECT (mpf_fits_sint_p, 1);
+ EXPECT (mpf_fits_sshort_p, 1);
+
+
+ mpf_set_ui (f, (unsigned long) USHRT_MAX);
+ expr = "USHRT_MAX";
+ EXPECT (mpf_fits_ulong_p, 1);
+ EXPECT (mpf_fits_uint_p, 1);
+ EXPECT (mpf_fits_ushort_p, 1);
+
+ mpf_set_ui (f, (unsigned long) USHRT_MAX);
+ mpf_add (f, f, f0p5);
+ expr = "USHRT_MAX + 0.5";
+ EXPECT (mpf_fits_ulong_p, 1);
+ EXPECT (mpf_fits_uint_p, 1);
+ EXPECT (mpf_fits_ushort_p, 1);
+
+ mpf_set_ui (f, (unsigned long) USHRT_MAX);
+ mpf_add_ui (f, f, 1L);
+ expr = "USHRT_MAX + 1";
+ EXPECT (mpf_fits_ushort_p, 0);
+
+
+ mpf_set_ui (f, (unsigned long) UINT_MAX);
+ expr = "UINT_MAX";
+ EXPECT (mpf_fits_ulong_p, 1);
+ EXPECT (mpf_fits_uint_p, 1);
+
+ mpf_set_ui (f, (unsigned long) UINT_MAX);
+ mpf_add (f, f, f0p5);
+ expr = "UINT_MAX + 0.5";
+ EXPECT (mpf_fits_ulong_p, 1);
+ EXPECT (mpf_fits_uint_p, 1);
+
+ mpf_set_ui (f, (unsigned long) UINT_MAX);
+ mpf_add_ui (f, f, 1L);
+ expr = "UINT_MAX + 1";
+ EXPECT (mpf_fits_uint_p, 0);
+
+
+ mpf_set_ui (f, ULONG_MAX);
+ expr = "ULONG_MAX";
+ EXPECT (mpf_fits_ulong_p, 1);
+
+ mpf_set_ui (f, ULONG_MAX);
+ mpf_add (f, f, f0p5);
+ expr = "ULONG_MAX + 0.5";
+ EXPECT (mpf_fits_ulong_p, 1);
+
+ mpf_set_ui (f, ULONG_MAX);
+ mpf_add_ui (f, f, 1L);
+ expr = "ULONG_MAX + 1";
+ EXPECT (mpf_fits_ulong_p, 0);
+
+
+ mpf_set_si (f, (long) SHRT_MAX);
+ expr = "SHRT_MAX";
+ EXPECT (mpf_fits_slong_p, 1);
+ EXPECT (mpf_fits_sint_p, 1);
+ EXPECT (mpf_fits_sshort_p, 1);
+
+ mpf_set_si (f, (long) SHRT_MAX);
+ expr = "SHRT_MAX + 0.5";
+ mpf_add (f, f, f0p5);
+ EXPECT (mpf_fits_slong_p, 1);
+ EXPECT (mpf_fits_sint_p, 1);
+ EXPECT (mpf_fits_sshort_p, 1);
+
+ mpf_set_si (f, (long) SHRT_MAX);
+ mpf_add_ui (f, f, 1L);
+ expr = "SHRT_MAX + 1";
+ EXPECT (mpf_fits_sshort_p, 0);
+
+
+ mpf_set_si (f, (long) INT_MAX);
+ expr = "INT_MAX";
+ EXPECT (mpf_fits_slong_p, 1);
+ EXPECT (mpf_fits_sint_p, 1);
+
+ mpf_set_si (f, (long) INT_MAX);
+ mpf_add (f, f, f0p5);
+ expr = "INT_MAX + 0.5";
+ EXPECT (mpf_fits_slong_p, 1);
+ EXPECT (mpf_fits_sint_p, 1);
+
+ mpf_set_si (f, (long) INT_MAX);
+ mpf_add_ui (f, f, 1L);
+ expr = "INT_MAX + 1";
+ EXPECT (mpf_fits_sint_p, 0);
+
+
+ mpf_set_si (f, LONG_MAX);
+ expr = "LONG_MAX";
+ EXPECT (mpf_fits_slong_p, 1);
+
+ mpf_set_si (f, LONG_MAX);
+ mpf_add (f, f, f0p5);
+ expr = "LONG_MAX + 0.5";
+ EXPECT (mpf_fits_slong_p, 1);
+
+ mpf_set_si (f, LONG_MAX);
+ mpf_add_ui (f, f, 1L);
+ expr = "LONG_MAX + 1";
+ EXPECT (mpf_fits_slong_p, 0);
+
+
+ mpf_set_si (f, (long) SHRT_MIN);
+ expr = "SHRT_MIN";
+ EXPECT (mpf_fits_slong_p, 1);
+ EXPECT (mpf_fits_sint_p, 1);
+ EXPECT (mpf_fits_sshort_p, 1);
+
+ mpf_set_si (f, (long) SHRT_MIN);
+ mpf_sub (f, f, f0p5);
+ expr = "SHRT_MIN - 0.5";
+ EXPECT (mpf_fits_slong_p, 1);
+ EXPECT (mpf_fits_sint_p, 1);
+ EXPECT (mpf_fits_sshort_p, 1);
+
+ mpf_set_si (f, (long) SHRT_MIN);
+ mpf_sub_ui (f, f, 1L);
+ expr = "SHRT_MIN - 1";
+ EXPECT (mpf_fits_sshort_p, 0);
+
+
+ mpf_set_si (f, (long) INT_MIN);
+ expr = "INT_MIN";
+ EXPECT (mpf_fits_slong_p, 1);
+ EXPECT (mpf_fits_sint_p, 1);
+
+ mpf_set_si (f, (long) INT_MIN);
+ mpf_sub (f, f, f0p5);
+ expr = "INT_MIN - 0.5";
+ EXPECT (mpf_fits_slong_p, 1);
+ EXPECT (mpf_fits_sint_p, 1);
+
+ mpf_set_si (f, (long) INT_MIN);
+ mpf_sub_ui (f, f, 1L);
+ expr = "INT_MIN - 1";
+ EXPECT (mpf_fits_sint_p, 0);
+
+
+ mpf_set_si (f, LONG_MIN);
+ expr = "LONG_MIN";
+ EXPECT (mpf_fits_slong_p, 1);
+
+ mpf_set_si (f, LONG_MIN);
+ mpf_sub (f, f, f0p5);
+ expr = "LONG_MIN - 0.5";
+ EXPECT (mpf_fits_slong_p, 1);
+
+ mpf_set_si (f, LONG_MIN);
+ mpf_sub_ui (f, f, 1L);
+ expr = "LONG_MIN - 1";
+ EXPECT (mpf_fits_slong_p, 0);
+
+
+ mpf_set_str_or_abort (f, "0.5", 10);
+ expr = "0.5";
+ EXPECT (mpf_fits_ulong_p, 1);
+ EXPECT (mpf_fits_uint_p, 1);
+ EXPECT (mpf_fits_ushort_p, 1);
+ EXPECT (mpf_fits_slong_p, 1);
+ EXPECT (mpf_fits_sint_p, 1);
+ EXPECT (mpf_fits_sshort_p, 1);
+
+ mpf_set_str_or_abort (f, "-0.5", 10);
+ expr = "-0.5";
+ EXPECT (mpf_fits_ulong_p, 1);
+ EXPECT (mpf_fits_uint_p, 1);
+ EXPECT (mpf_fits_ushort_p, 1);
+ EXPECT (mpf_fits_slong_p, 1);
+ EXPECT (mpf_fits_sint_p, 1);
+ EXPECT (mpf_fits_sshort_p, 1);
+
+ mpf_set_str_or_abort (f, "-1.5", 10);
+ expr = "-1.5";
+ EXPECT (mpf_fits_ulong_p, 0);
+ EXPECT (mpf_fits_uint_p, 0);
+ EXPECT (mpf_fits_ushort_p, 0);
+ EXPECT (mpf_fits_slong_p, 1);
+ EXPECT (mpf_fits_sint_p, 1);
+ EXPECT (mpf_fits_sshort_p, 1);
+
+
+ mpf_set_str_or_abort (f, "1.000000000000000000000000000000000001", 16);
+ expr = "1.000000000000000000000000000000000001 base 16";
+ EXPECT (mpf_fits_ulong_p, 1);
+ EXPECT (mpf_fits_uint_p, 1);
+ EXPECT (mpf_fits_ushort_p, 1);
+ EXPECT (mpf_fits_slong_p, 1);
+ EXPECT (mpf_fits_sint_p, 1);
+ EXPECT (mpf_fits_sshort_p, 1);
+
+ mpf_set_str_or_abort (f, "1@1000", 16);
+ expr = "1@1000 base 16";
+ EXPECT (mpf_fits_ulong_p, 0);
+ EXPECT (mpf_fits_uint_p, 0);
+ EXPECT (mpf_fits_ushort_p, 0);
+ EXPECT (mpf_fits_slong_p, 0);
+ EXPECT (mpf_fits_sint_p, 0);
+ EXPECT (mpf_fits_sshort_p, 0);
+
+
+ mpf_set_ui (f, 1L);
+ mpf_mul_2exp (f, f, BITS_PER_ULONG + 1);
+ mpf_sub_ui (f, f, 1L);
+ expr = "2^(BITS_PER_ULONG+1) - 1";
+ EXPECT (mpf_fits_ulong_p, 0);
+ EXPECT (mpf_fits_uint_p, 0);
+ EXPECT (mpf_fits_ushort_p, 0);
+ EXPECT (mpf_fits_slong_p, 0);
+ EXPECT (mpf_fits_sint_p, 0);
+ EXPECT (mpf_fits_sshort_p, 0);
+
+ mpf_set_ui (f, 1L);
+ mpf_mul_2exp (f, f, BITS_PER_ULONG + 1);
+ mpf_ui_sub (f, 1L, f);
+ expr = "- (2^(BITS_PER_ULONG+1) - 1)";
+ EXPECT (mpf_fits_ulong_p, 0);
+ EXPECT (mpf_fits_uint_p, 0);
+ EXPECT (mpf_fits_ushort_p, 0);
+ EXPECT (mpf_fits_slong_p, 0);
+ EXPECT (mpf_fits_sint_p, 0);
+ EXPECT (mpf_fits_sshort_p, 0);
+
+ mpf_set_ui (f, 1L);
+ mpf_mul_2exp (f, f, BITS_PER_ULONG + 5);
+ mpf_sub_ui (f, f, 1L);
+ expr = "2^(BITS_PER_ULONG+5) - 1";
+ EXPECT (mpf_fits_ulong_p, 0);
+ EXPECT (mpf_fits_uint_p, 0);
+ EXPECT (mpf_fits_ushort_p, 0);
+ EXPECT (mpf_fits_slong_p, 0);
+ EXPECT (mpf_fits_sint_p, 0);
+ EXPECT (mpf_fits_sshort_p, 0);
+
+
+ if (error)
+ abort ();
+
+ mpf_clear (f);
+ mpf_clear (f0p5);
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-get_d.c b/vendor/gmp-6.3.0/tests/mpf/t-get_d.c
new file mode 100644
index 0000000..4e4c741
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-get_d.c
@@ -0,0 +1,106 @@
+/* Test mpf_get_d and mpf_set_d.
+
+Copyright 1996, 1999-2001, 2009 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+#if defined (__vax) || defined (__vax__)
+#define LOW_BOUND 1e-38
+#define HIGH_BOUND 8e37
+#endif
+
+#if defined (_CRAY) && ! defined (_CRAYIEEE)
+/* The range varies mysteriously between Cray version. On an SV1,
+ the range seem to be 1e-600..1e603, but a cfp (non-ieee) T90
+ has a much smaller range of 1e-240..1e240. */
+#define LOW_BOUND 1e-240
+#define HIGH_BOUND 1e240
+#endif
+
+#if ! defined (LOW_BOUND)
+#define LOW_BOUND 1e-300
+#define HIGH_BOUND 1e300
+#endif
+
+void
+test_denorms (int prc)
+{
+#ifdef _GMP_IEEE_FLOATS
+ double d1, d2;
+ mpf_t f;
+ int i;
+
+ mpf_set_default_prec (prc);
+
+ mpf_init (f);
+
+ d1 = 1.9;
+ for (i = 0; i < 820; i++)
+ {
+ mpf_set_d (f, d1);
+ d2 = mpf_get_d (f);
+ if (d1 != d2)
+ abort ();
+ d1 *= 0.4;
+ }
+
+ mpf_clear (f);
+#endif
+}
+
+int
+main (int argc, char **argv)
+{
+ double d, e, r;
+ mpf_t u, v;
+
+ tests_start ();
+ mpf_init (u);
+ mpf_init (v);
+
+ mpf_set_d (u, LOW_BOUND);
+ for (d = 2.0 * LOW_BOUND; d < HIGH_BOUND; d *= 1.01)
+ {
+ mpf_set_d (v, d);
+ if (mpf_cmp (u, v) >= 0)
+ abort ();
+ e = mpf_get_d (v);
+ r = e/d;
+ if (r < 0.99999999999999 || r > 1.00000000000001)
+ {
+ fprintf (stderr, "should be one ulp from 1: %.16f\n", r);
+ abort ();
+ }
+ mpf_set (u, v);
+ }
+
+ mpf_clear (u);
+ mpf_clear (v);
+
+ test_denorms (10);
+ test_denorms (32);
+ test_denorms (64);
+ test_denorms (100);
+ test_denorms (200);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-get_d_2exp.c b/vendor/gmp-6.3.0/tests/mpf/t-get_d_2exp.c
new file mode 100644
index 0000000..b716cf8
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-get_d_2exp.c
@@ -0,0 +1,136 @@
+/* Test mpf_get_d_2exp.
+
+Copyright 2002, 2003, 2017, 2020 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+static void
+check_data (void)
+{
+ mpf_t f;
+ double got, want;
+ long got_exp;
+ long exp;
+ struct {
+ int base;
+ int shift;
+ } data[] = {
+ {-1, 1}, {-3, 2}, {-5, 3}, {-7, 3}, { 1, 1}, { 3, 2}, { 5, 3}, { 7, 3}
+ };
+
+ mpf_init2 (f, 3);
+
+ got = mpf_get_d_2exp (&got_exp, f);
+ if (got != 0 || got_exp != 0)
+ {
+ printf ("mpf_get_d_2exp wrong on zero\n");
+ mpf_trace (" f ", f);
+ d_trace (" got ", got);
+ printf (" got exp %ld\n", got_exp);
+ abort();
+ }
+
+ for (exp = -513; exp <= 513; exp++)
+ {
+ size_t i;
+ for (i = 0; i < numberof (data); i++)
+ {
+ want = (double) data[i].base / (1 << data[i].shift);
+ mpf_set_d (f, want);
+
+ if (exp >= 0)
+ mpf_mul_2exp (f, f, exp);
+ else
+ mpf_div_2exp (f, f, -exp);
+
+ got = mpf_get_d_2exp (&got_exp, f);
+ if (got != want || got_exp != exp)
+ {
+ printf ("mpf_get_d_2exp wrong on 2**%ld\n", exp);
+ mpf_trace (" f ", f);
+ d_trace (" want ", want);
+ d_trace (" got ", got);
+ printf (" want exp %ld\n", exp);
+ printf (" got exp %ld\n", got_exp);
+ abort();
+ }
+ }
+ }
+ mpf_clear (f);
+}
+
+/* Check that hardware rounding doesn't make mpf_get_d_2exp return a value
+ outside its defined range. */
+static void
+check_round (void)
+{
+ static const unsigned long data[] = { 1, 32, 53, 54, 64, 128, 256, 512 };
+ mpf_t f;
+ double got;
+ long got_exp;
+ int i, rnd_mode, old_rnd_mode;
+
+ mpf_init2 (f, 1024L);
+ old_rnd_mode = tests_hardware_getround ();
+
+ for (rnd_mode = 0; rnd_mode < 4; rnd_mode++)
+ {
+ tests_hardware_setround (rnd_mode);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpf_set_ui (f, 1L);
+ mpf_mul_2exp (f, f, data[i]);
+ mpf_sub_ui (f, f, 1L);
+
+ got = mpf_get_d_2exp (&got_exp, f);
+ if (got < 0.5 || got >= 1.0)
+ {
+ printf ("mpf_get_d_2exp bad on 2**%lu-1\n", data[i]);
+ printf ("result out of range, expect 0.5 <= got < 1.0\n");
+ printf (" rnd_mode = %d\n", rnd_mode);
+ printf (" data[i] = %lu\n", data[i]);
+ mpf_trace (" f ", f);
+ d_trace (" got ", got);
+ printf (" got exp %ld\n", got_exp);
+ abort();
+ }
+ }
+ }
+
+ mpf_clear (f);
+ tests_hardware_setround (old_rnd_mode);
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+ mp_trace_base = 16;
+
+ check_data ();
+ check_round ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-get_si.c b/vendor/gmp-6.3.0/tests/mpf/t-get_si.c
new file mode 100644
index 0000000..5510b04
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-get_si.c
@@ -0,0 +1,222 @@
+/* Exercise mpz_get_si.
+
+Copyright 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_data (void)
+{
+ static const struct {
+ int base;
+ const char *f;
+ long want;
+ } data[] = {
+ { 10, "0", 0L },
+ { 10, "1", 1L },
+ { 10, "-1", -1L },
+ { 10, "2", 2L },
+ { 10, "-2", -2L },
+ { 10, "12345", 12345L },
+ { 10, "-12345", -12345L },
+
+ /* fraction bits ignored */
+ { 10, "0.5", 0L },
+ { 10, "-0.5", 0L },
+ { 10, "1.1", 1L },
+ { 10, "-1.1", -1L },
+ { 10, "1.9", 1L },
+ { 10, "-1.9", -1L },
+ { 16, "1.000000000000000000000000000000000000000000000000001", 1L },
+ { 16, "-1.000000000000000000000000000000000000000000000000001", -1L },
+
+ /* low bits extracted (this is undocumented) */
+ { 16, "1000000000000000000000000000000000000000000000000001", 1L },
+ { 16, "-1000000000000000000000000000000000000000000000000001", -1L },
+ };
+
+ int i;
+ mpf_t f;
+ long got;
+
+ mpf_init2 (f, 2000L);
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpf_set_str_or_abort (f, data[i].f, data[i].base);
+
+ got = mpf_get_si (f);
+ if (got != data[i].want)
+ {
+ printf ("mpf_get_si wrong at data[%d]\n", i);
+ printf (" f \"%s\"\n", data[i].f);
+ printf (" dec "); mpf_out_str (stdout, 10, 0, f); printf ("\n");
+ printf (" hex "); mpf_out_str (stdout, 16, 0, f); printf ("\n");
+ printf (" size %ld\n", (long) SIZ(f));
+ printf (" exp %ld\n", (long) EXP(f));
+ printf (" got %ld (0x%lX)\n", got, got);
+ printf (" want %ld (0x%lX)\n", data[i].want, data[i].want);
+ abort();
+ }
+ }
+ mpf_clear (f);
+}
+
+
+void
+check_max (void)
+{
+ mpf_t f;
+ long want;
+ long got;
+
+ mpf_init2 (f, 200L);
+
+#define CHECK_MAX(name) \
+ if (got != want) \
+ { \
+ printf ("mpf_get_si wrong on %s\n", name); \
+ printf (" f "); \
+ mpf_out_str (stdout, 10, 0, f); printf (", hex "); \
+ mpf_out_str (stdout, 16, 0, f); printf ("\n"); \
+ printf (" got %ld, hex %lX\n", got, got); \
+ printf (" want %ld, hex %lX\n", want, want); \
+ abort(); \
+ }
+
+ want = LONG_MAX;
+ mpf_set_si (f, want);
+ got = mpf_get_si (f);
+ CHECK_MAX ("LONG_MAX");
+
+ want = LONG_MIN;
+ mpf_set_si (f, want);
+ got = mpf_get_si (f);
+ CHECK_MAX ("LONG_MIN");
+
+ mpf_clear (f);
+}
+
+
+void
+check_limbdata (void)
+{
+#define M GMP_NUMB_MAX
+
+ static const struct {
+ mp_exp_t exp;
+ mp_size_t size;
+ mp_limb_t d[10];
+ unsigned long want;
+
+ } data[] = {
+
+ /* in the comments here, a "_" indicates a digit (ie. limb) position not
+ included in the d data, and therefore zero */
+
+ { 0, 0, { 0 }, 0L }, /* 0 */
+
+ { 1, 1, { 1 }, 1L }, /* 1 */
+ { 1, -1, { 1 }, -1UL }, /* -1 */
+
+ { 0, 1, { 1 }, 0L }, /* .1 */
+ { 0, -1, { 1 }, 0L }, /* -.1 */
+
+ { -1, 1, { 1 }, 0L }, /* ._1 */
+ { -1, -1, { 1 }, 0L }, /* -._1 */
+
+ { -999, 1, { 1 }, 0L }, /* .___1 small */
+ { MP_EXP_T_MIN, 1, { 1 }, 0L }, /* .____1 very small */
+
+ { 999, 1, { 1 }, 0L }, /* 1____. big */
+ { MP_EXP_T_MAX, 1, { 1 }, 0L }, /* 1_____. very big */
+
+ { 1, 2, { 999, 2 }, 2L }, /* 2.9 */
+ { 5, 8, { 7, 8, 9, 3, 0, 0, 0, 1 }, 3L }, /* 10003.987 */
+
+ { 2, 2, { M, M }, LONG_MAX }, /* FF. */
+ { 2, 2, { M, M, M }, LONG_MAX }, /* FF.F */
+ { 3, 3, { M, M, M }, LONG_MAX }, /* FFF. */
+
+#if GMP_NUMB_BITS >= BITS_PER_ULONG
+ /* normal case, numb bigger than long */
+ { 2, 1, { 1 }, 0L }, /* 1_. */
+ { 2, 2, { 0, 1 }, 0L }, /* 10. */
+ { 2, 2, { 999, 1 }, 999L }, /* 19. */
+ { 3, 2, { 999, 1 }, 0L }, /* 19_. */
+
+#else
+ /* nails case, numb smaller than long */
+ { 2, 1, { 1 }, 1L << GMP_NUMB_BITS }, /* 1_. */
+ { 3, 1, { 1 }, 0L }, /* 1__. */
+
+ { 2, 2, { 99, 1 }, 99L + (1L << GMP_NUMB_BITS) }, /* 19. */
+ { 3, 2, { 1, 99 }, 1L << GMP_NUMB_BITS }, /* 91_. */
+ { 3, 3, { 0, 1, 99 }, 1L << GMP_NUMB_BITS }, /* 910. */
+
+#endif
+ };
+
+ mpf_t f;
+ unsigned long got;
+ int i;
+ mp_limb_t buf[20 + numberof(data[i].d)];
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ refmpn_fill (buf, 10, CNST_LIMB(0xDEADBEEF));
+ refmpn_copy (buf+10, data[i].d, ABS(data[i].size));
+ refmpn_fill (buf+10+ABS(data[i].size), 10, CNST_LIMB(0xDEADBEEF));
+
+ PTR(f) = buf+10;
+ EXP(f) = data[i].exp;
+ SIZ(f) = data[i].size;
+ PREC(f) = numberof (data[i].d);
+ MPF_CHECK_FORMAT (f);
+
+ got = mpf_get_si (f);
+ if (got != data[i].want)
+ {
+ printf ("mpf_get_si wrong at limb data[%d]\n", i);
+ mpf_trace (" f", f);
+ mpn_trace (" d", data[i].d, data[i].size);
+ printf (" size %ld\n", (long) data[i].size);
+ printf (" exp %ld\n", (long) data[i].exp);
+ printf (" got %lu (0x%lX)\n", got, got);
+ printf (" want %lu (0x%lX)\n", data[i].want, data[i].want);
+ abort();
+ }
+ }
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_data ();
+ check_max ();
+ check_limbdata ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-get_ui.c b/vendor/gmp-6.3.0/tests/mpf/t-get_ui.c
new file mode 100644
index 0000000..6011b0f
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-get_ui.c
@@ -0,0 +1,127 @@
+/* Exercise mpf_get_ui.
+
+Copyright 2004 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_limbdata (void)
+{
+#define M GMP_NUMB_MAX
+
+ static const struct {
+ mp_exp_t exp;
+ mp_size_t size;
+ mp_limb_t d[10];
+ unsigned long want;
+
+ } data[] = {
+
+ /* in the comments here, a "_" indicates a digit (ie. limb) position not
+ included in the d data, and therefore zero */
+
+ { 0, 0, { 0 }, 0L }, /* 0 */
+
+ { 1, 1, { 1 }, 1L }, /* 1 */
+ { 1, -1, { 1 }, 1L }, /* -1 */
+
+ { 0, 1, { 1 }, 0L }, /* .1 */
+ { 0, -1, { 1 }, 0L }, /* -.1 */
+
+ { -1, 1, { 1 }, 0L }, /* ._1 */
+ { -1, -1, { 1 }, 0L }, /* -._1 */
+
+ { -999, 1, { 1 }, 0L }, /* .___1 small */
+ { MP_EXP_T_MIN, 1, { 1 }, 0L }, /* .____1 very small */
+
+ { 999, 1, { 1 }, 0L }, /* 1____. big */
+ { MP_EXP_T_MAX, 1, { 1 }, 0L }, /* 1_____. very big */
+
+ { 1, 2, { 999, 2 }, 2L }, /* 2.9 */
+ { 5, 8, { 7, 8, 9, 3, 0, 0, 0, 1 }, 3L }, /* 10003.987 */
+
+ { 2, 2, { M, M }, ULONG_MAX }, /* FF. */
+ { 2, 2, { M, M, M }, ULONG_MAX }, /* FF.F */
+ { 3, 3, { M, M, M }, ULONG_MAX }, /* FFF. */
+
+#if GMP_NUMB_BITS >= BITS_PER_ULONG
+ /* normal case, numb bigger than long */
+ { 2, 1, { 1 }, 0L }, /* 1_. */
+ { 2, 2, { 0, 1 }, 0L }, /* 10. */
+ { 2, 2, { 999, 1 }, 999L }, /* 19. */
+ { 3, 2, { 999, 1 }, 0L }, /* 19_. */
+
+#else
+ /* nails case, numb smaller than long */
+ { 2, 1, { 1 }, 1L << GMP_NUMB_BITS }, /* 1_. */
+ { 3, 1, { 1 }, 0L }, /* 1__. */
+
+ { 2, 2, { 99, 1 }, 99L + (1L << GMP_NUMB_BITS) }, /* 19. */
+ { 3, 2, { 1, 99 }, 1L << GMP_NUMB_BITS }, /* 91_. */
+ { 3, 3, { 0, 1, 99 }, 1L << GMP_NUMB_BITS }, /* 910. */
+
+#endif
+ };
+
+ mpf_t f;
+ unsigned long got;
+ int i;
+ mp_limb_t buf[20 + numberof(data[i].d)];
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ refmpn_fill (buf, 10, CNST_LIMB(0xDEADBEEF));
+ refmpn_copy (buf+10, data[i].d, ABS(data[i].size));
+ refmpn_fill (buf+10+ABS(data[i].size), 10, CNST_LIMB(0xDEADBEEF));
+
+ PTR(f) = buf+10;
+ EXP(f) = data[i].exp;
+ SIZ(f) = data[i].size;
+ PREC(f) = numberof (data[i].d);
+ MPF_CHECK_FORMAT (f);
+
+ got = mpf_get_ui (f);
+ if (got != data[i].want)
+ {
+ printf ("mpf_get_ui wrong at limb data[%d]\n", i);
+ mpf_trace (" f", f);
+ mpn_trace (" d", data[i].d, data[i].size);
+ printf (" size %ld\n", (long) data[i].size);
+ printf (" exp %ld\n", (long) data[i].exp);
+ printf (" got %lu (0x%lX)\n", got, got);
+ printf (" want %lu (0x%lX)\n", data[i].want, data[i].want);
+ abort();
+ }
+ }
+}
+
+int
+main (void)
+{
+ tests_start ();
+ mp_trace_base = 16;
+
+ check_limbdata ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-gsprec.c b/vendor/gmp-6.3.0/tests/mpf/t-gsprec.c
new file mode 100644
index 0000000..da07f3e
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-gsprec.c
@@ -0,0 +1,61 @@
+/* Test mpf_get_prec and mpf_set_prec.
+
+Copyright 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+void
+check_consistency (void)
+{
+ mpf_t x;
+ unsigned long i, a, b;
+
+ mpf_init (x);
+
+ for (i = 1; i < 2000; i++)
+ {
+ mpf_set_prec (x, i);
+ a = mpf_get_prec (x);
+ mpf_set_prec (x, a);
+ b = mpf_get_prec (x);
+ if (a != b)
+ {
+ printf ("mpf_get_prec / mpf_set_prec inconsistent\n");
+ printf (" set %lu gives %lu, but then set %lu gives %lu\n",
+ i, a,
+ a, b);
+ abort ();
+ }
+ }
+
+ mpf_clear (x);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_consistency ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-inp_str.c b/vendor/gmp-6.3.0/tests/mpf/t-inp_str.c
new file mode 100644
index 0000000..bcc0b26
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-inp_str.c
@@ -0,0 +1,191 @@
+/* Test mpf_inp_str.
+
+Copyright 2001, 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#if HAVE_UNISTD_H
+#include <unistd.h> /* for unlink */
+#endif
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+#define FILENAME "t-inp_str.tmp"
+
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *inp;
+ int base;
+ const char *want;
+ int want_nread;
+
+ } data[] = {
+
+ { "0", 10, "0", 1 },
+
+ { "abc", 10, "0", 0 },
+ { "ghi", 16, "0", 0 },
+
+ { "125", 10, "125", 3 },
+ { "125e1", 10, "1250", 5 },
+ { "12e+2", 10, "1200", 5 },
+ { "125e-1", 10, "12.5", 6 },
+
+ { "ff", 16, "255", 2 },
+ { "-ff", 16, "-255", 3 },
+ { "FF", 16, "255", 2 },
+ { "-FF", 16, "-255", 3 },
+
+ { "100", 16, "256", 3 },
+ { "100@1", 16, "4096", 5 },
+ { "100@10", 16, "4722366482869645213696", 6 },
+ { "100@10", -16, "281474976710656", 6 },
+ { "100@-1", 16, "16", 6 },
+ { "10000000000000000@-10", 16, "1", 21 },
+ { "10000000000@-10", -16, "1", 15 },
+
+ { "z", 36, "35", 1 },
+ { "Z", 36, "35", 1 },
+ { "z@1", 36, "1260", 3 },
+ { "Z@1", 36, "1260", 3 },
+
+ { "0", 0, "0", 1 },
+ };
+
+ mpf_t got, want;
+ long ftell_nread;
+ int i, pre, post, j, got_nread, want_nread;
+ FILE *fp;
+
+ mpf_init (got);
+ mpf_init (want);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ for (pre = 0; pre <= 3; pre++)
+ {
+ for (post = 0; post <= 2; post++)
+ {
+ mpf_set_str_or_abort (want, data[i].want, 10);
+ MPF_CHECK_FORMAT (want);
+
+ /* create the file new each time to ensure its length is what
+ we want */
+ fp = fopen (FILENAME, "w+");
+ ASSERT_ALWAYS (fp != NULL);
+ for (j = 0; j < pre; j++)
+ putc (' ', fp);
+ fputs (data[i].inp, fp);
+ for (j = 0; j < post; j++)
+ putc (' ', fp);
+ fflush (fp);
+ ASSERT_ALWAYS (! ferror(fp));
+
+ rewind (fp);
+ got_nread = mpf_inp_str (got, fp, data[i].base);
+
+ if (got_nread != 0)
+ {
+ ftell_nread = ftell (fp);
+ if (got_nread != ftell_nread)
+ {
+ printf ("mpf_inp_str nread wrong\n");
+ printf (" inp \"%s\"\n", data[i].inp);
+ printf (" base %d\n", data[i].base);
+ printf (" pre %d\n", pre);
+ printf (" post %d\n", post);
+ printf (" got_nread %d\n", got_nread);
+ printf (" ftell_nread %ld\n", ftell_nread);
+ abort ();
+ }
+ }
+
+ /* if data[i].inp is a whole string to read and there's no post
+ whitespace then expect to have EOF */
+ if (post == 0 && data[i].want_nread == strlen(data[i].inp))
+ {
+ int c = getc(fp);
+ if (c != EOF)
+ {
+ printf ("mpf_inp_str didn't read to EOF\n");
+ printf (" inp \"%s\"\n", data[i].inp);
+ printf (" base %d\n", data[i].base);
+ printf (" pre %d\n", pre);
+ printf (" post %d\n", post);
+ printf (" c '%c' %#x\n", c, c);
+ abort ();
+ }
+ }
+
+ /* only expect "pre" included in the count when non-zero */
+ want_nread = data[i].want_nread;
+ if (want_nread != 0)
+ want_nread += pre;
+
+ if (got_nread != want_nread)
+ {
+ printf ("mpf_inp_str nread wrong\n");
+ printf (" inp \"%s\"\n", data[i].inp);
+ printf (" base %d\n", data[i].base);
+ printf (" pre %d\n", pre);
+ printf (" post %d\n", post);
+ printf (" got_nread %d\n", got_nread);
+ printf (" want_nread %d\n", want_nread);
+ abort ();
+ }
+
+ MPF_CHECK_FORMAT (got);
+
+ if (mpf_cmp (got, want) != 0)
+ {
+ printf ("mpf_inp_str wrong result\n");
+ printf (" inp \"%s\"\n", data[i].inp);
+ printf (" base %d\n", data[i].base);
+ mpf_trace (" got ", got);
+ mpf_trace (" want", want);
+ abort ();
+ }
+
+ ASSERT_ALWAYS (fclose (fp) == 0);
+ }
+ }
+ }
+
+ mpf_clear (got);
+ mpf_clear (want);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_data ();
+
+ unlink (FILENAME);
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-int_p.c b/vendor/gmp-6.3.0/tests/mpf/t-int_p.c
new file mode 100644
index 0000000..3e536db
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-int_p.c
@@ -0,0 +1,90 @@
+/* Test mpf_integer_p.
+
+Copyright 2001, 2014 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+one (mpf_srcptr f, int want)
+{
+ int got;
+ got = mpf_integer_p (f);
+ if (got != want)
+ {
+ printf ("mpf_integer_p got %d want %d\n", got, want);
+ mpf_trace (" f", f);
+ abort ();
+ }
+}
+
+void
+all (mpf_ptr f, int want)
+{
+ one (f, want);
+ mpf_neg (f, f);
+ one (f, want);
+}
+
+int
+main (void)
+{
+ mpf_t f;
+
+ tests_start ();
+ mpf_init2 (f, 200L);
+
+ mpf_set_ui (f, 0L);
+ one (f, 1);
+
+ mpf_set_ui (f, 1L);
+ all (f, 1);
+
+ mpf_set_ui (f, 1L);
+ mpf_div_2exp (f, f, 1L);
+ all (f, 0);
+
+ mpf_set_ui (f, 1L);
+ mpf_div_2exp (f, f, 5000L);
+ all (f, 0);
+
+ mpf_set_ui (f, 1L);
+ mpf_mul_2exp (f, f, 5000L);
+ all (f, 1);
+
+ mpf_set_str (f, "0.5", 10);
+ all (f, 0);
+
+ mpf_set_str (f, "2.5", 10);
+ all (f, 0);
+
+ mpf_set_ui (f, 1L);
+ mpf_div_ui (f, f, 3L);
+ all (f, 0);
+
+ mpf_set_ui (f, 7L);
+ mpf_div_ui (f, f, 3L);
+ all (f, 0);
+
+ mpf_clear (f);
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-mul_ui.c b/vendor/gmp-6.3.0/tests/mpf/t-mul_ui.c
new file mode 100644
index 0000000..f362bb2
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-mul_ui.c
@@ -0,0 +1,164 @@
+/* Exercise mpf_mul_ui.
+
+Copyright 2004 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_one (const char *desc, mpf_ptr got, mpf_srcptr u, unsigned long v)
+{
+ mp_size_t usize, usign;
+ mp_ptr wp;
+ mpf_t want;
+
+ MPF_CHECK_FORMAT (got);
+
+ /* this code not nailified yet */
+ ASSERT_ALWAYS (BITS_PER_ULONG <= GMP_NUMB_BITS);
+ usign = SIZ (u);
+ usize = ABS (usign);
+ wp = refmpn_malloc_limbs (usize + 1);
+ wp[usize] = mpn_mul_1 (wp, PTR(u), usize, (mp_limb_t) v);
+
+ PTR(want) = wp;
+ SIZ(want) = (usign >= 0 ? usize+1 : -(usize+1));
+ EXP(want) = EXP(u) + 1;
+ refmpf_normalize (want);
+
+ if (! refmpf_validate ("mpf_mul_ui", got, want))
+ {
+ mp_trace_base = -16;
+ printf (" %s\n", desc);
+ mpf_trace (" u", u);
+ printf (" v %ld 0x%lX\n", v, v);
+ abort ();
+ }
+
+ free (wp);
+}
+
+void
+check_rand (void)
+{
+ unsigned long min_prec = __GMPF_BITS_TO_PREC (1);
+ gmp_randstate_ptr rands = RANDS;
+ mpf_t got, u;
+ unsigned long prec, v;
+ int i;
+
+ /* The nails code in mpf_mul_ui currently isn't exact, so suppress these
+ tests for now. */
+ if (BITS_PER_ULONG > GMP_NUMB_BITS)
+ return;
+
+ mpf_init (got);
+ mpf_init (u);
+
+ for (i = 0; i < 200; i++)
+ {
+ /* got precision */
+ prec = min_prec + gmp_urandomm_ui (rands, 15L);
+ refmpf_set_prec_limbs (got, prec);
+
+ /* u precision */
+ prec = min_prec + gmp_urandomm_ui (rands, 15L);
+ refmpf_set_prec_limbs (u, prec);
+
+ /* u, possibly negative */
+ mpf_random2 (u, PREC(u), (mp_exp_t) 20);
+ if (gmp_urandomb_ui (rands, 1L))
+ mpf_neg (u, u);
+
+ /* v, 0 to BITS_PER_ULONG bits (inclusive) */
+ prec = gmp_urandomm_ui (rands, BITS_PER_ULONG+1);
+ v = gmp_urandomb_ui (rands, prec);
+
+ if ((i % 2) == 0)
+ {
+ /* separate */
+ mpf_mul_ui (got, u, v);
+ check_one ("separate", got, u, v);
+ }
+ else
+ {
+ /* overlap */
+ prec = refmpf_set_overlap (got, u);
+ mpf_mul_ui (got, got, v);
+ check_one ("overlap src==dst", got, u, v);
+
+ mpf_set_prec_raw (got, prec);
+ }
+ }
+
+ mpf_clear (got);
+ mpf_clear (u);
+}
+
+void
+check_various (void)
+{
+ mpf_t u, got, want;
+ const char *s;
+
+ mpf_init2 (u, 2*8*sizeof(long));
+ mpf_init2 (got, 2*8*sizeof(long));
+ mpf_init2 (want, 2*8*sizeof(long));
+
+ s = "0 * ULONG_MAX";
+ mpf_set_ui (u, 0L);
+ mpf_mul_ui (got, u, ULONG_MAX);
+ MPF_CHECK_FORMAT (got);
+ mpf_set_ui (want, 0L);
+ if (mpf_cmp (got, want) != 0)
+ {
+ error:
+ printf ("Wrong result from %s\n", s);
+ mpf_trace ("u ", u);
+ mpf_trace ("got ", got);
+ mpf_trace ("want", want);
+ abort ();
+ }
+
+ s = "1 * ULONG_MAX";
+ mpf_set_ui (u, 1L);
+ mpf_mul_ui (got, u, ULONG_MAX);
+ MPF_CHECK_FORMAT (got);
+ mpf_set_ui (want, ULONG_MAX);
+ if (mpf_cmp (got, want) != 0)
+ goto error;
+
+ mpf_clear (u);
+ mpf_clear (got);
+ mpf_clear (want);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_various ();
+ check_rand ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-muldiv.c b/vendor/gmp-6.3.0/tests/mpf/t-muldiv.c
new file mode 100644
index 0000000..86dca57
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-muldiv.c
@@ -0,0 +1,158 @@
+/* Test mpf_mul, mpf_div, mpf_ui_div, and mpf_div_ui.
+
+Copyright 1996, 2000, 2001, 2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#ifndef SIZE
+#define SIZE 16
+#endif
+
+int
+main (int argc, char **argv)
+{
+ mp_size_t size;
+ mp_exp_t exp;
+ int reps = 10000;
+ int i;
+ mpf_t u, v, w, x;
+ mp_size_t bprec = SIZE * GMP_LIMB_BITS;
+ mpf_t rerr, limit_rerr;
+ unsigned long ulimb, vlimb;
+ int single_flag;
+
+ tests_start ();
+
+ if (argc > 1)
+ {
+ reps = strtol (argv[1], 0, 0);
+ if (argc > 2)
+ bprec = strtol (argv[2], 0, 0);
+ }
+
+ mpf_set_default_prec (bprec);
+
+ mpf_init (rerr);
+ mpf_init (limit_rerr);
+
+ mpf_init (u);
+ mpf_init (v);
+ mpf_init (w);
+ mpf_init (x);
+
+ for (i = 0; i < reps; i++)
+ {
+ mp_size_t res_prec;
+
+ res_prec = urandom () % bprec + 1;
+ mpf_set_prec (w, res_prec);
+ mpf_set_prec (x, res_prec);
+
+ mpf_set_ui (limit_rerr, 1);
+ mpf_div_2exp (limit_rerr, limit_rerr, res_prec - 1);
+
+ single_flag = 0;
+
+ if ((urandom () & 1) != 0)
+ {
+ size = urandom () % (2 * SIZE) - SIZE;
+ exp = urandom () % SIZE;
+ mpf_random2 (u, size, exp);
+ }
+ else
+ {
+ ulimb = urandom ();
+ mpf_set_ui (u, ulimb);
+ single_flag = 1;
+ }
+
+ if ((urandom () & 1) != 0)
+ {
+ size = urandom () % (2 * SIZE) - SIZE;
+ exp = urandom () % SIZE;
+ mpf_random2 (v, size, exp);
+ }
+ else
+ {
+ vlimb = urandom ();
+ mpf_set_ui (v, vlimb);
+ single_flag = 2;
+ }
+
+ if (mpf_sgn (v) == 0)
+ continue;
+
+ mpf_div (w, u, v);
+ mpf_mul (x, w, v);
+ mpf_reldiff (rerr, u, x);
+ if (mpf_cmp (rerr, limit_rerr) > 0)
+ {
+ printf ("ERROR in mpf_mul or mpf_div after %d tests\n", i);
+ printf (" u = "); mpf_dump (u);
+ printf (" v = "); mpf_dump (v);
+ printf (" x = "); mpf_dump (x);
+ printf (" w = "); mpf_dump (w);
+ abort ();
+ }
+
+ if (single_flag == 2)
+ {
+ mpf_div_ui (x, u, vlimb);
+ mpf_reldiff (rerr, w, x);
+ if (mpf_cmp (rerr, limit_rerr) > 0)
+ {
+ printf ("ERROR in mpf_div or mpf_div_ui after %d tests\n", i);
+ printf (" u = "); mpf_dump (u);
+ printf (" v = "); mpf_dump (v);
+ printf (" x = "); mpf_dump (x);
+ printf (" w = "); mpf_dump (w);
+ abort ();
+ }
+ }
+
+ if (single_flag == 1)
+ {
+ mpf_ui_div (x, ulimb, v);
+ mpf_reldiff (rerr, w, x);
+ if (mpf_cmp (rerr, limit_rerr) > 0)
+ {
+ printf ("ERROR in mpf_div or mpf_ui_div after %d tests\n", i);
+ printf (" u = "); mpf_dump (u);
+ printf (" v = "); mpf_dump (v);
+ printf (" x = "); mpf_dump (x);
+ printf (" w = "); mpf_dump (w);
+ abort ();
+ }
+ }
+ }
+
+ mpf_clear (rerr);
+ mpf_clear (limit_rerr);
+
+ mpf_clear (u);
+ mpf_clear (v);
+ mpf_clear (w);
+ mpf_clear (x);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-pow_ui.c b/vendor/gmp-6.3.0/tests/mpf/t-pow_ui.c
new file mode 100644
index 0000000..f005301
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-pow_ui.c
@@ -0,0 +1,69 @@
+/* Test mpf_pow_ui
+
+Copyright 2015 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+void
+check_data (void)
+{
+ unsigned int b, e;
+ mpf_t b1, r, r2, limit;
+
+ mpf_inits (b1, r, r2, NULL);
+ mpf_init_set_ui (limit, 1);
+ mpf_mul_2exp (limit, limit, MAX (GMP_NUMB_BITS, 53));
+
+ /* This test just test integers with results that fit in a single
+ limb or 53 bits. This avoids any rounding. */
+
+ for (b = 0; b <= 400; b++)
+ {
+ mpf_set_ui (b1, b);
+ mpf_set_ui (r2, 1);
+ for (e = 0; e <= GMP_LIMB_BITS; e++)
+ {
+ mpf_pow_ui (r, b1, e);
+
+ if (mpf_cmp (r, r2))
+ abort ();
+
+ mpf_mul_ui (r2, r2, b);
+
+ if (mpf_cmp (r2, limit) >= 0)
+ break;
+ }
+ }
+
+ mpf_clears (b1, r, r2, limit, NULL);
+}
+
+int
+main (int argc, char **argv)
+{
+ tests_start ();
+
+ check_data ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-set.c b/vendor/gmp-6.3.0/tests/mpf/t-set.c
new file mode 100644
index 0000000..2510748
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-set.c
@@ -0,0 +1,112 @@
+/* Test mpf_set, mpf_init_set.
+
+Copyright 2004, 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+void
+check_reuse (void)
+{
+ /* Try mpf_set(f,f) when f is bigger than prec. In the past this had
+ resulted in an MPN_COPY with invalid operand overlap. */
+ mpf_t f;
+ mp_size_t limbs = 20;
+ unsigned long bits = limbs * GMP_NUMB_BITS;
+ mpf_init2 (f, bits);
+ refmpf_fill (f, limbs, GMP_NUMB_MAX);
+ mpf_set_prec_raw (f, bits / 2);
+ mpf_set (f, f);
+ MPF_CHECK_FORMAT (f);
+ mpf_set_prec_raw (f, bits);
+ mpf_clear (f);
+}
+
+void
+check_random (long reps)
+{
+ unsigned long test;
+ gmp_randstate_ptr rands;
+ mpf_t a, b;
+ mpz_t z;
+ int precbits;
+
+#define PRECBITS 10
+
+ rands = RANDS;
+
+ mpz_init (z);
+ mpf_init2 (a, 1 << PRECBITS);
+
+ for (test = 0; test < reps; test++)
+ {
+ mpz_urandomb (z, rands, PRECBITS + 1);
+ precbits = mpz_get_ui (z) + 1;
+ mpz_urandomb (z, rands, precbits);
+ mpz_setbit (z, precbits - 1); /* make sure msb is set */
+ mpf_set_z (a, z);
+ if (precbits & 1)
+ mpf_neg (a, a);
+ mpz_urandomb (z, rands, PRECBITS);
+ mpf_div_2exp (a, a, mpz_get_ui (z) + 1);
+ mpz_urandomb (z, rands, PRECBITS);
+ precbits -= mpz_get_ui (z);
+ if (precbits <= 0)
+ precbits = 1 - precbits;
+ mpf_set_default_prec (precbits);
+
+ mpf_init_set (b, a);
+ MPF_CHECK_FORMAT (b);
+ if (!mpf_eq (a, b, precbits))
+ {
+ printf ("mpf_init_set wrong.\n");
+ abort();
+ }
+
+ mpf_set_ui (b, 0);
+ mpf_set (b, a);
+ MPF_CHECK_FORMAT (b);
+ if (!mpf_eq (a, b, precbits))
+ {
+ printf ("mpf_set wrong.\n");
+ abort();
+ }
+
+ mpf_clear (b);
+ }
+
+ mpf_clear (a);
+ mpz_clear (z);
+}
+
+int
+main (int argc, char *argv[])
+{
+ long reps = 10000;
+
+ tests_start ();
+ TESTS_REPS (reps, argv, argc);
+
+ check_reuse ();
+ check_random (reps);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-set_q.c b/vendor/gmp-6.3.0/tests/mpf/t-set_q.c
new file mode 100644
index 0000000..86dec6e
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-set_q.c
@@ -0,0 +1,126 @@
+/* Test mpf_set_q.
+
+Copyright 2004 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_one (mpf_ptr got, mpq_srcptr q)
+{
+ mpf_t n, d;
+
+ mpf_set_q (got, q);
+
+ PTR(n) = PTR(&q->_mp_num);
+ SIZ(n) = SIZ(&q->_mp_num);
+ EXP(n) = ABSIZ(&q->_mp_num);
+
+ PTR(d) = PTR(&q->_mp_den);
+ SIZ(d) = SIZ(&q->_mp_den);
+ EXP(d) = ABSIZ(&q->_mp_den);
+
+ if (! refmpf_validate_division ("mpf_set_q", got, n, d))
+ {
+ mp_trace_base = -16;
+ mpq_trace (" q", q);
+ abort ();
+ }
+}
+
+void
+check_rand (void)
+{
+ unsigned long min_prec = __GMPF_BITS_TO_PREC (1);
+ gmp_randstate_ptr rands = RANDS;
+ unsigned long prec;
+ mpf_t got;
+ mpq_t q;
+ int i;
+
+ mpf_init (got);
+ mpq_init (q);
+
+ for (i = 0; i < 400; i++)
+ {
+ /* result precision */
+ prec = min_prec + gmp_urandomm_ui (rands, 20L);
+ refmpf_set_prec_limbs (got, prec);
+
+ /* num */
+ prec = gmp_urandomm_ui (rands, 20L * GMP_NUMB_BITS);
+ mpz_rrandomb (mpq_numref(q), rands, prec);
+
+ /* possibly negative num */
+ if (gmp_urandomb_ui (rands, 1L))
+ mpz_neg (mpq_numref(q), mpq_numref(q));
+
+ /* den, non-zero */
+ do {
+ prec = gmp_urandomm_ui (rands, 20L * GMP_NUMB_BITS);
+ mpz_rrandomb (mpq_denref(q), rands, prec);
+ } while (mpz_sgn (mpq_denref(q)) <= 0);
+
+ check_one (got, q);
+ }
+
+ mpf_clear (got);
+ mpq_clear (q);
+}
+
+void
+check_various (void)
+{
+ mpf_t got;
+ mpq_t q;
+
+ mpf_init (got);
+ mpq_init (q);
+
+ /* 1/1 == 1 */
+ mpf_set_prec (got, 20L);
+ mpq_set_ui (q, 1L, 1L);
+ mpf_set_q (got, q);
+ MPF_CHECK_FORMAT (got);
+ ASSERT_ALWAYS (mpf_cmp_ui (got, 1L) == 0);
+
+ /* 1/(2^n+1), a case where truncating the divisor would be wrong */
+ mpf_set_prec (got, 500L);
+ mpq_set_ui (q, 1L, 1L);
+ mpz_mul_2exp (mpq_denref(q), mpq_denref(q), 800L);
+ mpz_add_ui (mpq_denref(q), mpq_denref(q), 1L);
+ check_one (got, q);
+
+ mpf_clear (got);
+ mpq_clear (q);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_various ();
+ check_rand ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-set_si.c b/vendor/gmp-6.3.0/tests/mpf/t-set_si.c
new file mode 100644
index 0000000..5cd6c89
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-set_si.c
@@ -0,0 +1,90 @@
+/* Test mpf_set_si and mpf_init_set_si.
+
+Copyright 2000, 2001, 2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+void
+check_data (void)
+{
+ static const struct {
+ long x;
+ mp_size_t want_size;
+ mp_limb_t want_data[2];
+ } data[] = {
+
+ { 0L, 0 },
+ { 1L, 1, { 1 } },
+ { -1L, -1, { 1 } },
+
+#if GMP_NUMB_BITS >= BITS_PER_ULONG
+ { LONG_MAX, 1, { LONG_MAX, 0 } },
+ { -LONG_MAX, -1, { LONG_MAX, 0 } },
+ { LONG_HIGHBIT, -1, { ULONG_HIGHBIT, 0 } },
+#else
+ { LONG_MAX, 2, { LONG_MAX & GMP_NUMB_MASK, LONG_MAX >> GMP_NUMB_BITS } },
+ { -LONG_MAX, -2, { LONG_MAX & GMP_NUMB_MASK, LONG_MAX >> GMP_NUMB_BITS }},
+ { LONG_HIGHBIT, -2, { 0, ULONG_HIGHBIT >> GMP_NUMB_BITS } },
+#endif
+ };
+
+ mpf_t x;
+ int i;
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpf_init (x);
+ mpf_set_si (x, data[i].x);
+ MPF_CHECK_FORMAT (x);
+ if (x->_mp_size != data[i].want_size
+ || refmpn_cmp_allowzero (x->_mp_d, data[i].want_data,
+ ABS (data[i].want_size)) != 0
+ || x->_mp_exp != ABS (data[i].want_size))
+ {
+ printf ("mpf_set_si wrong on data[%d]\n", i);
+ abort();
+ }
+ mpf_clear (x);
+
+ mpf_init_set_si (x, data[i].x);
+ MPF_CHECK_FORMAT (x);
+ if (x->_mp_size != data[i].want_size
+ || refmpn_cmp_allowzero (x->_mp_d, data[i].want_data,
+ ABS (data[i].want_size)) != 0
+ || x->_mp_exp != ABS (data[i].want_size))
+ {
+ printf ("mpf_init_set_si wrong on data[%d]\n", i);
+ abort();
+ }
+ mpf_clear (x);
+ }
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_data ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-set_ui.c b/vendor/gmp-6.3.0/tests/mpf/t-set_ui.c
new file mode 100644
index 0000000..828067c
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-set_ui.c
@@ -0,0 +1,89 @@
+/* Test mpf_set_ui and mpf_init_set_ui.
+
+Copyright 2000, 2001, 2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+void
+check_data (void)
+{
+ static const struct {
+ unsigned long x;
+ mp_size_t want_size;
+ mp_limb_t want_data[2];
+ } data[] = {
+
+ { 0L, 0 },
+ { 1L, 1, { 1 } },
+
+#if GMP_NUMB_BITS >= BITS_PER_ULONG
+ { ULONG_MAX, 1, { ULONG_MAX, 0 } },
+ { ULONG_HIGHBIT, 1, { ULONG_HIGHBIT, 0 } },
+#else
+ { ULONG_MAX, 2, { ULONG_MAX & GMP_NUMB_MASK,
+ ULONG_MAX >> GMP_NUMB_BITS } },
+ { ULONG_HIGHBIT, 2, { 0,
+ ULONG_HIGHBIT >> GMP_NUMB_BITS } },
+#endif
+ };
+
+ mpf_t x;
+ int i;
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpf_init (x);
+ mpf_set_ui (x, data[i].x);
+ MPF_CHECK_FORMAT (x);
+ if (x->_mp_size != data[i].want_size
+ || refmpn_cmp_allowzero (x->_mp_d, data[i].want_data,
+ ABS (data[i].want_size)) != 0
+ || x->_mp_exp != ABS (data[i].want_size))
+ {
+ printf ("mpf_set_ui wrong on data[%d]\n", i);
+ abort();
+ }
+ mpf_clear (x);
+
+ mpf_init_set_ui (x, data[i].x);
+ MPF_CHECK_FORMAT (x);
+ if (x->_mp_size != data[i].want_size
+ || refmpn_cmp_allowzero (x->_mp_d, data[i].want_data,
+ ABS (data[i].want_size)) != 0
+ || x->_mp_exp != ABS (data[i].want_size))
+ {
+ printf ("mpf_init_set_ui wrong on data[%d]\n", i);
+ abort();
+ }
+ mpf_clear (x);
+ }
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_data ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-sqrt.c b/vendor/gmp-6.3.0/tests/mpf/t-sqrt.c
new file mode 100644
index 0000000..5e93aba
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-sqrt.c
@@ -0,0 +1,193 @@
+/* Test mpf_sqrt, mpf_mul.
+
+Copyright 1996, 2001, 2004 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#ifndef SIZE
+#define SIZE 16
+#endif
+
+void
+check_rand1 (int argc, char **argv)
+{
+ mp_size_t size;
+ mp_exp_t exp;
+ int reps = 20000;
+ int i;
+ mpf_t x, y, y2;
+ mp_size_t bprec = 100;
+ mpf_t rerr, max_rerr, limit_rerr;
+
+ if (argc > 1)
+ {
+ reps = strtol (argv[1], 0, 0);
+ if (argc > 2)
+ bprec = strtol (argv[2], 0, 0);
+ }
+
+ mpf_set_default_prec (bprec);
+
+ mpf_init_set_ui (limit_rerr, 1);
+ mpf_div_2exp (limit_rerr, limit_rerr, bprec);
+#if VERBOSE
+ mpf_dump (limit_rerr);
+#endif
+ mpf_init (rerr);
+ mpf_init_set_ui (max_rerr, 0);
+
+ mpf_init (x);
+ mpf_init (y);
+ mpf_init (y2);
+ for (i = 0; i < reps; i++)
+ {
+ size = urandom () % SIZE;
+ exp = urandom () % SIZE;
+ mpf_random2 (x, size, exp);
+
+ mpf_sqrt (y, x);
+ MPF_CHECK_FORMAT (y);
+ mpf_mul (y2, y, y);
+
+ mpf_reldiff (rerr, x, y2);
+ if (mpf_cmp (rerr, max_rerr) > 0)
+ {
+ mpf_set (max_rerr, rerr);
+#if VERBOSE
+ mpf_dump (max_rerr);
+#endif
+ if (mpf_cmp (rerr, limit_rerr) > 0)
+ {
+ printf ("ERROR after %d tests\n", i);
+ printf (" x = "); mpf_dump (x);
+ printf (" y = "); mpf_dump (y);
+ printf (" y2 = "); mpf_dump (y2);
+ printf (" rerr = "); mpf_dump (rerr);
+ printf (" limit_rerr = "); mpf_dump (limit_rerr);
+ printf ("in hex:\n");
+ mp_trace_base = 16;
+ mpf_trace (" x ", x);
+ mpf_trace (" y ", y);
+ mpf_trace (" y2 ", y2);
+ mpf_trace (" rerr ", rerr);
+ mpf_trace (" limit_rerr", limit_rerr);
+ abort ();
+ }
+ }
+ }
+
+ mpf_clear (limit_rerr);
+ mpf_clear (rerr);
+ mpf_clear (max_rerr);
+
+ mpf_clear (x);
+ mpf_clear (y);
+ mpf_clear (y2);
+}
+
+void
+check_rand2 (void)
+{
+ unsigned long max_prec = 20;
+ unsigned long min_prec = __GMPF_BITS_TO_PREC (1);
+ gmp_randstate_ptr rands = RANDS;
+ unsigned long x_prec, r_prec;
+ mpf_t x, r, s;
+ int i;
+
+ mpf_init (x);
+ mpf_init (r);
+ mpf_init (s);
+ refmpf_set_prec_limbs (s, 2*max_prec+10);
+
+ for (i = 0; i < 500; i++)
+ {
+ /* input precision */
+ x_prec = gmp_urandomm_ui (rands, max_prec-min_prec) + min_prec;
+ refmpf_set_prec_limbs (x, x_prec);
+
+ /* result precision */
+ r_prec = gmp_urandomm_ui (rands, max_prec-min_prec) + min_prec;
+ refmpf_set_prec_limbs (r, r_prec);
+
+ mpf_random2 (x, x_prec, 1000);
+
+ mpf_sqrt (r, x);
+ MPF_CHECK_FORMAT (r);
+
+ /* Expect to prec limbs of result.
+ In the current implementation there's no stripping of low zero
+ limbs in mpf_sqrt, so size should be exactly prec. */
+ if (SIZ(r) != r_prec)
+ {
+ printf ("mpf_sqrt wrong number of result limbs\n");
+ mpf_trace (" x", x);
+ mpf_trace (" r", r);
+ printf (" r_prec=%lu\n", r_prec);
+ printf (" SIZ(r) %ld\n", (long) SIZ(r));
+ printf (" PREC(r) %ld\n", (long) PREC(r));
+ abort ();
+ }
+
+ /* Must have r^2 <= x, since r has been truncated. */
+ mpf_mul (s, r, r);
+ if (! (mpf_cmp (s, x) <= 0))
+ {
+ printf ("mpf_sqrt result too big\n");
+ mpf_trace (" x", x);
+ printf (" r_prec=%lu\n", r_prec);
+ mpf_trace (" r", r);
+ mpf_trace (" s", s);
+ abort ();
+ }
+
+ /* Must have (r+ulp)^2 > x, or else r is too small. */
+ refmpf_add_ulp (r);
+ mpf_mul (s, r, r);
+ if (! (mpf_cmp (s, x) > 0))
+ {
+ printf ("mpf_sqrt result too small\n");
+ mpf_trace (" x", x);
+ printf (" r_prec=%lu\n", r_prec);
+ mpf_trace (" r+ulp", r);
+ mpf_trace (" s", s);
+ abort ();
+ }
+ }
+
+ mpf_clear (x);
+ mpf_clear (r);
+ mpf_clear (s);
+}
+
+int
+main (int argc, char **argv)
+{
+ tests_start ();
+ mp_trace_base = -16;
+
+ check_rand1 (argc, argv);
+ check_rand2 ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-sqrt_ui.c b/vendor/gmp-6.3.0/tests/mpf/t-sqrt_ui.c
new file mode 100644
index 0000000..31c587f
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-sqrt_ui.c
@@ -0,0 +1,125 @@
+/* Test mpf_sqrt_ui.
+
+Copyright 2004, 2015 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_rand (void)
+{
+ unsigned long max_prec = 15;
+ unsigned long min_prec = __GMPF_BITS_TO_PREC (1);
+ gmp_randstate_ptr rands = RANDS;
+ unsigned long x, prec;
+ mpf_t r, s;
+ int i;
+
+ mpf_init (r);
+ mpf_init (s);
+ refmpf_set_prec_limbs (s, 2*max_prec+10);
+
+ for (x = 0; x < 2; x++)
+ {
+ mpf_sqrt_ui (r, x);
+ MPF_CHECK_FORMAT (r);
+ if (mpf_cmp_ui (r, x) != 0)
+ {
+ printf ("mpf_sqrt_ui wrong for special case:\n");
+ printf (" x=%lu\n", x);
+ mpf_trace (" r", r);
+ abort ();
+ }
+ }
+
+ for (i = 0; i < 50; i++)
+ {
+ /* input, a random non-zero ulong, exponentially distributed */
+ do {
+ x = gmp_urandomb_ui (rands,
+ gmp_urandomm_ui (rands, BITS_PER_ULONG) + 1);
+ } while (x <= 1);
+
+ /* result precision */
+ prec = gmp_urandomm_ui (rands, max_prec-min_prec) + min_prec;
+ refmpf_set_prec_limbs (r, prec);
+
+ mpf_sqrt_ui (r, x);
+ MPF_CHECK_FORMAT (r);
+
+ /* Expect to prec limbs of result.
+ In the current implementation there's no stripping of low zero
+ limbs in mpf_sqrt_ui, not even on perfect squares, so size should
+ be exactly prec. */
+ if (SIZ(r) != prec)
+ {
+ printf ("mpf_sqrt_ui result not enough result limbs\n");
+ printf (" x=%lu\n", x);
+ printf (" want prec=%lu\n", prec);
+ mpf_trace (" r", r);
+ printf (" r size %ld\n", (long) SIZ(r));
+ printf (" r prec %ld\n", (long) PREC(r));
+ abort ();
+ }
+
+ /* Must have r^2 <= x, since r has been truncated. */
+ mpf_mul (s, r, r);
+ if (! (mpf_cmp_ui (s, x) <= 0))
+ {
+ printf ("mpf_sqrt_ui result too big\n");
+ printf (" x=%lu\n", x);
+ printf (" want prec=%lu\n", prec);
+ mpf_trace (" r", r);
+ mpf_trace (" s", s);
+ abort ();
+ }
+
+ /* Must have (r+ulp)^2 > x.
+ No overflow from refmpf_add_ulp since r is only prec limbs. */
+ refmpf_add_ulp (r);
+ mpf_mul (s, r, r);
+ if (! (mpf_cmp_ui (s, x) > 0))
+ {
+ printf ("mpf_sqrt_ui result too small\n");
+ printf (" x=%lu\n", x);
+ printf (" want prec=%lu\n", prec);
+ mpf_trace (" r+ulp", r);
+ mpf_trace (" s", s);
+ abort ();
+ }
+ }
+
+ mpf_clear (r);
+ mpf_clear (s);
+}
+
+int
+main (int argc, char **argv)
+{
+ tests_start ();
+ mp_trace_base = -16;
+
+ check_rand ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-sub.c b/vendor/gmp-6.3.0/tests/mpf/t-sub.c
new file mode 100644
index 0000000..3872264
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-sub.c
@@ -0,0 +1,287 @@
+/* Test mpf_sub.
+
+Copyright 1996, 2001, 2004, 2014 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#ifndef SIZE
+#define SIZE 16
+#endif
+
+void
+check_rand (int argc, char **argv)
+{
+ mp_size_t size;
+ mp_exp_t exp;
+ int reps = 20000;
+ int i;
+ mpf_t u, v, w, wref;
+ mp_size_t bprec = 100;
+ mpf_t rerr, max_rerr, limit_rerr;
+
+ if (argc > 1)
+ {
+ reps = strtol (argv[1], 0, 0);
+ if (argc > 2)
+ bprec = strtol (argv[2], 0, 0);
+ }
+
+ mpf_set_default_prec (bprec);
+
+ mpf_init_set_ui (limit_rerr, 1);
+ mpf_div_2exp (limit_rerr, limit_rerr, bprec);
+#if VERBOSE
+ mpf_dump (limit_rerr);
+#endif
+ mpf_init (rerr);
+ mpf_init_set_ui (max_rerr, 0);
+
+ mpf_init (u);
+ mpf_init (v);
+ mpf_init (w);
+ mpf_init (wref);
+ for (i = 0; i < reps; i++)
+ {
+ size = urandom () % (2 * SIZE) - SIZE;
+ exp = urandom () % SIZE;
+ mpf_random2 (u, size, exp);
+
+ size = urandom () % (2 * SIZE) - SIZE;
+ exp = urandom () % SIZE;
+ mpf_random2 (v, size, exp);
+
+ if ((urandom () & 1) != 0)
+ mpf_add_ui (u, v, 1);
+ else if ((urandom () & 1) != 0)
+ mpf_sub_ui (u, v, 1);
+
+ mpf_sub (w, u, v);
+ refmpf_sub (wref, u, v);
+
+ mpf_reldiff (rerr, w, wref);
+ if (mpf_cmp (rerr, max_rerr) > 0)
+ {
+ mpf_set (max_rerr, rerr);
+#if VERBOSE
+ mpf_dump (max_rerr);
+#endif
+ if (mpf_cmp (rerr, limit_rerr) > 0)
+ {
+ printf ("ERROR after %d tests\n", i);
+ printf (" u = "); mpf_dump (u);
+ printf (" v = "); mpf_dump (v);
+ printf ("wref = "); mpf_dump (wref);
+ printf (" w = "); mpf_dump (w);
+ abort ();
+ }
+ }
+ }
+
+ mpf_clear (limit_rerr);
+ mpf_clear (rerr);
+ mpf_clear (max_rerr);
+
+ mpf_clear (u);
+ mpf_clear (v);
+ mpf_clear (w);
+ mpf_clear (wref);
+}
+
+#define W GMP_NUMB_MAX
+
+void
+check_data (void)
+{
+ static const struct {
+ struct {
+ int exp, size;
+ mp_limb_t d[10];
+ } x, y, want;
+
+ } data[] = {
+ { { 123, 2, { 8, 9 } }, { 123, 1, { 9 } }, { 122, 1, { 8 } } },
+ { { 1, 1, { 9 } }, { 1, 1, { 8 } }, { 1, 1, { 1 } } },
+ { { 1, 1, { 9 } }, { 1, -1, { 6 } }, { 1, 1, { 15 } } },
+ { { 1, 2, { 8, 9 } }, { 1, 1, { 8 } }, { 1, 2, { 8, 1 } } },
+ { { 2, 2, { 8, 1 } }, { 1, 1, { 9 } }, { 1, 1, { W } } },
+ { { 2, 2, { 9, 8 } }, { 1, 1, { 9 } }, { 2, 1, { 8 } } },
+ { { 2, 1, { 1 } }, { 1, 1, { 1 } }, { 1, 1, { W } } },
+ { { 2, 1, { 9 } }, { 1, 1, { W } }, { 2, 2, { 1, 8 } } },
+
+ { { 1, 2, { W, 8 } }, { 1, 1, { 9 } }, { 0, -1, { 1 } } },
+ { { 1, 2, { W, 7 } }, { 1, 1, { 9 } }, { 1, -2, { 1, 1 } } },
+ { { 1, 2, { 1, 8 } }, { 1, 1, { 9 } }, { 0, -1, { W } } },
+ { { 1, 2, { 1, 7 } }, { 1, 1, { 9 } }, { 1, -2, { W, 1 } } },
+ { { 1, 2, { 0, 8 } }, { 1, 1, { 9 } }, { 1, -1, { 1 } } },
+ { { 2, 3, { 5, 8, 1 } }, { 1, 1, { 9 } }, { 1, 2, { 5, W } } },
+ { { 3, 1, { 1 } }, { 1, 1, { 1 } }, { 2, 2, { W, W } } },
+ { { 1, 6, { W, W, W, W, W, 8 } }, { 1, 1, { 9 } }, { -4, -1, { 1 } } },
+ { { 5, 5, { W-6, W, W, W, W } }, { 6, 1, { 1 } }, { 1, -1, { 7 } } },
+
+ /* f - f == 0, various sizes.
+ These exercise a past problem (gmp 4.1.3 and earlier) where the
+ result exponent was not zeroed on a zero result like this. */
+ { { 0, 0 }, { 0, 0 }, { 0, 0 } },
+ { { 99, 3, { 0, 0, 1 } }, { 99, 1, { 1 } }, { 0, 0 } },
+ { { 99, 3, { 0, 123, 456 } }, { 99, 2, { 123, 456 } }, { 0, 0 } },
+ { { 99, 3, { 123, 456, 789 } }, { 99, 3, { 123, 456, 789 } }, { 0, 0 } },
+
+ /* High limbs cancel, leaving just the low limbs of the longer operand.
+ This exercises a past problem (gmp 4.1.3 and earlier) where high zero
+ limbs on the remainder were not stripped before truncating to the
+ destination, causing loss of precision. */
+ { { 123, 2, { 8, 9 } }, { 123, 1, { 9 } }, { 122, 1, { 8 } } },
+ { { 123, 3, { 8, 0, 9 } }, { 123, 1, { 9 } }, { 121, 1, { 8 } } },
+ { { 123, 4, { 8, 0, 0, 9 } }, { 123, 1, { 9 } }, { 120, 1, { 8 } } },
+ { { 123, 5, { 8, 0, 0, 0, 9 } }, { 123, 1, { 9 } }, { 119, 1, { 8 } } },
+ { { 123, 6, { 8, 0, 0, 0, 0, 9 } }, { 123, 1, { 9 } }, { 118, 1, { 8 } } },
+ /* { { 123, 6, { 8, 0, 0, 0, 0, 9 } }, { 123, 6, { 9, 0, 0, 0, 0, 8 } }, { 122, 5, { W, W, W, W, W } } }, */
+
+ };
+
+ mpf_t x, y, got, want;
+ int i, swap, fail;
+
+ fail = 0;
+ mp_trace_base = 16;
+ mpf_init (got);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ for (swap = 0; swap <= 7; swap++)
+ {
+ PTR(x) = (mp_ptr) data[i].x.d;
+ SIZ(x) = data[i].x.size;
+ EXP(x) = data[i].x.exp;
+ PREC(x) = numberof (data[i].x.d);
+ MPF_CHECK_FORMAT (x);
+
+ PTR(y) = (mp_ptr) data[i].y.d;
+ SIZ(y) = data[i].y.size;
+ EXP(y) = data[i].y.exp;
+ PREC(y) = numberof (data[i].y.d);
+ MPF_CHECK_FORMAT (y);
+
+ PTR(want) = (mp_ptr) data[i].want.d;
+ SIZ(want) = data[i].want.size;
+ EXP(want) = data[i].want.exp;
+ PREC(want) = numberof (data[i].want.d);
+ MPF_CHECK_FORMAT (want);
+
+ if (swap & 4)
+ {
+ mpf_swap (want, y);
+ }
+
+ if ((SIZ (x) ^ SIZ (y)) < 0)
+ continue; /* It's an addition, not a subtraction (TO BE REMOVED) */
+
+ if (swap & 1)
+ {
+ mpf_swap (x, y);
+ SIZ(want) = - SIZ(want);
+ }
+
+ if (swap & 2)
+ {
+ SIZ(want) = - SIZ(want);
+ SIZ(x) = - SIZ(x);
+ SIZ(y) = - SIZ(y);
+ }
+
+ mpf_sub (got, x, y);
+/* MPF_CHECK_FORMAT (got); */
+
+ if (! refmpf_validate ("mpf_sub", got, want))
+ {
+ printf ("check_data() wrong result at data[%d] (operands%s swapped)\n", i, swap ? "" : " not");
+ mpf_trace ("x ", x);
+ mpf_trace ("y ", y);
+ mpf_trace ("got ", got);
+ mpf_trace ("want", want);
+ fail = 1;
+ }
+
+ if (SIZ (x) == 1 || SIZ (x) == 0 )
+ {
+ if (SIZ (y)) EXP (y) -= EXP (x) - (mp_exp_t) SIZ (x);
+ if (SIZ (want)) EXP (want) -= EXP (x) - (mp_exp_t) SIZ (x);
+ EXP (x) = (mp_exp_t) SIZ (x);
+
+ if (mpf_fits_uint_p (x))
+ {
+ mpf_ui_sub (got, mpf_get_ui (x), y);
+
+ if (! refmpf_validate ("mpf_ui_sub", got, want))
+ {
+ printf ("check_data() wrong result at data[%d] (operands%s swapped)\n", i, swap ? "" : " not");
+ mpf_trace ("x ", x);
+ mpf_trace ("y ", y);
+ mpf_trace ("got ", got);
+ mpf_trace ("want", want);
+ fail = 1;
+ }
+ }
+ }
+
+ if (SIZ (y) == 1 || SIZ (y) == 0)
+ {
+ if (SIZ (x)) EXP (x) -= EXP (y) - (mp_exp_t) SIZ (y);
+ if (SIZ (want)) EXP (want) -= EXP (y) - (mp_exp_t) SIZ (y);
+ EXP (y) = (mp_exp_t) SIZ (y);
+
+ if (mpf_fits_uint_p (x))
+ {
+ mpf_sub_ui (got, x, mpf_get_ui (y));
+
+ if (! refmpf_validate ("mpf_sub_ui", got, want))
+ {
+ printf ("check_data() wrong result at data[%d] (operands%s swapped)\n", i, swap ? "" : " not");
+ mpf_trace ("x ", x);
+ mpf_trace ("y ", y);
+ mpf_trace ("got ", got);
+ mpf_trace ("want", want);
+ fail = 1;
+ }
+ }
+ }
+
+ }
+ }
+
+ mpf_clear (got);
+ if (fail)
+ abort ();
+}
+
+
+int
+main (int argc, char **argv)
+{
+ tests_start ();
+
+ check_data ();
+ check_rand (argc, argv);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-trunc.c b/vendor/gmp-6.3.0/tests/mpf/t-trunc.c
new file mode 100644
index 0000000..6543a1e
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-trunc.c
@@ -0,0 +1,270 @@
+/* Test mpf_trunc, mpf_ceil, mpf_floor.
+
+Copyright 2001, 2002, 2020 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_print (mpf_srcptr src, mpf_srcptr got, mpf_srcptr want)
+{
+ mp_trace_base = 16;
+ mpf_trace ("src ", src);
+ mpf_trace ("got ", got);
+ mpf_trace ("want", want);
+
+ printf ("got size=%d exp=%ld\n", SIZ(got), EXP(got));
+ mpn_trace (" limbs=", PTR(got), (mp_size_t) ABSIZ(got));
+
+ printf ("want size=%d exp=%ld\n", SIZ(want), EXP(want));
+ mpn_trace (" limbs=", PTR(want), (mp_size_t) ABSIZ(want));
+}
+
+void
+check_one (mpf_srcptr src, mpf_srcptr trunc, mpf_srcptr ceil, mpf_srcptr floor)
+{
+ mpf_t got;
+
+ mpf_init2 (got, mpf_get_prec (trunc));
+ ASSERT_ALWAYS (PREC(got) == PREC(trunc));
+ ASSERT_ALWAYS (PREC(got) == PREC(ceil));
+ ASSERT_ALWAYS (PREC(got) == PREC(floor));
+
+#define CHECK_SEP(name, fun, want) \
+ mpf_set_ui (got, 54321L); /* initial junk */ \
+ fun (got, src); \
+ MPF_CHECK_FORMAT (got); \
+ if (mpf_cmp (got, want) != 0) \
+ { \
+ printf ("%s wrong\n", name); \
+ check_print (src, got, want); \
+ abort (); \
+ }
+
+ CHECK_SEP ("mpf_trunc", mpf_trunc, trunc);
+ CHECK_SEP ("mpf_ceil", mpf_ceil, ceil);
+ CHECK_SEP ("mpf_floor", mpf_floor, floor);
+
+#define CHECK_INPLACE(name, fun, want) \
+ mpf_set (got, src); \
+ fun (got, got); \
+ MPF_CHECK_FORMAT (got); \
+ if (mpf_cmp (got, want) != 0) \
+ { \
+ printf ("%s wrong\n", name); \
+ check_print (src, got, want); \
+ abort (); \
+ }
+
+ CHECK_INPLACE ("mpf_trunc", mpf_trunc, trunc);
+
+ /* Can't do these unconditionally in case truncation by mpf_set strips
+ some low non-zero limbs which would have rounded the result. */
+ if (mpf_size (src) <= PREC(trunc)+1)
+ {
+ CHECK_INPLACE ("mpf_ceil", mpf_ceil, ceil);
+ CHECK_INPLACE ("mpf_floor", mpf_floor, floor);
+ }
+
+ mpf_clear (got);
+}
+
+void
+check_all (mpf_ptr src, mpf_ptr trunc, mpf_ptr ceil, mpf_ptr floor)
+{
+ /* some of these values are generated with direct field assignments */
+ MPF_CHECK_FORMAT (src);
+ MPF_CHECK_FORMAT (trunc);
+ MPF_CHECK_FORMAT (ceil);
+ MPF_CHECK_FORMAT (floor);
+
+ check_one (src, trunc, ceil, floor);
+
+ mpf_neg (src, src);
+ mpf_neg (trunc, trunc);
+ mpf_neg (ceil, ceil);
+ mpf_neg (floor, floor);
+ check_one (src, trunc, floor, ceil);
+}
+
+void
+check_various (void)
+{
+ mpf_t src, trunc, ceil, floor;
+ int n, i;
+
+ mpf_init2 (src, 512L);
+ mpf_init2 (trunc, 256L);
+ mpf_init2 (ceil, 256L);
+ mpf_init2 (floor, 256L);
+
+ /* 0 */
+ mpf_set_ui (src, 0L);
+ mpf_set_ui (trunc, 0L);
+ mpf_set_ui (ceil, 0L);
+ mpf_set_ui (floor, 0L);
+ check_all (src, trunc, ceil, floor);
+
+ /* 1 */
+ mpf_set_ui (src, 1L);
+ mpf_set_ui (trunc, 1L);
+ mpf_set_ui (ceil, 1L);
+ mpf_set_ui (floor, 1L);
+ check_all (src, trunc, ceil, floor);
+
+ /* 2^1024 */
+ mpf_set_ui (src, 1L);
+ mpf_mul_2exp (src, src, 1024L);
+ mpf_set (trunc, src);
+ mpf_set (ceil, src);
+ mpf_set (floor, src);
+ check_all (src, trunc, ceil, floor);
+
+ /* 1/2^1024, fraction only */
+ mpf_set_ui (src, 1L);
+ mpf_div_2exp (src, src, 1024L);
+ mpf_set_si (trunc, 0L);
+ mpf_set_si (ceil, 1L);
+ mpf_set_si (floor, 0L);
+ check_all (src, trunc, ceil, floor);
+
+ /* 1/2 */
+ mpf_set_ui (src, 1L);
+ mpf_div_2exp (src, src, 1L);
+ mpf_set_si (trunc, 0L);
+ mpf_set_si (ceil, 1L);
+ mpf_set_si (floor, 0L);
+ check_all (src, trunc, ceil, floor);
+
+ /* 123+1/2^64 */
+ mpf_set_ui (src, 1L);
+ mpf_div_2exp (src, src, 64L);
+ mpf_add_ui (src, src, 123L);
+ mpf_set_si (trunc, 123L);
+ mpf_set_si (ceil, 124L);
+ mpf_set_si (floor, 123L);
+ check_all (src, trunc, ceil, floor);
+
+ /* integer of full prec+1 limbs, unchanged */
+ n = PREC(trunc)+1;
+ ASSERT_ALWAYS (n <= PREC(src)+1);
+ EXP(src) = n;
+ SIZ(src) = n;
+ for (i = 0; i < SIZ(src); i++)
+ PTR(src)[i] = i+100;
+ mpf_set (trunc, src);
+ mpf_set (ceil, src);
+ mpf_set (floor, src);
+ check_all (src, trunc, ceil, floor);
+
+ /* full prec+1 limbs, 1 trimmed for integer */
+ n = PREC(trunc)+1;
+ ASSERT_ALWAYS (n <= PREC(src)+1);
+ EXP(src) = n-1;
+ SIZ(src) = n;
+ for (i = 0; i < SIZ(src); i++)
+ PTR(src)[i] = i+200;
+ EXP(trunc) = n-1;
+ SIZ(trunc) = n-1;
+ for (i = 0; i < SIZ(trunc); i++)
+ PTR(trunc)[i] = i+201;
+ mpf_set (floor, trunc);
+ mpf_add_ui (ceil, trunc, 1L);
+ check_all (src, trunc, ceil, floor);
+
+ /* prec+3 limbs, 2 trimmed for size */
+ n = PREC(trunc)+3;
+ ASSERT_ALWAYS (n <= PREC(src)+1);
+ EXP(src) = n;
+ SIZ(src) = n;
+ for (i = 0; i < SIZ(src); i++)
+ PTR(src)[i] = i+300;
+ EXP(trunc) = n;
+ SIZ(trunc) = n-2;
+ for (i = 0; i < SIZ(trunc); i++)
+ PTR(trunc)[i] = i+302;
+ mpf_set (floor, trunc);
+ mpf_set (ceil, trunc);
+ PTR(ceil)[0]++;
+ check_all (src, trunc, ceil, floor);
+
+ /* prec+4 limbs, 2 trimmed for size, 1 trimmed for integer */
+ n = PREC(trunc)+4;
+ ASSERT_ALWAYS (n <= PREC(src)+1);
+ EXP(src) = n-1;
+ SIZ(src) = n;
+ for (i = 0; i < SIZ(src); i++)
+ PTR(src)[i] = i+400;
+ EXP(trunc) = n-1;
+ SIZ(trunc) = n-3;
+ for (i = 0; i < SIZ(trunc); i++)
+ PTR(trunc)[i] = i+403;
+ mpf_set (floor, trunc);
+ mpf_set (ceil, trunc);
+ PTR(ceil)[0]++;
+ check_all (src, trunc, ceil, floor);
+
+ /* F.F, carry out of ceil */
+ EXP(src) = 1;
+ SIZ(src) = 2;
+ PTR(src)[0] = GMP_NUMB_MAX;
+ PTR(src)[1] = GMP_NUMB_MAX;
+ EXP(trunc) = 1;
+ SIZ(trunc) = 1;
+ PTR(trunc)[0] = GMP_NUMB_MAX;
+ mpf_set (floor, trunc);
+ EXP(ceil) = 2;
+ SIZ(ceil) = 1;
+ PTR(ceil)[0] = 1;
+ check_all (src, trunc, ceil, floor);
+
+ /* FF.F, carry out of ceil */
+ EXP(src) = 2;
+ SIZ(src) = 3;
+ PTR(src)[0] = GMP_NUMB_MAX;
+ PTR(src)[1] = GMP_NUMB_MAX;
+ PTR(src)[2] = GMP_NUMB_MAX;
+ EXP(trunc) = 2;
+ SIZ(trunc) = 2;
+ PTR(trunc)[0] = GMP_NUMB_MAX;
+ PTR(trunc)[1] = GMP_NUMB_MAX;
+ mpf_set (floor, trunc);
+ EXP(ceil) = 3;
+ SIZ(ceil) = 1;
+ PTR(ceil)[0] = 1;
+ check_all (src, trunc, ceil, floor);
+
+ mpf_clear (src);
+ mpf_clear (trunc);
+ mpf_clear (ceil);
+ mpf_clear (floor);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_various ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpf/t-ui_div.c b/vendor/gmp-6.3.0/tests/mpf/t-ui_div.c
new file mode 100644
index 0000000..4b86215
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpf/t-ui_div.c
@@ -0,0 +1,151 @@
+/* Test mpf_ui_div.
+
+Copyright 2004 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_one (const char *desc, mpf_ptr got, unsigned long u, mpf_srcptr v)
+{
+ mpf_t uf;
+ mp_limb_t ulimbs[2];
+ mp_size_t usize;
+
+ ulimbs[0] = u & GMP_NUMB_MASK;
+ usize = (u != 0);
+#if BITS_PER_ULONG > GMP_NUMB_BITS
+ u >>= GMP_NUMB_BITS;
+ ulimbs[1] = u;
+ usize += (u != 0);
+#endif
+ PTR(uf) = ulimbs;
+ SIZ(uf) = usize;
+ EXP(uf) = usize;
+
+ if (! refmpf_validate_division ("mpf_ui_div", got, uf, v))
+ {
+ mp_trace_base = -16;
+ printf (" u 0x%lX (%lu)\n", u, u);
+ mpf_trace (" v", v);
+ printf (" %s\n", desc);
+ abort ();
+ }
+}
+
+void
+check_rand (void)
+{
+ unsigned long min_prec = __GMPF_BITS_TO_PREC (1);
+ gmp_randstate_ptr rands = RANDS;
+ unsigned long prec, u;
+ mpf_t got, v;
+ int i;
+
+ mpf_init (got);
+ mpf_init (v);
+
+ for (i = 0; i < 200; i++)
+ {
+ /* got precision */
+ prec = min_prec + gmp_urandomm_ui (rands, 15L);
+ refmpf_set_prec_limbs (got, prec);
+
+ /* u */
+ prec = gmp_urandomm_ui (rands, BITS_PER_ULONG+1);
+ u = gmp_urandomb_ui (rands, prec);
+
+ /* v precision */
+ prec = min_prec + gmp_urandomm_ui (rands, 15L);
+ refmpf_set_prec_limbs (v, prec);
+
+ /* v, non-zero */
+ do {
+ mpf_random2 (v, PREC(v), (mp_exp_t) 20);
+ } while (SIZ(v) == 0);
+
+ /* v possibly negative */
+ if (gmp_urandomb_ui (rands, 1L))
+ mpf_neg (v, v);
+
+ if ((i % 2) == 0)
+ {
+ /* src != dst */
+ mpf_ui_div (got, u, v);
+ check_one ("separate", got, u, v);
+ }
+ else
+ {
+ /* src == dst */
+ prec = refmpf_set_overlap (got, v);
+ mpf_ui_div (got, u, got);
+ check_one ("overlap src==dst", got, u, v);
+
+ mpf_set_prec_raw (got, prec);
+ }
+ }
+
+ mpf_clear (got);
+ mpf_clear (v);
+}
+
+void
+check_various (void)
+{
+ mpf_t got, v;
+
+ mpf_init (got);
+ mpf_init (v);
+
+ /* 100/4 == 25 */
+ mpf_set_prec (got, 20L);
+ mpf_set_ui (v, 4L);
+ mpf_ui_div (got, 100L, v);
+ MPF_CHECK_FORMAT (got);
+ ASSERT_ALWAYS (mpf_cmp_ui (got, 25L) == 0);
+
+ {
+ /* 1/(2^n+1), a case where truncating the divisor would be wrong */
+ unsigned long u = 1L;
+ mpf_set_prec (got, 500L);
+ mpf_set_prec (v, 900L);
+ mpf_set_ui (v, 1L);
+ mpf_mul_2exp (v, v, 800L);
+ mpf_add_ui (v, v, 1L);
+ mpf_ui_div (got, u, v);
+ check_one ("1/2^n+1, separate", got, u, v);
+ }
+
+ mpf_clear (got);
+ mpf_clear (v);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_various ();
+ check_rand ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/Makefile.am b/vendor/gmp-6.3.0/tests/mpn/Makefile.am
new file mode 100644
index 0000000..0e979a3
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/Makefile.am
@@ -0,0 +1,40 @@
+## Process this file with automake to generate Makefile.in
+
+# Copyright 2001-2003, 2009-2014, 2018, 2019, 2021, 2022 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+
+
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
+AM_LDFLAGS = -no-install
+LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
+
+check_PROGRAMS = t-asmtype t-aors_1 t-divrem_1 t-mod_1 t-fat t-get_d \
+ t-instrument t-iord_u t-mp_bases t-perfsqr t-scan logic \
+ t-toom22 t-toom32 t-toom33 t-toom42 t-toom43 t-toom44 \
+ t-toom52 t-toom53 t-toom54 t-toom62 t-toom63 t-toom6h t-toom8h \
+ t-toom2-sqr t-toom3-sqr t-toom4-sqr t-toom6-sqr t-toom8-sqr \
+ t-div t-mul t-mullo t-sqrlo t-mulmod_bnm1 t-sqrmod_bnm1 t-mulmid \
+ t-mulmod_bknp1 t-sqrmod_bknp1 \
+ t-addaddmul t-hgcd t-hgcd_appr t-matrix22 t-invert t-bdiv t-fib2m \
+ t-broot t-brootinv t-minvert t-sizeinbase t-gcd_11 t-gcd_22 t-gcdext_1
+
+EXTRA_DIST = toom-shared.h toom-sqr-shared.h
+
+TESTS = $(check_PROGRAMS)
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
diff --git a/vendor/gmp-6.3.0/tests/mpn/Makefile.in b/vendor/gmp-6.3.0/tests/mpn/Makefile.in
new file mode 100644
index 0000000..2f168c5
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/Makefile.in
@@ -0,0 +1,1874 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 2001-2003, 2009-2014, 2018, 2019, 2021, 2022 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+check_PROGRAMS = t-asmtype$(EXEEXT) t-aors_1$(EXEEXT) \
+ t-divrem_1$(EXEEXT) t-mod_1$(EXEEXT) t-fat$(EXEEXT) \
+ t-get_d$(EXEEXT) t-instrument$(EXEEXT) t-iord_u$(EXEEXT) \
+ t-mp_bases$(EXEEXT) t-perfsqr$(EXEEXT) t-scan$(EXEEXT) \
+ logic$(EXEEXT) t-toom22$(EXEEXT) t-toom32$(EXEEXT) \
+ t-toom33$(EXEEXT) t-toom42$(EXEEXT) t-toom43$(EXEEXT) \
+ t-toom44$(EXEEXT) t-toom52$(EXEEXT) t-toom53$(EXEEXT) \
+ t-toom54$(EXEEXT) t-toom62$(EXEEXT) t-toom63$(EXEEXT) \
+ t-toom6h$(EXEEXT) t-toom8h$(EXEEXT) t-toom2-sqr$(EXEEXT) \
+ t-toom3-sqr$(EXEEXT) t-toom4-sqr$(EXEEXT) t-toom6-sqr$(EXEEXT) \
+ t-toom8-sqr$(EXEEXT) t-div$(EXEEXT) t-mul$(EXEEXT) \
+ t-mullo$(EXEEXT) t-sqrlo$(EXEEXT) t-mulmod_bnm1$(EXEEXT) \
+ t-sqrmod_bnm1$(EXEEXT) t-mulmid$(EXEEXT) \
+ t-mulmod_bknp1$(EXEEXT) t-sqrmod_bknp1$(EXEEXT) \
+ t-addaddmul$(EXEEXT) t-hgcd$(EXEEXT) t-hgcd_appr$(EXEEXT) \
+ t-matrix22$(EXEEXT) t-invert$(EXEEXT) t-bdiv$(EXEEXT) \
+ t-fib2m$(EXEEXT) t-broot$(EXEEXT) t-brootinv$(EXEEXT) \
+ t-minvert$(EXEEXT) t-sizeinbase$(EXEEXT) t-gcd_11$(EXEEXT) \
+ t-gcd_22$(EXEEXT) t-gcdext_1$(EXEEXT)
+subdir = tests/mpn
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+logic_SOURCES = logic.c
+logic_OBJECTS = logic.$(OBJEXT)
+logic_LDADD = $(LDADD)
+logic_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+t_addaddmul_SOURCES = t-addaddmul.c
+t_addaddmul_OBJECTS = t-addaddmul.$(OBJEXT)
+t_addaddmul_LDADD = $(LDADD)
+t_addaddmul_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_aors_1_SOURCES = t-aors_1.c
+t_aors_1_OBJECTS = t-aors_1.$(OBJEXT)
+t_aors_1_LDADD = $(LDADD)
+t_aors_1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_asmtype_SOURCES = t-asmtype.c
+t_asmtype_OBJECTS = t-asmtype.$(OBJEXT)
+t_asmtype_LDADD = $(LDADD)
+t_asmtype_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_bdiv_SOURCES = t-bdiv.c
+t_bdiv_OBJECTS = t-bdiv.$(OBJEXT)
+t_bdiv_LDADD = $(LDADD)
+t_bdiv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_broot_SOURCES = t-broot.c
+t_broot_OBJECTS = t-broot.$(OBJEXT)
+t_broot_LDADD = $(LDADD)
+t_broot_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_brootinv_SOURCES = t-brootinv.c
+t_brootinv_OBJECTS = t-brootinv.$(OBJEXT)
+t_brootinv_LDADD = $(LDADD)
+t_brootinv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_div_SOURCES = t-div.c
+t_div_OBJECTS = t-div.$(OBJEXT)
+t_div_LDADD = $(LDADD)
+t_div_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_divrem_1_SOURCES = t-divrem_1.c
+t_divrem_1_OBJECTS = t-divrem_1.$(OBJEXT)
+t_divrem_1_LDADD = $(LDADD)
+t_divrem_1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_fat_SOURCES = t-fat.c
+t_fat_OBJECTS = t-fat.$(OBJEXT)
+t_fat_LDADD = $(LDADD)
+t_fat_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_fib2m_SOURCES = t-fib2m.c
+t_fib2m_OBJECTS = t-fib2m.$(OBJEXT)
+t_fib2m_LDADD = $(LDADD)
+t_fib2m_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_gcd_11_SOURCES = t-gcd_11.c
+t_gcd_11_OBJECTS = t-gcd_11.$(OBJEXT)
+t_gcd_11_LDADD = $(LDADD)
+t_gcd_11_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_gcd_22_SOURCES = t-gcd_22.c
+t_gcd_22_OBJECTS = t-gcd_22.$(OBJEXT)
+t_gcd_22_LDADD = $(LDADD)
+t_gcd_22_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_gcdext_1_SOURCES = t-gcdext_1.c
+t_gcdext_1_OBJECTS = t-gcdext_1.$(OBJEXT)
+t_gcdext_1_LDADD = $(LDADD)
+t_gcdext_1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_get_d_SOURCES = t-get_d.c
+t_get_d_OBJECTS = t-get_d.$(OBJEXT)
+t_get_d_LDADD = $(LDADD)
+t_get_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_hgcd_SOURCES = t-hgcd.c
+t_hgcd_OBJECTS = t-hgcd.$(OBJEXT)
+t_hgcd_LDADD = $(LDADD)
+t_hgcd_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_hgcd_appr_SOURCES = t-hgcd_appr.c
+t_hgcd_appr_OBJECTS = t-hgcd_appr.$(OBJEXT)
+t_hgcd_appr_LDADD = $(LDADD)
+t_hgcd_appr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_instrument_SOURCES = t-instrument.c
+t_instrument_OBJECTS = t-instrument.$(OBJEXT)
+t_instrument_LDADD = $(LDADD)
+t_instrument_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_invert_SOURCES = t-invert.c
+t_invert_OBJECTS = t-invert.$(OBJEXT)
+t_invert_LDADD = $(LDADD)
+t_invert_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_iord_u_SOURCES = t-iord_u.c
+t_iord_u_OBJECTS = t-iord_u.$(OBJEXT)
+t_iord_u_LDADD = $(LDADD)
+t_iord_u_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_matrix22_SOURCES = t-matrix22.c
+t_matrix22_OBJECTS = t-matrix22.$(OBJEXT)
+t_matrix22_LDADD = $(LDADD)
+t_matrix22_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_minvert_SOURCES = t-minvert.c
+t_minvert_OBJECTS = t-minvert.$(OBJEXT)
+t_minvert_LDADD = $(LDADD)
+t_minvert_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_mod_1_SOURCES = t-mod_1.c
+t_mod_1_OBJECTS = t-mod_1.$(OBJEXT)
+t_mod_1_LDADD = $(LDADD)
+t_mod_1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_mp_bases_SOURCES = t-mp_bases.c
+t_mp_bases_OBJECTS = t-mp_bases.$(OBJEXT)
+t_mp_bases_LDADD = $(LDADD)
+t_mp_bases_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_mul_SOURCES = t-mul.c
+t_mul_OBJECTS = t-mul.$(OBJEXT)
+t_mul_LDADD = $(LDADD)
+t_mul_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_mullo_SOURCES = t-mullo.c
+t_mullo_OBJECTS = t-mullo.$(OBJEXT)
+t_mullo_LDADD = $(LDADD)
+t_mullo_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_mulmid_SOURCES = t-mulmid.c
+t_mulmid_OBJECTS = t-mulmid.$(OBJEXT)
+t_mulmid_LDADD = $(LDADD)
+t_mulmid_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_mulmod_bknp1_SOURCES = t-mulmod_bknp1.c
+t_mulmod_bknp1_OBJECTS = t-mulmod_bknp1.$(OBJEXT)
+t_mulmod_bknp1_LDADD = $(LDADD)
+t_mulmod_bknp1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_mulmod_bnm1_SOURCES = t-mulmod_bnm1.c
+t_mulmod_bnm1_OBJECTS = t-mulmod_bnm1.$(OBJEXT)
+t_mulmod_bnm1_LDADD = $(LDADD)
+t_mulmod_bnm1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_perfsqr_SOURCES = t-perfsqr.c
+t_perfsqr_OBJECTS = t-perfsqr.$(OBJEXT)
+t_perfsqr_LDADD = $(LDADD)
+t_perfsqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_scan_SOURCES = t-scan.c
+t_scan_OBJECTS = t-scan.$(OBJEXT)
+t_scan_LDADD = $(LDADD)
+t_scan_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_sizeinbase_SOURCES = t-sizeinbase.c
+t_sizeinbase_OBJECTS = t-sizeinbase.$(OBJEXT)
+t_sizeinbase_LDADD = $(LDADD)
+t_sizeinbase_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_sqrlo_SOURCES = t-sqrlo.c
+t_sqrlo_OBJECTS = t-sqrlo.$(OBJEXT)
+t_sqrlo_LDADD = $(LDADD)
+t_sqrlo_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_sqrmod_bknp1_SOURCES = t-sqrmod_bknp1.c
+t_sqrmod_bknp1_OBJECTS = t-sqrmod_bknp1.$(OBJEXT)
+t_sqrmod_bknp1_LDADD = $(LDADD)
+t_sqrmod_bknp1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_sqrmod_bnm1_SOURCES = t-sqrmod_bnm1.c
+t_sqrmod_bnm1_OBJECTS = t-sqrmod_bnm1.$(OBJEXT)
+t_sqrmod_bnm1_LDADD = $(LDADD)
+t_sqrmod_bnm1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_toom2_sqr_SOURCES = t-toom2-sqr.c
+t_toom2_sqr_OBJECTS = t-toom2-sqr.$(OBJEXT)
+t_toom2_sqr_LDADD = $(LDADD)
+t_toom2_sqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_toom22_SOURCES = t-toom22.c
+t_toom22_OBJECTS = t-toom22.$(OBJEXT)
+t_toom22_LDADD = $(LDADD)
+t_toom22_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_toom3_sqr_SOURCES = t-toom3-sqr.c
+t_toom3_sqr_OBJECTS = t-toom3-sqr.$(OBJEXT)
+t_toom3_sqr_LDADD = $(LDADD)
+t_toom3_sqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_toom32_SOURCES = t-toom32.c
+t_toom32_OBJECTS = t-toom32.$(OBJEXT)
+t_toom32_LDADD = $(LDADD)
+t_toom32_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_toom33_SOURCES = t-toom33.c
+t_toom33_OBJECTS = t-toom33.$(OBJEXT)
+t_toom33_LDADD = $(LDADD)
+t_toom33_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_toom4_sqr_SOURCES = t-toom4-sqr.c
+t_toom4_sqr_OBJECTS = t-toom4-sqr.$(OBJEXT)
+t_toom4_sqr_LDADD = $(LDADD)
+t_toom4_sqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_toom42_SOURCES = t-toom42.c
+t_toom42_OBJECTS = t-toom42.$(OBJEXT)
+t_toom42_LDADD = $(LDADD)
+t_toom42_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_toom43_SOURCES = t-toom43.c
+t_toom43_OBJECTS = t-toom43.$(OBJEXT)
+t_toom43_LDADD = $(LDADD)
+t_toom43_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_toom44_SOURCES = t-toom44.c
+t_toom44_OBJECTS = t-toom44.$(OBJEXT)
+t_toom44_LDADD = $(LDADD)
+t_toom44_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_toom52_SOURCES = t-toom52.c
+t_toom52_OBJECTS = t-toom52.$(OBJEXT)
+t_toom52_LDADD = $(LDADD)
+t_toom52_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_toom53_SOURCES = t-toom53.c
+t_toom53_OBJECTS = t-toom53.$(OBJEXT)
+t_toom53_LDADD = $(LDADD)
+t_toom53_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_toom54_SOURCES = t-toom54.c
+t_toom54_OBJECTS = t-toom54.$(OBJEXT)
+t_toom54_LDADD = $(LDADD)
+t_toom54_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_toom6_sqr_SOURCES = t-toom6-sqr.c
+t_toom6_sqr_OBJECTS = t-toom6-sqr.$(OBJEXT)
+t_toom6_sqr_LDADD = $(LDADD)
+t_toom6_sqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_toom62_SOURCES = t-toom62.c
+t_toom62_OBJECTS = t-toom62.$(OBJEXT)
+t_toom62_LDADD = $(LDADD)
+t_toom62_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_toom63_SOURCES = t-toom63.c
+t_toom63_OBJECTS = t-toom63.$(OBJEXT)
+t_toom63_LDADD = $(LDADD)
+t_toom63_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_toom6h_SOURCES = t-toom6h.c
+t_toom6h_OBJECTS = t-toom6h.$(OBJEXT)
+t_toom6h_LDADD = $(LDADD)
+t_toom6h_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_toom8_sqr_SOURCES = t-toom8-sqr.c
+t_toom8_sqr_OBJECTS = t-toom8-sqr.$(OBJEXT)
+t_toom8_sqr_LDADD = $(LDADD)
+t_toom8_sqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_toom8h_SOURCES = t-toom8h.c
+t_toom8h_OBJECTS = t-toom8h.$(OBJEXT)
+t_toom8h_LDADD = $(LDADD)
+t_toom8h_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = logic.c t-addaddmul.c t-aors_1.c t-asmtype.c t-bdiv.c \
+ t-broot.c t-brootinv.c t-div.c t-divrem_1.c t-fat.c t-fib2m.c \
+ t-gcd_11.c t-gcd_22.c t-gcdext_1.c t-get_d.c t-hgcd.c \
+ t-hgcd_appr.c t-instrument.c t-invert.c t-iord_u.c \
+ t-matrix22.c t-minvert.c t-mod_1.c t-mp_bases.c t-mul.c \
+ t-mullo.c t-mulmid.c t-mulmod_bknp1.c t-mulmod_bnm1.c \
+ t-perfsqr.c t-scan.c t-sizeinbase.c t-sqrlo.c t-sqrmod_bknp1.c \
+ t-sqrmod_bnm1.c t-toom2-sqr.c t-toom22.c t-toom3-sqr.c \
+ t-toom32.c t-toom33.c t-toom4-sqr.c t-toom42.c t-toom43.c \
+ t-toom44.c t-toom52.c t-toom53.c t-toom54.c t-toom6-sqr.c \
+ t-toom62.c t-toom63.c t-toom6h.c t-toom8-sqr.c t-toom8h.c
+DIST_SOURCES = logic.c t-addaddmul.c t-aors_1.c t-asmtype.c t-bdiv.c \
+ t-broot.c t-brootinv.c t-div.c t-divrem_1.c t-fat.c t-fib2m.c \
+ t-gcd_11.c t-gcd_22.c t-gcdext_1.c t-get_d.c t-hgcd.c \
+ t-hgcd_appr.c t-instrument.c t-invert.c t-iord_u.c \
+ t-matrix22.c t-minvert.c t-mod_1.c t-mp_bases.c t-mul.c \
+ t-mullo.c t-mulmid.c t-mulmod_bknp1.c t-mulmod_bnm1.c \
+ t-perfsqr.c t-scan.c t-sizeinbase.c t-sqrlo.c t-sqrmod_bknp1.c \
+ t-sqrmod_bnm1.c t-toom2-sqr.c t-toom22.c t-toom3-sqr.c \
+ t-toom32.c t-toom33.c t-toom4-sqr.c t-toom42.c t-toom43.c \
+ t-toom44.c t-toom52.c t-toom53.c t-toom54.c t-toom6-sqr.c \
+ t-toom62.c t-toom63.c t-toom6h.c t-toom8-sqr.c t-toom8h.c
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = { \
+ $(am__tty_colors_dummy); \
+ if test "X$(AM_COLOR_TESTS)" = Xno; then \
+ am__color_tests=no; \
+ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+ am__color_tests=yes; \
+ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+ am__color_tests=yes; \
+ fi; \
+ if test $$am__color_tests = yes; then \
+ red=''; \
+ grn=''; \
+ lgn=''; \
+ blu=''; \
+ mgn=''; \
+ brg=''; \
+ std=''; \
+ fi; \
+}
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__recheck_rx = ^[ ]*:recheck:[ ]*
+am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
+am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+ recheck = 1; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ { \
+ if ((getline line2 < ($$0 ".log")) < 0) \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+ { \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+ { \
+ break; \
+ } \
+ }; \
+ if (recheck) \
+ print $$0; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+ print "fatal: making $@: " msg | "cat >&2"; \
+ exit 1; \
+} \
+function rst_section(header) \
+{ \
+ print header; \
+ len = length(header); \
+ for (i = 1; i <= len; i = i + 1) \
+ printf "="; \
+ printf "\n\n"; \
+} \
+{ \
+ copy_in_global_log = 1; \
+ global_test_result = "RUN"; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".trs"); \
+ if (line ~ /$(am__global_test_result_rx)/) \
+ { \
+ sub("$(am__global_test_result_rx)", "", line); \
+ sub("[ ]*$$", "", line); \
+ global_test_result = line; \
+ } \
+ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+ copy_in_global_log = 0; \
+ }; \
+ if (copy_in_global_log) \
+ { \
+ rst_section(global_test_result ": " $$0); \
+ while ((rc = (getline line < ($$0 ".log"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".log"); \
+ print line; \
+ }; \
+ printf "\n"; \
+ }; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+ --color-tests "$$am__color_tests" \
+ --enable-hard-errors "$$am__enable_hard_errors" \
+ --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test. Creates the
+# directory for the log if needed. Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log. Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT. Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup); \
+$(am__vpath_adj_setup) $(am__vpath_adj) \
+$(am__tty_colors); \
+srcdir=$(srcdir); export srcdir; \
+case "$@" in \
+ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \
+ *) am__odir=.;; \
+esac; \
+test "x$$am__odir" = x"." || test -d "$$am__odir" \
+ || $(MKDIR_P) "$$am__odir" || exit $$?; \
+if test -f "./$$f"; then dir=./; \
+elif test -f "$$f"; then dir=; \
+else dir="$(srcdir)/"; fi; \
+tst=$$dir$$f; log='$@'; \
+if test -n '$(DISABLE_HARD_ERRORS)'; then \
+ am__enable_hard_errors=no; \
+else \
+ am__enable_hard_errors=yes; \
+fi; \
+case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
+ am__expect_failure=yes;; \
+ *) \
+ am__expect_failure=no;; \
+esac; \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed). The result is saved in the shell variable
+# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+ bases='$(TEST_LOGS)'; \
+ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+ bases=`echo $$bases`
+RECHECK_LOGS = $(TEST_LOGS)
+AM_RECURSIVE_TARGETS = check recheck
+TEST_SUITE_LOG = test-suite.log
+TEST_EXTENSIONS = @EXEEXT@ .test
+LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
+am__set_b = \
+ case '$@' in \
+ */*) \
+ case '$*' in \
+ */*) b='$*';; \
+ *) b=`echo '$@' | sed 's/\.log$$//'`; \
+ esac;; \
+ *) \
+ b='$*';; \
+ esac
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+ $(TEST_LOG_FLAGS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/test-driver
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ABI = @ABI@
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+ASMFLAGS = @ASMFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
+CC = @CC@
+CCAS = @CCAS@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPP_FOR_BUILD = @CPP_FOR_BUILD@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
+DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
+FGREP = @FGREP@
+GMP_LDFLAGS = @GMP_LDFLAGS@
+GMP_LIMB_BITS = @GMP_LIMB_BITS@
+GMP_NAIL_BITS = @GMP_NAIL_BITS@
+GREP = @GREP@
+HAVE_CLOCK_01 = @HAVE_CLOCK_01@
+HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@
+HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@
+HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@
+HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@
+HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@
+HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@
+HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
+HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
+HAVE_STACK_T_01 = @HAVE_STACK_T_01@
+HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBCURSES = @LIBCURSES@
+LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@
+LIBGMP_DLL = @LIBGMP_DLL@
+LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@
+LIBM = @LIBM@
+LIBM_FOR_BUILD = @LIBM_FOR_BUILD@
+LIBOBJS = @LIBOBJS@
+LIBREADLINE = @LIBREADLINE@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+M4 = @M4@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
+STRIP = @STRIP@
+TAL_OBJECT = @TAL_OBJECT@
+TUNE_LIBS = @TUNE_LIBS@
+TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U_FOR_BUILD = @U_FOR_BUILD@
+VERSION = @VERSION@
+WITH_READLINE_01 = @WITH_READLINE_01@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gmp_srclinks = @gmp_srclinks@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mpn_objects = @mpn_objects@
+mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
+AM_LDFLAGS = -no-install
+LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
+EXTRA_DIST = toom-shared.h toom-sqr-shared.h
+TESTS = $(check_PROGRAMS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/mpn/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/mpn/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+logic$(EXEEXT): $(logic_OBJECTS) $(logic_DEPENDENCIES) $(EXTRA_logic_DEPENDENCIES)
+ @rm -f logic$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(logic_OBJECTS) $(logic_LDADD) $(LIBS)
+
+t-addaddmul$(EXEEXT): $(t_addaddmul_OBJECTS) $(t_addaddmul_DEPENDENCIES) $(EXTRA_t_addaddmul_DEPENDENCIES)
+ @rm -f t-addaddmul$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_addaddmul_OBJECTS) $(t_addaddmul_LDADD) $(LIBS)
+
+t-aors_1$(EXEEXT): $(t_aors_1_OBJECTS) $(t_aors_1_DEPENDENCIES) $(EXTRA_t_aors_1_DEPENDENCIES)
+ @rm -f t-aors_1$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_aors_1_OBJECTS) $(t_aors_1_LDADD) $(LIBS)
+
+t-asmtype$(EXEEXT): $(t_asmtype_OBJECTS) $(t_asmtype_DEPENDENCIES) $(EXTRA_t_asmtype_DEPENDENCIES)
+ @rm -f t-asmtype$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_asmtype_OBJECTS) $(t_asmtype_LDADD) $(LIBS)
+
+t-bdiv$(EXEEXT): $(t_bdiv_OBJECTS) $(t_bdiv_DEPENDENCIES) $(EXTRA_t_bdiv_DEPENDENCIES)
+ @rm -f t-bdiv$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_bdiv_OBJECTS) $(t_bdiv_LDADD) $(LIBS)
+
+t-broot$(EXEEXT): $(t_broot_OBJECTS) $(t_broot_DEPENDENCIES) $(EXTRA_t_broot_DEPENDENCIES)
+ @rm -f t-broot$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_broot_OBJECTS) $(t_broot_LDADD) $(LIBS)
+
+t-brootinv$(EXEEXT): $(t_brootinv_OBJECTS) $(t_brootinv_DEPENDENCIES) $(EXTRA_t_brootinv_DEPENDENCIES)
+ @rm -f t-brootinv$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_brootinv_OBJECTS) $(t_brootinv_LDADD) $(LIBS)
+
+t-div$(EXEEXT): $(t_div_OBJECTS) $(t_div_DEPENDENCIES) $(EXTRA_t_div_DEPENDENCIES)
+ @rm -f t-div$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_div_OBJECTS) $(t_div_LDADD) $(LIBS)
+
+t-divrem_1$(EXEEXT): $(t_divrem_1_OBJECTS) $(t_divrem_1_DEPENDENCIES) $(EXTRA_t_divrem_1_DEPENDENCIES)
+ @rm -f t-divrem_1$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_divrem_1_OBJECTS) $(t_divrem_1_LDADD) $(LIBS)
+
+t-fat$(EXEEXT): $(t_fat_OBJECTS) $(t_fat_DEPENDENCIES) $(EXTRA_t_fat_DEPENDENCIES)
+ @rm -f t-fat$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_fat_OBJECTS) $(t_fat_LDADD) $(LIBS)
+
+t-fib2m$(EXEEXT): $(t_fib2m_OBJECTS) $(t_fib2m_DEPENDENCIES) $(EXTRA_t_fib2m_DEPENDENCIES)
+ @rm -f t-fib2m$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_fib2m_OBJECTS) $(t_fib2m_LDADD) $(LIBS)
+
+t-gcd_11$(EXEEXT): $(t_gcd_11_OBJECTS) $(t_gcd_11_DEPENDENCIES) $(EXTRA_t_gcd_11_DEPENDENCIES)
+ @rm -f t-gcd_11$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_gcd_11_OBJECTS) $(t_gcd_11_LDADD) $(LIBS)
+
+t-gcd_22$(EXEEXT): $(t_gcd_22_OBJECTS) $(t_gcd_22_DEPENDENCIES) $(EXTRA_t_gcd_22_DEPENDENCIES)
+ @rm -f t-gcd_22$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_gcd_22_OBJECTS) $(t_gcd_22_LDADD) $(LIBS)
+
+t-gcdext_1$(EXEEXT): $(t_gcdext_1_OBJECTS) $(t_gcdext_1_DEPENDENCIES) $(EXTRA_t_gcdext_1_DEPENDENCIES)
+ @rm -f t-gcdext_1$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_gcdext_1_OBJECTS) $(t_gcdext_1_LDADD) $(LIBS)
+
+t-get_d$(EXEEXT): $(t_get_d_OBJECTS) $(t_get_d_DEPENDENCIES) $(EXTRA_t_get_d_DEPENDENCIES)
+ @rm -f t-get_d$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_get_d_OBJECTS) $(t_get_d_LDADD) $(LIBS)
+
+t-hgcd$(EXEEXT): $(t_hgcd_OBJECTS) $(t_hgcd_DEPENDENCIES) $(EXTRA_t_hgcd_DEPENDENCIES)
+ @rm -f t-hgcd$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_hgcd_OBJECTS) $(t_hgcd_LDADD) $(LIBS)
+
+t-hgcd_appr$(EXEEXT): $(t_hgcd_appr_OBJECTS) $(t_hgcd_appr_DEPENDENCIES) $(EXTRA_t_hgcd_appr_DEPENDENCIES)
+ @rm -f t-hgcd_appr$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_hgcd_appr_OBJECTS) $(t_hgcd_appr_LDADD) $(LIBS)
+
+t-instrument$(EXEEXT): $(t_instrument_OBJECTS) $(t_instrument_DEPENDENCIES) $(EXTRA_t_instrument_DEPENDENCIES)
+ @rm -f t-instrument$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_instrument_OBJECTS) $(t_instrument_LDADD) $(LIBS)
+
+t-invert$(EXEEXT): $(t_invert_OBJECTS) $(t_invert_DEPENDENCIES) $(EXTRA_t_invert_DEPENDENCIES)
+ @rm -f t-invert$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_invert_OBJECTS) $(t_invert_LDADD) $(LIBS)
+
+t-iord_u$(EXEEXT): $(t_iord_u_OBJECTS) $(t_iord_u_DEPENDENCIES) $(EXTRA_t_iord_u_DEPENDENCIES)
+ @rm -f t-iord_u$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_iord_u_OBJECTS) $(t_iord_u_LDADD) $(LIBS)
+
+t-matrix22$(EXEEXT): $(t_matrix22_OBJECTS) $(t_matrix22_DEPENDENCIES) $(EXTRA_t_matrix22_DEPENDENCIES)
+ @rm -f t-matrix22$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_matrix22_OBJECTS) $(t_matrix22_LDADD) $(LIBS)
+
+t-minvert$(EXEEXT): $(t_minvert_OBJECTS) $(t_minvert_DEPENDENCIES) $(EXTRA_t_minvert_DEPENDENCIES)
+ @rm -f t-minvert$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_minvert_OBJECTS) $(t_minvert_LDADD) $(LIBS)
+
+t-mod_1$(EXEEXT): $(t_mod_1_OBJECTS) $(t_mod_1_DEPENDENCIES) $(EXTRA_t_mod_1_DEPENDENCIES)
+ @rm -f t-mod_1$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_mod_1_OBJECTS) $(t_mod_1_LDADD) $(LIBS)
+
+t-mp_bases$(EXEEXT): $(t_mp_bases_OBJECTS) $(t_mp_bases_DEPENDENCIES) $(EXTRA_t_mp_bases_DEPENDENCIES)
+ @rm -f t-mp_bases$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_mp_bases_OBJECTS) $(t_mp_bases_LDADD) $(LIBS)
+
+t-mul$(EXEEXT): $(t_mul_OBJECTS) $(t_mul_DEPENDENCIES) $(EXTRA_t_mul_DEPENDENCIES)
+ @rm -f t-mul$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_mul_OBJECTS) $(t_mul_LDADD) $(LIBS)
+
+t-mullo$(EXEEXT): $(t_mullo_OBJECTS) $(t_mullo_DEPENDENCIES) $(EXTRA_t_mullo_DEPENDENCIES)
+ @rm -f t-mullo$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_mullo_OBJECTS) $(t_mullo_LDADD) $(LIBS)
+
+t-mulmid$(EXEEXT): $(t_mulmid_OBJECTS) $(t_mulmid_DEPENDENCIES) $(EXTRA_t_mulmid_DEPENDENCIES)
+ @rm -f t-mulmid$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_mulmid_OBJECTS) $(t_mulmid_LDADD) $(LIBS)
+
+t-mulmod_bknp1$(EXEEXT): $(t_mulmod_bknp1_OBJECTS) $(t_mulmod_bknp1_DEPENDENCIES) $(EXTRA_t_mulmod_bknp1_DEPENDENCIES)
+ @rm -f t-mulmod_bknp1$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_mulmod_bknp1_OBJECTS) $(t_mulmod_bknp1_LDADD) $(LIBS)
+
+t-mulmod_bnm1$(EXEEXT): $(t_mulmod_bnm1_OBJECTS) $(t_mulmod_bnm1_DEPENDENCIES) $(EXTRA_t_mulmod_bnm1_DEPENDENCIES)
+ @rm -f t-mulmod_bnm1$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_mulmod_bnm1_OBJECTS) $(t_mulmod_bnm1_LDADD) $(LIBS)
+
+t-perfsqr$(EXEEXT): $(t_perfsqr_OBJECTS) $(t_perfsqr_DEPENDENCIES) $(EXTRA_t_perfsqr_DEPENDENCIES)
+ @rm -f t-perfsqr$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_perfsqr_OBJECTS) $(t_perfsqr_LDADD) $(LIBS)
+
+t-scan$(EXEEXT): $(t_scan_OBJECTS) $(t_scan_DEPENDENCIES) $(EXTRA_t_scan_DEPENDENCIES)
+ @rm -f t-scan$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_scan_OBJECTS) $(t_scan_LDADD) $(LIBS)
+
+t-sizeinbase$(EXEEXT): $(t_sizeinbase_OBJECTS) $(t_sizeinbase_DEPENDENCIES) $(EXTRA_t_sizeinbase_DEPENDENCIES)
+ @rm -f t-sizeinbase$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_sizeinbase_OBJECTS) $(t_sizeinbase_LDADD) $(LIBS)
+
+t-sqrlo$(EXEEXT): $(t_sqrlo_OBJECTS) $(t_sqrlo_DEPENDENCIES) $(EXTRA_t_sqrlo_DEPENDENCIES)
+ @rm -f t-sqrlo$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_sqrlo_OBJECTS) $(t_sqrlo_LDADD) $(LIBS)
+
+t-sqrmod_bknp1$(EXEEXT): $(t_sqrmod_bknp1_OBJECTS) $(t_sqrmod_bknp1_DEPENDENCIES) $(EXTRA_t_sqrmod_bknp1_DEPENDENCIES)
+ @rm -f t-sqrmod_bknp1$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_sqrmod_bknp1_OBJECTS) $(t_sqrmod_bknp1_LDADD) $(LIBS)
+
+t-sqrmod_bnm1$(EXEEXT): $(t_sqrmod_bnm1_OBJECTS) $(t_sqrmod_bnm1_DEPENDENCIES) $(EXTRA_t_sqrmod_bnm1_DEPENDENCIES)
+ @rm -f t-sqrmod_bnm1$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_sqrmod_bnm1_OBJECTS) $(t_sqrmod_bnm1_LDADD) $(LIBS)
+
+t-toom2-sqr$(EXEEXT): $(t_toom2_sqr_OBJECTS) $(t_toom2_sqr_DEPENDENCIES) $(EXTRA_t_toom2_sqr_DEPENDENCIES)
+ @rm -f t-toom2-sqr$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_toom2_sqr_OBJECTS) $(t_toom2_sqr_LDADD) $(LIBS)
+
+t-toom22$(EXEEXT): $(t_toom22_OBJECTS) $(t_toom22_DEPENDENCIES) $(EXTRA_t_toom22_DEPENDENCIES)
+ @rm -f t-toom22$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_toom22_OBJECTS) $(t_toom22_LDADD) $(LIBS)
+
+t-toom3-sqr$(EXEEXT): $(t_toom3_sqr_OBJECTS) $(t_toom3_sqr_DEPENDENCIES) $(EXTRA_t_toom3_sqr_DEPENDENCIES)
+ @rm -f t-toom3-sqr$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_toom3_sqr_OBJECTS) $(t_toom3_sqr_LDADD) $(LIBS)
+
+t-toom32$(EXEEXT): $(t_toom32_OBJECTS) $(t_toom32_DEPENDENCIES) $(EXTRA_t_toom32_DEPENDENCIES)
+ @rm -f t-toom32$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_toom32_OBJECTS) $(t_toom32_LDADD) $(LIBS)
+
+t-toom33$(EXEEXT): $(t_toom33_OBJECTS) $(t_toom33_DEPENDENCIES) $(EXTRA_t_toom33_DEPENDENCIES)
+ @rm -f t-toom33$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_toom33_OBJECTS) $(t_toom33_LDADD) $(LIBS)
+
+t-toom4-sqr$(EXEEXT): $(t_toom4_sqr_OBJECTS) $(t_toom4_sqr_DEPENDENCIES) $(EXTRA_t_toom4_sqr_DEPENDENCIES)
+ @rm -f t-toom4-sqr$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_toom4_sqr_OBJECTS) $(t_toom4_sqr_LDADD) $(LIBS)
+
+t-toom42$(EXEEXT): $(t_toom42_OBJECTS) $(t_toom42_DEPENDENCIES) $(EXTRA_t_toom42_DEPENDENCIES)
+ @rm -f t-toom42$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_toom42_OBJECTS) $(t_toom42_LDADD) $(LIBS)
+
+t-toom43$(EXEEXT): $(t_toom43_OBJECTS) $(t_toom43_DEPENDENCIES) $(EXTRA_t_toom43_DEPENDENCIES)
+ @rm -f t-toom43$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_toom43_OBJECTS) $(t_toom43_LDADD) $(LIBS)
+
+t-toom44$(EXEEXT): $(t_toom44_OBJECTS) $(t_toom44_DEPENDENCIES) $(EXTRA_t_toom44_DEPENDENCIES)
+ @rm -f t-toom44$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_toom44_OBJECTS) $(t_toom44_LDADD) $(LIBS)
+
+t-toom52$(EXEEXT): $(t_toom52_OBJECTS) $(t_toom52_DEPENDENCIES) $(EXTRA_t_toom52_DEPENDENCIES)
+ @rm -f t-toom52$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_toom52_OBJECTS) $(t_toom52_LDADD) $(LIBS)
+
+t-toom53$(EXEEXT): $(t_toom53_OBJECTS) $(t_toom53_DEPENDENCIES) $(EXTRA_t_toom53_DEPENDENCIES)
+ @rm -f t-toom53$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_toom53_OBJECTS) $(t_toom53_LDADD) $(LIBS)
+
+t-toom54$(EXEEXT): $(t_toom54_OBJECTS) $(t_toom54_DEPENDENCIES) $(EXTRA_t_toom54_DEPENDENCIES)
+ @rm -f t-toom54$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_toom54_OBJECTS) $(t_toom54_LDADD) $(LIBS)
+
+t-toom6-sqr$(EXEEXT): $(t_toom6_sqr_OBJECTS) $(t_toom6_sqr_DEPENDENCIES) $(EXTRA_t_toom6_sqr_DEPENDENCIES)
+ @rm -f t-toom6-sqr$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_toom6_sqr_OBJECTS) $(t_toom6_sqr_LDADD) $(LIBS)
+
+t-toom62$(EXEEXT): $(t_toom62_OBJECTS) $(t_toom62_DEPENDENCIES) $(EXTRA_t_toom62_DEPENDENCIES)
+ @rm -f t-toom62$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_toom62_OBJECTS) $(t_toom62_LDADD) $(LIBS)
+
+t-toom63$(EXEEXT): $(t_toom63_OBJECTS) $(t_toom63_DEPENDENCIES) $(EXTRA_t_toom63_DEPENDENCIES)
+ @rm -f t-toom63$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_toom63_OBJECTS) $(t_toom63_LDADD) $(LIBS)
+
+t-toom6h$(EXEEXT): $(t_toom6h_OBJECTS) $(t_toom6h_DEPENDENCIES) $(EXTRA_t_toom6h_DEPENDENCIES)
+ @rm -f t-toom6h$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_toom6h_OBJECTS) $(t_toom6h_LDADD) $(LIBS)
+
+t-toom8-sqr$(EXEEXT): $(t_toom8_sqr_OBJECTS) $(t_toom8_sqr_DEPENDENCIES) $(EXTRA_t_toom8_sqr_DEPENDENCIES)
+ @rm -f t-toom8-sqr$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_toom8_sqr_OBJECTS) $(t_toom8_sqr_LDADD) $(LIBS)
+
+t-toom8h$(EXEEXT): $(t_toom8h_OBJECTS) $(t_toom8h_DEPENDENCIES) $(EXTRA_t_toom8h_DEPENDENCIES)
+ @rm -f t-toom8h$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_toom8h_OBJECTS) $(t_toom8h_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+.c.o:
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+ $(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+ rm -f $< $@
+ $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+ @:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+ @$(am__set_TESTS_bases); \
+ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+ redo_bases=`for i in $$bases; do \
+ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+ done`; \
+ if test -n "$$redo_bases"; then \
+ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+ if $(am__make_dryrun); then :; else \
+ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+ fi; \
+ fi; \
+ if test -n "$$am__remaking_logs"; then \
+ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+ "recursion detected" >&2; \
+ elif test -n "$$redo_logs"; then \
+ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+ fi; \
+ if $(am__make_dryrun); then :; else \
+ st=0; \
+ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+ for i in $$redo_bases; do \
+ test -f $$i.trs && test -r $$i.trs \
+ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+ test -f $$i.log && test -r $$i.log \
+ || { echo "$$errmsg $$i.log" >&2; st=1; }; \
+ done; \
+ test $$st -eq 0 || exit 1; \
+ fi
+ @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+ ws='[ ]'; \
+ results=`for b in $$bases; do echo $$b.trs; done`; \
+ test -n "$$results" || results=/dev/null; \
+ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
+ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \
+ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \
+ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \
+ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+ if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+ success=true; \
+ else \
+ success=false; \
+ fi; \
+ br='==================='; br=$$br$$br$$br$$br; \
+ result_count () \
+ { \
+ if test x"$$1" = x"--maybe-color"; then \
+ maybe_colorize=yes; \
+ elif test x"$$1" = x"--no-color"; then \
+ maybe_colorize=no; \
+ else \
+ echo "$@: invalid 'result_count' usage" >&2; exit 4; \
+ fi; \
+ shift; \
+ desc=$$1 count=$$2; \
+ if test $$maybe_colorize = yes && test $$count -gt 0; then \
+ color_start=$$3 color_end=$$std; \
+ else \
+ color_start= color_end=; \
+ fi; \
+ echo "$${color_start}# $$desc $$count$${color_end}"; \
+ }; \
+ create_testsuite_report () \
+ { \
+ result_count $$1 "TOTAL:" $$all "$$brg"; \
+ result_count $$1 "PASS: " $$pass "$$grn"; \
+ result_count $$1 "SKIP: " $$skip "$$blu"; \
+ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+ result_count $$1 "FAIL: " $$fail "$$red"; \
+ result_count $$1 "XPASS:" $$xpass "$$red"; \
+ result_count $$1 "ERROR:" $$error "$$mgn"; \
+ }; \
+ { \
+ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
+ $(am__rst_title); \
+ create_testsuite_report --no-color; \
+ echo; \
+ echo ".. contents:: :depth: 2"; \
+ echo; \
+ for b in $$bases; do echo $$b; done \
+ | $(am__create_global_log); \
+ } >$(TEST_SUITE_LOG).tmp || exit 1; \
+ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
+ if $$success; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
+ fi; \
+ echo "$${col}$$br$${std}"; \
+ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \
+ echo "$${col}$$br$${std}"; \
+ create_testsuite_report --maybe-color; \
+ echo "$$col$$br$$std"; \
+ if $$success; then :; else \
+ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \
+ if test -n "$(PACKAGE_BUGREPORT)"; then \
+ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+ fi; \
+ echo "$$col$$br$$std"; \
+ fi; \
+ $$success || exit 1
+
+check-TESTS:
+ @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
+ @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+ exit $$?;
+recheck: all $(check_PROGRAMS)
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ bases=`for i in $$bases; do echo $$i; done \
+ | $(am__list_recheck_tests)` || exit 1; \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ log_list=`echo $$log_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+ am__force_recheck=am--force-recheck \
+ TEST_LOGS="$$log_list"; \
+ exit $$?
+t-asmtype.log: t-asmtype$(EXEEXT)
+ @p='t-asmtype$(EXEEXT)'; \
+ b='t-asmtype'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-aors_1.log: t-aors_1$(EXEEXT)
+ @p='t-aors_1$(EXEEXT)'; \
+ b='t-aors_1'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-divrem_1.log: t-divrem_1$(EXEEXT)
+ @p='t-divrem_1$(EXEEXT)'; \
+ b='t-divrem_1'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-mod_1.log: t-mod_1$(EXEEXT)
+ @p='t-mod_1$(EXEEXT)'; \
+ b='t-mod_1'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-fat.log: t-fat$(EXEEXT)
+ @p='t-fat$(EXEEXT)'; \
+ b='t-fat'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-get_d.log: t-get_d$(EXEEXT)
+ @p='t-get_d$(EXEEXT)'; \
+ b='t-get_d'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-instrument.log: t-instrument$(EXEEXT)
+ @p='t-instrument$(EXEEXT)'; \
+ b='t-instrument'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-iord_u.log: t-iord_u$(EXEEXT)
+ @p='t-iord_u$(EXEEXT)'; \
+ b='t-iord_u'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-mp_bases.log: t-mp_bases$(EXEEXT)
+ @p='t-mp_bases$(EXEEXT)'; \
+ b='t-mp_bases'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-perfsqr.log: t-perfsqr$(EXEEXT)
+ @p='t-perfsqr$(EXEEXT)'; \
+ b='t-perfsqr'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-scan.log: t-scan$(EXEEXT)
+ @p='t-scan$(EXEEXT)'; \
+ b='t-scan'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+logic.log: logic$(EXEEXT)
+ @p='logic$(EXEEXT)'; \
+ b='logic'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-toom22.log: t-toom22$(EXEEXT)
+ @p='t-toom22$(EXEEXT)'; \
+ b='t-toom22'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-toom32.log: t-toom32$(EXEEXT)
+ @p='t-toom32$(EXEEXT)'; \
+ b='t-toom32'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-toom33.log: t-toom33$(EXEEXT)
+ @p='t-toom33$(EXEEXT)'; \
+ b='t-toom33'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-toom42.log: t-toom42$(EXEEXT)
+ @p='t-toom42$(EXEEXT)'; \
+ b='t-toom42'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-toom43.log: t-toom43$(EXEEXT)
+ @p='t-toom43$(EXEEXT)'; \
+ b='t-toom43'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-toom44.log: t-toom44$(EXEEXT)
+ @p='t-toom44$(EXEEXT)'; \
+ b='t-toom44'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-toom52.log: t-toom52$(EXEEXT)
+ @p='t-toom52$(EXEEXT)'; \
+ b='t-toom52'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-toom53.log: t-toom53$(EXEEXT)
+ @p='t-toom53$(EXEEXT)'; \
+ b='t-toom53'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-toom54.log: t-toom54$(EXEEXT)
+ @p='t-toom54$(EXEEXT)'; \
+ b='t-toom54'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-toom62.log: t-toom62$(EXEEXT)
+ @p='t-toom62$(EXEEXT)'; \
+ b='t-toom62'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-toom63.log: t-toom63$(EXEEXT)
+ @p='t-toom63$(EXEEXT)'; \
+ b='t-toom63'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-toom6h.log: t-toom6h$(EXEEXT)
+ @p='t-toom6h$(EXEEXT)'; \
+ b='t-toom6h'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-toom8h.log: t-toom8h$(EXEEXT)
+ @p='t-toom8h$(EXEEXT)'; \
+ b='t-toom8h'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-toom2-sqr.log: t-toom2-sqr$(EXEEXT)
+ @p='t-toom2-sqr$(EXEEXT)'; \
+ b='t-toom2-sqr'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-toom3-sqr.log: t-toom3-sqr$(EXEEXT)
+ @p='t-toom3-sqr$(EXEEXT)'; \
+ b='t-toom3-sqr'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-toom4-sqr.log: t-toom4-sqr$(EXEEXT)
+ @p='t-toom4-sqr$(EXEEXT)'; \
+ b='t-toom4-sqr'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-toom6-sqr.log: t-toom6-sqr$(EXEEXT)
+ @p='t-toom6-sqr$(EXEEXT)'; \
+ b='t-toom6-sqr'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-toom8-sqr.log: t-toom8-sqr$(EXEEXT)
+ @p='t-toom8-sqr$(EXEEXT)'; \
+ b='t-toom8-sqr'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-div.log: t-div$(EXEEXT)
+ @p='t-div$(EXEEXT)'; \
+ b='t-div'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-mul.log: t-mul$(EXEEXT)
+ @p='t-mul$(EXEEXT)'; \
+ b='t-mul'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-mullo.log: t-mullo$(EXEEXT)
+ @p='t-mullo$(EXEEXT)'; \
+ b='t-mullo'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-sqrlo.log: t-sqrlo$(EXEEXT)
+ @p='t-sqrlo$(EXEEXT)'; \
+ b='t-sqrlo'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-mulmod_bnm1.log: t-mulmod_bnm1$(EXEEXT)
+ @p='t-mulmod_bnm1$(EXEEXT)'; \
+ b='t-mulmod_bnm1'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-sqrmod_bnm1.log: t-sqrmod_bnm1$(EXEEXT)
+ @p='t-sqrmod_bnm1$(EXEEXT)'; \
+ b='t-sqrmod_bnm1'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-mulmid.log: t-mulmid$(EXEEXT)
+ @p='t-mulmid$(EXEEXT)'; \
+ b='t-mulmid'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-mulmod_bknp1.log: t-mulmod_bknp1$(EXEEXT)
+ @p='t-mulmod_bknp1$(EXEEXT)'; \
+ b='t-mulmod_bknp1'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-sqrmod_bknp1.log: t-sqrmod_bknp1$(EXEEXT)
+ @p='t-sqrmod_bknp1$(EXEEXT)'; \
+ b='t-sqrmod_bknp1'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-addaddmul.log: t-addaddmul$(EXEEXT)
+ @p='t-addaddmul$(EXEEXT)'; \
+ b='t-addaddmul'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-hgcd.log: t-hgcd$(EXEEXT)
+ @p='t-hgcd$(EXEEXT)'; \
+ b='t-hgcd'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-hgcd_appr.log: t-hgcd_appr$(EXEEXT)
+ @p='t-hgcd_appr$(EXEEXT)'; \
+ b='t-hgcd_appr'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-matrix22.log: t-matrix22$(EXEEXT)
+ @p='t-matrix22$(EXEEXT)'; \
+ b='t-matrix22'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-invert.log: t-invert$(EXEEXT)
+ @p='t-invert$(EXEEXT)'; \
+ b='t-invert'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-bdiv.log: t-bdiv$(EXEEXT)
+ @p='t-bdiv$(EXEEXT)'; \
+ b='t-bdiv'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-fib2m.log: t-fib2m$(EXEEXT)
+ @p='t-fib2m$(EXEEXT)'; \
+ b='t-fib2m'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-broot.log: t-broot$(EXEEXT)
+ @p='t-broot$(EXEEXT)'; \
+ b='t-broot'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-brootinv.log: t-brootinv$(EXEEXT)
+ @p='t-brootinv$(EXEEXT)'; \
+ b='t-brootinv'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-minvert.log: t-minvert$(EXEEXT)
+ @p='t-minvert$(EXEEXT)'; \
+ b='t-minvert'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-sizeinbase.log: t-sizeinbase$(EXEEXT)
+ @p='t-sizeinbase$(EXEEXT)'; \
+ b='t-sizeinbase'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-gcd_11.log: t-gcd_11$(EXEEXT)
+ @p='t-gcd_11$(EXEEXT)'; \
+ b='t-gcd_11'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-gcd_22.log: t-gcd_22$(EXEEXT)
+ @p='t-gcd_22$(EXEEXT)'; \
+ b='t-gcd_22'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-gcdext_1.log: t-gcdext_1$(EXEEXT)
+ @p='t-gcdext_1$(EXEEXT)'; \
+ b='t-gcdext_1'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+.test.log:
+ @p='$<'; \
+ $(am__set_b); \
+ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+@am__EXEEXT_TRUE@.test$(EXEEXT).log:
+@am__EXEEXT_TRUE@ @p='$<'; \
+@am__EXEEXT_TRUE@ $(am__set_b); \
+@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
+@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+ -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+ -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+ -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
+ ctags ctags-am distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ recheck tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/vendor/gmp-6.3.0/tests/mpn/logic.c b/vendor/gmp-6.3.0/tests/mpn/logic.c
new file mode 100644
index 0000000..2b1c9a9
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/logic.c
@@ -0,0 +1,133 @@
+/* Test mpn_and, mpn_ior, mpn_xor, mpn_andn, mpn_iorn, mpn_xnor, mpn_nand, and
+ mpn_nior.
+
+Copyright 2011-2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+/* Fake native prevalence of the tested operations, so that we actually test
+ the compiled functions, i.e., the ones which users will reach. The inlined
+ variants will be tested through tests/mpz/logic.c. */
+#define HAVE_NATIVE_mpn_com 1
+#define HAVE_NATIVE_mpn_and_n 1
+#define HAVE_NATIVE_mpn_andn_n 1
+#define HAVE_NATIVE_mpn_nand_n 1
+#define HAVE_NATIVE_mpn_ior_n 1
+#define HAVE_NATIVE_mpn_iorn_n 1
+#define HAVE_NATIVE_mpn_nior_n 1
+#define HAVE_NATIVE_mpn_xor_n 1
+#define HAVE_NATIVE_mpn_xnor_n 1
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_one (mp_srcptr refp, mp_srcptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n, const char *funcname)
+{
+ if (mpn_cmp (refp, rp, n))
+ {
+ printf ("ERROR in mpn_%s\n", funcname);
+ printf ("a: "); mpn_dump (ap, n);
+ printf ("b: "); mpn_dump (bp, n);
+ printf ("r: "); mpn_dump (rp, n);
+ printf ("ref: "); mpn_dump (refp, n);
+ abort();
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ mpz_t a, b;
+ mp_ptr ap, bp, rp, refp;
+ mp_size_t max_n, n, i;
+ gmp_randstate_ptr rands;
+ long test, reps = 1000;
+ TMP_DECL;
+ TMP_MARK;
+
+ tests_start ();
+ TESTS_REPS (reps, argv, argc);
+
+ mpz_inits (a, b, NULL);
+
+ rands = RANDS; /* FIXME: not used */
+
+ max_n = 100;
+
+ rp = TMP_ALLOC_LIMBS (1 + max_n * 8 / GMP_LIMB_BITS);
+ refp = TMP_ALLOC_LIMBS (1 + max_n * 8 / GMP_LIMB_BITS);
+
+ for (test = 0; test < reps; test++)
+ {
+ for (i = 1; i <= max_n; i++)
+ {
+ mpz_rrandomb (a, rands, i * 8);
+ mpz_rrandomb (b, rands, i * 8);
+ mpz_setbit (a, i * 8 - 1);
+ mpz_setbit (b, i * 8 - 1);
+ ap = PTR(a);
+ bp = PTR(b);
+ n = SIZ(a);
+
+ refmpn_and_n (refp, ap, bp, n);
+ mpn_and_n (rp, ap, bp, n);
+ check_one (refp, rp, ap, bp, n, "and_n");
+
+ refmpn_ior_n (refp, ap, bp, n);
+ mpn_ior_n (rp, ap, bp, n);
+ check_one (refp, rp, ap, bp, n, "ior_n");
+
+ refmpn_xor_n (refp, ap, bp, n);
+ mpn_xor_n (rp, ap, bp, n);
+ check_one (refp, rp, ap, bp, n, "xor_n");
+
+ refmpn_andn_n (refp, ap, bp, n);
+ mpn_andn_n (rp, ap, bp, n);
+ check_one (refp, rp, ap, bp, n, "andn_n");
+
+ refmpn_iorn_n (refp, ap, bp, n);
+ mpn_iorn_n (rp, ap, bp, n);
+ check_one (refp, rp, ap, bp, n, "iorn_n");
+
+ refmpn_nand_n (refp, ap, bp, n);
+ mpn_nand_n (rp, ap, bp, n);
+ check_one (refp, rp, ap, bp, n, "nand_n");
+
+ refmpn_nior_n (refp, ap, bp, n);
+ mpn_nior_n (rp, ap, bp, n);
+ check_one (refp, rp, ap, bp, n, "nior_n");
+
+ refmpn_xnor_n (refp, ap, bp, n);
+ mpn_xnor_n (rp, ap, bp, n);
+ check_one (refp, rp, ap, bp, n, "xnor_n");
+
+ refmpn_com (refp, ap, n);
+ mpn_com (rp, ap, n);
+ check_one (refp, rp, ap, bp, n, "com");
+ }
+ }
+
+ TMP_FREE;
+ mpz_clears (a, b, NULL);
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-addaddmul.c b/vendor/gmp-6.3.0/tests/mpn/t-addaddmul.c
new file mode 100644
index 0000000..8d3b0da
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-addaddmul.c
@@ -0,0 +1,98 @@
+/* Test mpn_addaddmul_1msb0.
+
+Copyright 2021 Free Software Foundation,
+Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#if !HAVE_NATIVE_mpn_addaddmul_1msb0
+int main(int argc, char **argv) {
+ return 77; /* Test driver "SKIP" */
+}
+#else
+
+static void
+one_test (int i, mp_srcptr a, mp_srcptr b, mp_size_t n, mp_limb_t u, mp_limb_t v)
+{
+ mp_ptr r = refmpn_malloc_limbs (n + 1);
+ mp_ptr ref = refmpn_malloc_limbs (n + 1);
+
+ u &= ~GMP_NUMB_HIGHBIT;
+ v &= ~GMP_NUMB_HIGHBIT;
+ ref[n] = mpn_mul_1 (ref, a, n, u);
+ ref[n] += mpn_addmul_1 (ref, b, n, v);
+ r[n] = mpn_addaddmul_1msb0 (r, a, b, n, u, v);
+
+ if (mpn_cmp (r, ref, n+1) != 0)
+ {
+ fprintf (stderr, "ERROR in test %d\n", i);
+ fprintf (stderr, "Bad result from addaddmul_1msb0\n");
+ gmp_fprintf (stderr, "op1=%Nx\n", a, n);
+ gmp_fprintf (stderr, "op2=%Nx\n", b, n);
+ gmp_fprintf (stderr, "u = %Mx, v = %Mx\n", u, v);
+ gmp_fprintf (stderr, "res=%Nx\n", r, n + 1);
+ gmp_fprintf (stderr, "ref=%Nx\n", ref, n + 1);
+
+ abort();
+ }
+}
+
+int main (int argc, char **argv)
+{
+ mpz_t op1, op2;
+ int i;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+
+ tests_start ();
+ rands = RANDS;
+
+ mpz_inits (bs, op1, op2, NULL);
+
+ for (i = 0; i < 10000; i++)
+ {
+ unsigned long size_range;
+ mp_size_t bit_size;
+ mp_size_t limb_size;
+ mp_limb_t u, v;
+
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 10 + 2;
+ mpz_urandomb (bs, rands, size_range);
+
+ bit_size = mpz_get_ui (bs) + 10;
+ mpz_rrandomb (op1, rands, bit_size);
+ mpz_rrandomb (op2, rands, bit_size);
+
+ mpz_rrandomb (bs, rands, GMP_NUMB_BITS - 1);
+ u = mpz_getlimbn (bs, 0);
+
+ mpz_rrandomb (bs, rands, GMP_NUMB_BITS - 1);
+ v = mpz_getlimbn (bs, 0);
+
+ limb_size = mpz_size (op1);
+ one_test (i, mpz_limbs_read (op1), mpz_limbs_read(op2), limb_size, u, v);
+ }
+ mpz_clears (bs, op1, op2, NULL);
+ return 0;
+}
+#endif
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-aors_1.c b/vendor/gmp-6.3.0/tests/mpn/t-aors_1.c
new file mode 100644
index 0000000..c894922
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-aors_1.c
@@ -0,0 +1,310 @@
+/* Test mpn_add_1 and mpn_sub_1.
+
+Copyright 2001, 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+#define M GMP_NUMB_MAX
+#define ASIZE 10
+#define MAGIC 0x1234
+
+#define SETUP() \
+ do { \
+ refmpn_random (got, data[i].size); \
+ got[data[i].size] = MAGIC; \
+ } while (0)
+
+#define SETUP_INPLACE() \
+ do { \
+ refmpn_copyi (got, data[i].src, data[i].size); \
+ got[data[i].size] = MAGIC; \
+ } while (0)
+
+#define VERIFY(name) \
+ do { \
+ verify (name, i, data[i].src, data[i].n, \
+ got_c, data[i].want_c, \
+ got, data[i].want, data[i].size); \
+ } while (0)
+
+typedef mp_limb_t (*mpn_aors_1_t) (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mpn_aors_1_t fudge (mpn_aors_1_t);
+
+
+void
+verify (const char *name, int i,
+ mp_srcptr src, mp_limb_t n,
+ mp_limb_t got_c, mp_limb_t want_c,
+ mp_srcptr got, mp_srcptr want, mp_size_t size)
+{
+ if (got[size] != MAGIC)
+ {
+ printf ("Overwrite at %s i=%d\n", name, i);
+ abort ();
+ }
+
+ if (got_c != want_c || ! refmpn_equal_anynail (got, want, size))
+ {
+ printf ("Wrong at %s i=%d size=%ld\n", name, i, size);
+ mpn_trace (" src", src, size);
+ mpn_trace (" n", &n, (mp_size_t) 1);
+ mpn_trace (" got", got, size);
+ mpn_trace (" want", want, size);
+ mpn_trace (" got c", &got_c, (mp_size_t) 1);
+ mpn_trace ("want c", &want_c, (mp_size_t) 1);
+ abort ();
+ }
+}
+
+
+void
+check_add_1 (void)
+{
+ static const struct {
+ mp_size_t size;
+ mp_limb_t n;
+ const mp_limb_t src[ASIZE];
+ mp_limb_t want_c;
+ const mp_limb_t want[ASIZE];
+ } data[] = {
+ { 1, 0, { 0 }, 0, { 0 } },
+ { 1, 0, { 1 }, 0, { 1 } },
+ { 1, 1, { 0 }, 0, { 1 } },
+ { 1, 0, { M }, 0, { M } },
+ { 1, M, { 0 }, 0, { M } },
+ { 1, 1, { 123 }, 0, { 124 } },
+
+ { 1, 1, { M }, 1, { 0 } },
+ { 1, M, { 1 }, 1, { 0 } },
+ { 1, M, { M }, 1, { M-1 } },
+
+ { 2, 0, { 0, 0 }, 0, { 0, 0 } },
+ { 2, 0, { 1, 0 }, 0, { 1, 0 } },
+ { 2, 1, { 0, 0 }, 0, { 1, 0 } },
+ { 2, 0, { M, 0 }, 0, { M, 0 } },
+ { 2, M, { 0, 0 }, 0, { M, 0 } },
+ { 2, 1, { M, 0 }, 0, { 0, 1 } },
+ { 2, M, { 1, 0 }, 0, { 0, 1 } },
+ { 2, M, { M, 0 }, 0, { M-1, 1 } },
+ { 2, M, { M, 0 }, 0, { M-1, 1 } },
+
+ { 2, 1, { M, M }, 1, { 0, 0 } },
+ { 2, M, { 1, M }, 1, { 0, 0 } },
+ { 2, M, { M, M }, 1, { M-1, 0 } },
+ { 2, M, { M, M }, 1, { M-1, 0 } },
+
+ { 3, 1, { M, M, M }, 1, { 0, 0, 0 } },
+ { 3, M, { 1, M, M }, 1, { 0, 0, 0 } },
+ { 3, M, { M, M, M }, 1, { M-1, 0, 0 } },
+ { 3, M, { M, M, M }, 1, { M-1, 0, 0 } },
+
+ { 4, 1, { M, M, M, M }, 1, { 0, 0, 0, 0 } },
+ { 4, M, { 1, M, M, M }, 1, { 0, 0, 0, 0 } },
+ { 4, M, { M, M, M, M }, 1, { M-1, 0, 0, 0 } },
+ { 4, M, { M, M, M, M }, 1, { M-1, 0, 0, 0 } },
+
+ { 4, M, { M, 0, M, M }, 0, { M-1, 1, M, M } },
+ { 4, M, { M, M-1, M, M }, 0, { M-1, M, M, M } },
+
+ { 4, M, { M, M, 0, M }, 0, { M-1, 0, 1, M } },
+ { 4, M, { M, M, M-1, M }, 0, { M-1, 0, M, M } },
+ };
+
+ mp_limb_t got[ASIZE];
+ mp_limb_t got_c;
+ /* mpn_sec_add_a_itch(n) <= n */
+ mp_limb_t scratch[ASIZE];
+ int i;
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ SETUP ();
+ got_c = mpn_add_1 (got, data[i].src, data[i].size, data[i].n);
+ VERIFY ("check_add_1 (separate)");
+
+ SETUP_INPLACE ();
+ got_c = mpn_add_1 (got, got, data[i].size, data[i].n);
+ VERIFY ("check_add_1 (in-place)");
+
+ SETUP ();
+ scratch [mpn_sec_add_1_itch(data[i].size)] = MAGIC;
+ got_c = mpn_sec_add_1 (got, data[i].src, data[i].size, data[i].n, scratch);
+ got_c ^= scratch [mpn_sec_add_1_itch(data[i].size)] ^ MAGIC;
+ VERIFY ("check_sec_add_1 (separate)");
+
+ SETUP_INPLACE ();
+ got_c = mpn_sec_add_1 (got, got, data[i].size, data[i].n, scratch);
+ VERIFY ("check_sec_add_1 (in-place)");
+
+ if (data[i].n == 1)
+ {
+ SETUP ();
+ got_c = mpn_add_1 (got, data[i].src, data[i].size, CNST_LIMB(1));
+ VERIFY ("check_add_1 (separate, const 1)");
+
+ SETUP_INPLACE ();
+ got_c = mpn_add_1 (got, got, data[i].size, CNST_LIMB(1));
+ VERIFY ("check_add_1 (in-place, const 1)");
+
+ SETUP ();
+ got_c = mpn_sec_add_1 (got, data[i].src, data[i].size,
+ CNST_LIMB(1), scratch);
+ VERIFY ("check_sec_add_1 (separate, const 1)");
+
+ SETUP_INPLACE ();
+ got_c = mpn_sec_add_1 (got, got, data[i].size,
+ CNST_LIMB(1), scratch);
+ VERIFY ("check_sec_add_1 (in-place, const 1)");
+ }
+
+ /* Same again on functions, not inlines. */
+ SETUP ();
+ got_c = (*fudge(mpn_add_1)) (got, data[i].src, data[i].size, data[i].n);
+ VERIFY ("check_add_1 (function, separate)");
+
+ SETUP_INPLACE ();
+ got_c = (*fudge(mpn_add_1)) (got, got, data[i].size, data[i].n);
+ VERIFY ("check_add_1 (function, in-place)");
+ }
+}
+
+void
+check_sub_1 (void)
+{
+ static const struct {
+ mp_size_t size;
+ mp_limb_t n;
+ const mp_limb_t src[ASIZE];
+ mp_limb_t want_c;
+ const mp_limb_t want[ASIZE];
+ } data[] = {
+ { 1, 0, { 0 }, 0, { 0 } },
+ { 1, 0, { 1 }, 0, { 1 } },
+ { 1, 1, { 1 }, 0, { 0 } },
+ { 1, 0, { M }, 0, { M } },
+ { 1, 1, { M }, 0, { M-1 } },
+ { 1, 1, { 123 }, 0, { 122 } },
+
+ { 1, 1, { 0 }, 1, { M } },
+ { 1, M, { 0 }, 1, { 1 } },
+
+ { 2, 0, { 0, 0 }, 0, { 0, 0 } },
+ { 2, 0, { 1, 0 }, 0, { 1, 0 } },
+ { 2, 1, { 1, 0 }, 0, { 0, 0 } },
+ { 2, 0, { M, 0 }, 0, { M, 0 } },
+ { 2, 1, { M, 0 }, 0, { M-1, 0 } },
+ { 2, 1, { 123, 0 }, 0, { 122, 0 } },
+
+ { 2, 1, { 0, 0 }, 1, { M, M } },
+ { 2, M, { 0, 0 }, 1, { 1, M } },
+
+ { 3, 0, { 0, 0, 0 }, 0, { 0, 0, 0 } },
+ { 3, 0, { 123, 0, 0 }, 0, { 123, 0, 0 } },
+
+ { 3, 1, { 0, 0, 0 }, 1, { M, M, M } },
+ { 3, M, { 0, 0, 0 }, 1, { 1, M, M } },
+
+ { 4, 1, { 0, 0, 0, 0 }, 1, { M, M, M, M } },
+ { 4, M, { 0, 0, 0, 0 }, 1, { 1, M, M, M } },
+
+ { 4, 1, { 0, 0, 1, 42 }, 0, { M, M, 0, 42 } },
+ { 4, M, { 0, 0, 123, 24 }, 0, { 1, M, 122, 24 } },
+ };
+
+ mp_limb_t got[ASIZE];
+ mp_limb_t got_c;
+ /* mpn_sec_sub_1_itch(n) <= n */
+ mp_limb_t scratch[ASIZE];
+ int i;
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ SETUP ();
+ got_c = mpn_sub_1 (got, data[i].src, data[i].size, data[i].n);
+ VERIFY ("check_sub_1 (separate)");
+
+ SETUP_INPLACE ();
+ got_c = mpn_sub_1 (got, got, data[i].size, data[i].n);
+ VERIFY ("check_sub_1 (in-place)");
+
+ SETUP ();
+ scratch [mpn_sec_sub_1_itch(data[i].size)] = MAGIC;
+ got_c = mpn_sec_sub_1 (got, data[i].src, data[i].size, data[i].n, scratch);
+ got_c ^= scratch [mpn_sec_sub_1_itch(data[i].size)] ^ MAGIC;
+ VERIFY ("check_sec_sub_1 (separate)");
+
+ SETUP_INPLACE ();
+ got_c = mpn_sec_sub_1 (got, got, data[i].size, data[i].n, scratch);
+ VERIFY ("check_sec_sub_1 (in-place)");
+
+ if (data[i].n == 1)
+ {
+ SETUP ();
+ got_c = mpn_sub_1 (got, data[i].src, data[i].size, CNST_LIMB(1));
+ VERIFY ("check_sub_1 (separate, const 1)");
+
+ SETUP_INPLACE ();
+ got_c = mpn_sub_1 (got, got, data[i].size, CNST_LIMB(1));
+ VERIFY ("check_sub_1 (in-place, const 1)");
+
+ SETUP ();
+ got_c = mpn_sec_sub_1 (got, data[i].src, data[i].size,
+ CNST_LIMB(1), scratch);
+ VERIFY ("check_sec_sub_1 (separate, const 1)");
+
+ SETUP_INPLACE ();
+ got_c = mpn_sec_sub_1 (got, got, data[i].size,
+ CNST_LIMB(1), scratch);
+ VERIFY ("check_sec_sub_1 (in-place, const 1)");
+ }
+
+ /* Same again on functions, not inlines. */
+ SETUP ();
+ got_c = (*fudge(mpn_sub_1)) (got, data[i].src, data[i].size, data[i].n);
+ VERIFY ("check_sub_1 (function, separate)");
+
+ SETUP_INPLACE ();
+ got_c = (*fudge(mpn_sub_1)) (got, got, data[i].size, data[i].n);
+ VERIFY ("check_sub_1 (function, in-place)");
+ }
+}
+
+/* Try to prevent the optimizer inlining. */
+mpn_aors_1_t
+fudge (mpn_aors_1_t f)
+{
+ return f;
+}
+
+int
+main (void)
+{
+ tests_start ();
+ mp_trace_base = -16;
+
+ check_add_1 ();
+ check_sub_1 ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-asmtype.c b/vendor/gmp-6.3.0/tests/mpn/t-asmtype.c
new file mode 100644
index 0000000..c6577d1
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-asmtype.c
@@ -0,0 +1,63 @@
+/* Test .type directives on assembler functions.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+
+#include "tests.h"
+
+
+/* This apparently trivial test is designed to detect missing .type and
+ .size directives in asm code, per the problem described under
+ GMP_ASM_TYPE in acinclude.m4.
+
+ A failure can be provoked in a shared or shared+static build by making
+ TYPE and SIZE in config.m4 empty, either by editing it or by configuring
+ with
+
+ ./configure gmp_cv_asm_type= gmp_cv_asm_size=
+
+ mpn_add_n is used for the test because normally it's implemented in
+ assembler on a CPU that has any asm code.
+
+ Enhancement: As noted with GMP_ASM_TYPE, if .type is wrong but .size is
+ right then everything works, but uses code copied down to the mainline
+ data area. Maybe we could detect that if we built a test library with an
+ object that had .size deliberately disabled. */
+
+int
+main (void)
+{
+ static const mp_limb_t x[3] = { 1, 2, 3 };
+ static const mp_limb_t y[3] = { 4, 5, 6 };
+ static const mp_limb_t want[3] = { 5, 7, 9 };
+ mp_limb_t got[3];
+
+ mpn_add_n (got, x, y, (mp_size_t) 3);
+
+ if (refmpn_cmp (got, want, (mp_size_t) 3) != 0)
+ {
+ printf ("Wrong result from mpn_add_n\n");
+ abort ();
+ }
+
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-bdiv.c b/vendor/gmp-6.3.0/tests/mpn/t-bdiv.c
new file mode 100644
index 0000000..60f58da
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-bdiv.c
@@ -0,0 +1,354 @@
+/* Copyright 2006, 2007, 2009, 2010, 2017 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdlib.h> /* for strtol */
+#include <stdio.h> /* for printf */
+
+#include "gmp-impl.h"
+#include "longlong.h"
+#include "tests/tests.h"
+
+
+static void
+dumpy (mp_srcptr p, mp_size_t n)
+{
+ mp_size_t i;
+ if (n > 20)
+ {
+ for (i = n - 1; i >= n - 4; i--)
+ {
+ printf ("%0*lx", (int) (2 * sizeof (mp_limb_t)), p[i]);
+ printf (" ");
+ }
+ printf ("... ");
+ for (i = 3; i >= 0; i--)
+ {
+ printf ("%0*lx", (int) (2 * sizeof (mp_limb_t)), p[i]);
+ printf (i == 0 ? "" : " ");
+ }
+ }
+ else
+ {
+ for (i = n - 1; i >= 0; i--)
+ {
+ printf ("%0*lx", (int) (2 * sizeof (mp_limb_t)), p[i]);
+ printf (i == 0 ? "" : " ");
+ }
+ }
+ puts ("");
+}
+
+static unsigned long test;
+
+void
+check_one (mp_ptr qp, mp_srcptr rp, mp_limb_t rh,
+ mp_srcptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, const char *fname)
+{
+ mp_size_t qn;
+ mp_ptr tp;
+ mp_limb_t cy = 4711; /* silence warnings */
+ TMP_DECL;
+
+ qn = nn - dn;
+
+ if (qn == 0)
+ return;
+
+ TMP_MARK;
+
+ tp = TMP_ALLOC_LIMBS (nn + 1);
+
+ if (dn >= qn)
+ mpn_mul (tp, dp, dn, qp, qn);
+ else
+ mpn_mul (tp, qp, qn, dp, dn);
+
+ cy = mpn_add_n (tp, tp, np, nn);
+
+ if (! mpn_zero_p (tp, qn)
+ || (rp != NULL && (cy != rh || mpn_cmp (tp + qn, rp, dn) != 0)))
+ {
+ printf ("\r*******************************************************************************\n");
+ printf ("%s inconsistent in test %lu\n", fname, test);
+ printf ("N= "); dumpy (np, nn);
+ printf ("D= "); dumpy (dp, dn);
+ printf ("Q= "); dumpy (qp, qn);
+ if (rp != NULL)
+ {
+ printf ("R= "); dumpy (rp, dn);
+ printf ("Rb= %d, Cy=%d\n", (int) cy, (int) rh);
+ }
+ printf ("T= "); dumpy (tp, nn);
+ printf ("nn = %ld, dn = %ld, qn = %ld", nn, dn, qn);
+ printf ("\n*******************************************************************************\n");
+ abort ();
+ }
+
+ TMP_FREE;
+}
+
+
+/* These are *bit* sizes. */
+#define SIZE_LOG 16
+#define MAX_DN (1L << SIZE_LOG)
+#define MAX_NN (1L << (SIZE_LOG + 1))
+
+#define COUNT 500
+
+mp_limb_t
+random_word (gmp_randstate_ptr rs)
+{
+ mpz_t x;
+ mp_limb_t r;
+ TMP_DECL;
+ TMP_MARK;
+
+ MPZ_TMP_INIT (x, 2);
+ mpz_urandomb (x, rs, 32);
+ r = mpz_get_ui (x);
+ TMP_FREE;
+ return r;
+}
+
+int
+main (int argc, char **argv)
+{
+ gmp_randstate_ptr rands;
+ unsigned long maxnbits, maxdbits, nbits, dbits;
+ mpz_t n, d, tz;
+ mp_size_t maxnn, maxdn, nn, dn, clearn, i;
+ mp_ptr np, dp, qp, rp;
+ mp_limb_t rh;
+ mp_limb_t t;
+ mp_limb_t dinv;
+ int count = COUNT;
+ mp_ptr scratch;
+ mp_limb_t ran;
+ mp_size_t alloc, itch;
+ mp_limb_t rran0, rran1, qran0, qran1;
+ TMP_DECL;
+
+ TESTS_REPS (count, argv, argc);
+
+ maxdbits = MAX_DN;
+ maxnbits = MAX_NN;
+
+ tests_start ();
+ rands = RANDS;
+
+ mpz_init (n);
+ mpz_init (d);
+ mpz_init (tz);
+
+ maxnn = maxnbits / GMP_NUMB_BITS + 1;
+ maxdn = maxdbits / GMP_NUMB_BITS + 1;
+
+ TMP_MARK;
+
+ qp = TMP_ALLOC_LIMBS (maxnn + 2) + 1;
+ rp = TMP_ALLOC_LIMBS (maxnn + 2) + 1;
+
+ alloc = 1;
+ scratch = __GMP_ALLOCATE_FUNC_LIMBS (alloc);
+
+ for (test = 0; test < count;)
+ {
+ nbits = random_word (rands) % (maxnbits - GMP_NUMB_BITS) + 2 * GMP_NUMB_BITS;
+ if (maxdbits > nbits)
+ dbits = random_word (rands) % nbits + 1;
+ else
+ dbits = random_word (rands) % maxdbits + 1;
+
+#if RAND_UNIFORM
+#define RANDFUNC mpz_urandomb
+#else
+#define RANDFUNC mpz_rrandomb
+#endif
+
+ do
+ {
+ RANDFUNC (n, rands, nbits);
+ do
+ {
+ RANDFUNC (d, rands, dbits);
+ }
+ while (mpz_sgn (d) == 0);
+
+ np = PTR (n);
+ dp = PTR (d);
+ nn = SIZ (n);
+ dn = SIZ (d);
+ }
+ while (nn < dn);
+
+ dp[0] |= 1;
+
+ mpz_urandomb (tz, rands, 32);
+ t = mpz_get_ui (tz);
+
+ if (t % 17 == 0)
+ dp[0] = GMP_NUMB_MAX;
+
+ switch ((int) t % 16)
+ {
+ case 0:
+ clearn = random_word (rands) % nn;
+ for (i = 0; i <= clearn; i++)
+ np[i] = 0;
+ break;
+ case 1:
+ mpn_sub_1 (np + nn - dn, dp, dn, random_word (rands));
+ break;
+ case 2:
+ mpn_add_1 (np + nn - dn, dp, dn, random_word (rands));
+ break;
+ }
+
+ test++;
+
+ binvert_limb (dinv, dp[0]);
+
+ rran0 = random_word (rands);
+ rran1 = random_word (rands);
+ qran0 = random_word (rands);
+ qran1 = random_word (rands);
+
+ qp[-1] = qran0;
+ qp[nn - dn + 1] = qran1;
+ rp[-1] = rran0;
+
+ ran = random_word (rands);
+
+ if ((double) (nn - dn) * dn < 1e5)
+ {
+ if (nn > dn)
+ {
+ /* Test mpn_sbpi1_bdiv_qr */
+ MPN_ZERO (qp, nn - dn);
+ MPN_ZERO (rp, dn);
+ MPN_COPY (rp, np, nn);
+ rh = mpn_sbpi1_bdiv_qr (qp, rp, nn, dp, dn, -dinv);
+ ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
+ ASSERT_ALWAYS (rp[-1] == rran0);
+ check_one (qp, rp + nn - dn, rh, np, nn, dp, dn, "mpn_sbpi1_bdiv_qr");
+
+ /* Test mpn_sbpi1_bdiv_q */
+ MPN_COPY (rp, np, nn);
+ MPN_ZERO (qp, nn - dn);
+ mpn_sbpi1_bdiv_q (qp, rp, nn - dn, dp, MIN(dn,nn-dn), -dinv);
+ ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
+ ASSERT_ALWAYS (rp[-1] == rran0);
+ check_one (qp, NULL, 0, np, nn, dp, dn, "mpn_sbpi1_bdiv_q");
+
+ /* Test mpn_sbpi1_bdiv_r; we use mpn_sbpi1_bdiv_q's quotient. */
+ MPN_COPY (rp, np, nn);
+ mpn_sbpi1_bdiv_r (rp, nn, dp, dn, -dinv);
+ ASSERT_ALWAYS (rp[-1] == rran0);
+ check_one (qp, NULL, 0, np, nn, dp, dn, "mpn_sbpi1_bdiv_r");
+ }
+ }
+
+ if (dn >= 4 && nn - dn >= 2)
+ {
+ /* Test mpn_dcpi1_bdiv_qr */
+ MPN_COPY (rp, np, nn);
+ MPN_ZERO (qp, nn - dn);
+ rh = mpn_dcpi1_bdiv_qr (qp, rp, nn, dp, dn, -dinv);
+ ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
+ ASSERT_ALWAYS (rp[-1] == rran0);
+ check_one (qp, rp + nn - dn, rh, np, nn, dp, dn, "mpn_dcpi1_bdiv_qr");
+ }
+
+ if (dn >= 4 && nn - dn >= 2)
+ {
+ /* Test mpn_dcpi1_bdiv_q */
+ MPN_COPY (rp, np, nn);
+ MPN_ZERO (qp, nn - dn);
+ mpn_dcpi1_bdiv_q (qp, rp, nn - dn, dp, MIN(dn,nn-dn), -dinv);
+ ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
+ ASSERT_ALWAYS (rp[-1] == rran0);
+ check_one (qp, NULL, 0, np, nn, dp, dn, "mpn_dcpi1_bdiv_q");
+ }
+
+ if (nn > dn)
+ {
+ /* Test mpn_bdiv_qr */
+ itch = mpn_bdiv_qr_itch (nn, dn);
+ if (itch + 1 > alloc)
+ {
+ scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
+ alloc = itch + 1;
+ }
+ scratch[itch] = ran;
+ MPN_ZERO (qp, nn - dn);
+ MPN_ZERO (rp, dn);
+ rp[dn] = rran1;
+ rh = mpn_bdiv_qr (qp, rp, np, nn, dp, dn, scratch);
+ ASSERT_ALWAYS (ran == scratch[itch]);
+ ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
+ ASSERT_ALWAYS (rp[-1] == rran0); ASSERT_ALWAYS (rp[dn] == rran1);
+
+ check_one (qp, rp, rh, np, nn, dp, dn, "mpn_bdiv_qr");
+ }
+
+ if (nn - dn < 2 || dn < 2)
+ continue;
+
+ /* Test mpn_mu_bdiv_qr */
+ itch = mpn_mu_bdiv_qr_itch (nn, dn);
+ if (itch + 1 > alloc)
+ {
+ scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
+ alloc = itch + 1;
+ }
+ scratch[itch] = ran;
+ MPN_ZERO (qp, nn - dn);
+ MPN_ZERO (rp, dn);
+ rp[dn] = rran1;
+ rh = mpn_mu_bdiv_qr (qp, rp, np, nn, dp, dn, scratch);
+ ASSERT_ALWAYS (ran == scratch[itch]);
+ ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
+ ASSERT_ALWAYS (rp[-1] == rran0); ASSERT_ALWAYS (rp[dn] == rran1);
+ check_one (qp, rp, rh, np, nn, dp, dn, "mpn_mu_bdiv_qr");
+
+ /* Test mpn_mu_bdiv_q */
+ itch = mpn_mu_bdiv_q_itch (nn, dn);
+ if (itch + 1 > alloc)
+ {
+ scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
+ alloc = itch + 1;
+ }
+ scratch[itch] = ran;
+ MPN_ZERO (qp, nn - dn + 1);
+ mpn_mu_bdiv_q (qp, np, nn - dn, dp, dn, scratch);
+ ASSERT_ALWAYS (ran == scratch[itch]);
+ ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
+ check_one (qp, NULL, 0, np, nn, dp, dn, "mpn_mu_bdiv_q");
+ }
+
+ __GMP_FREE_FUNC_LIMBS (scratch, alloc);
+
+ TMP_FREE;
+
+ mpz_clear (n);
+ mpz_clear (d);
+ mpz_clear (tz);
+
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-broot.c b/vendor/gmp-6.3.0/tests/mpn/t-broot.c
new file mode 100644
index 0000000..bd8e80f
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-broot.c
@@ -0,0 +1,108 @@
+/* Copyright 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdlib.h> /* for strtol */
+#include <stdio.h> /* for printf */
+
+#include "gmp-impl.h"
+#include "longlong.h"
+#include "tests/tests.h"
+
+#define MAX_LIMBS 150
+#define COUNT 500
+
+int
+main (int argc, char **argv)
+{
+ gmp_randstate_ptr rands;
+
+ mp_ptr ap, rp, pp, scratch;
+ int count = COUNT;
+ unsigned i;
+ TMP_DECL;
+
+ TMP_MARK;
+
+ TESTS_REPS (count, argv, argc);
+
+ tests_start ();
+ rands = RANDS;
+
+ ap = TMP_ALLOC_LIMBS (MAX_LIMBS);
+ rp = TMP_ALLOC_LIMBS (MAX_LIMBS);
+ pp = TMP_ALLOC_LIMBS (MAX_LIMBS);
+ scratch = TMP_ALLOC_LIMBS (3*MAX_LIMBS); /* For mpn_powlo */
+
+ for (i = 0; i < count; i++)
+ {
+ mp_size_t n;
+ mp_limb_t k;
+ int c;
+
+ n = 1 + gmp_urandomm_ui (rands, MAX_LIMBS);
+
+ if (i & 1)
+ mpn_random2 (ap, n);
+ else
+ mpn_random (ap, n);
+
+ ap[0] |= 1;
+
+ if (i < 100)
+ k = 3 + 2*i;
+ else
+ {
+ mpn_random (&k, 1);
+ if (k < 3)
+ k = 3;
+ else
+ k |= 1;
+ }
+ mpn_broot (rp, ap, n, k);
+ mpn_powlo (pp, rp, &k, 1, n, scratch);
+
+ MPN_CMP (c, ap, pp, n);
+ if (c != 0)
+ {
+ gmp_fprintf (stderr,
+ "mpn_broot returned bad result: %u limbs\n",
+ (unsigned) n);
+ gmp_fprintf (stderr, "k = %Mx\n", k);
+ gmp_fprintf (stderr, "a = %Nx\n", ap, n);
+ gmp_fprintf (stderr, "r = %Nx\n", rp, n);
+ gmp_fprintf (stderr, "r^k = %Nx\n", pp, n);
+ abort ();
+ }
+ }
+
+ mpn_broot (rp, ap, MAX_LIMBS, 1);
+ if (mpn_cmp (ap, rp, MAX_LIMBS) != 0)
+ {
+ gmp_fprintf (stderr,
+ "mpn_broot returned bad result: %u limbs\n",
+ (unsigned) MAX_LIMBS);
+ gmp_fprintf (stderr, "k = %Mx\n", 1);
+ gmp_fprintf (stderr, "a = %Nx\n", ap, MAX_LIMBS);
+ gmp_fprintf (stderr, "r = %Nx\n", rp, MAX_LIMBS);
+ abort ();
+ }
+
+ TMP_FREE;
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-brootinv.c b/vendor/gmp-6.3.0/tests/mpn/t-brootinv.c
new file mode 100644
index 0000000..f5a9950
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-brootinv.c
@@ -0,0 +1,96 @@
+/* Copyright 2012, 2015 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdlib.h> /* for strtol */
+#include <stdio.h> /* for printf */
+
+#include "gmp-impl.h"
+#include "longlong.h"
+#include "tests/tests.h"
+
+#define MAX_LIMBS 150
+#define COUNT 500
+
+int
+main (int argc, char **argv)
+{
+ gmp_randstate_ptr rands;
+
+ mp_ptr ap, rp, pp, app, scratch;
+ int count = COUNT;
+ unsigned i;
+ TMP_DECL;
+
+ TMP_MARK;
+
+ TESTS_REPS (count, argv, argc);
+
+ tests_start ();
+ rands = RANDS;
+
+ ap = TMP_ALLOC_LIMBS (MAX_LIMBS);
+ rp = TMP_ALLOC_LIMBS (MAX_LIMBS);
+ pp = TMP_ALLOC_LIMBS (MAX_LIMBS);
+ app = TMP_ALLOC_LIMBS (MAX_LIMBS);
+ scratch = TMP_ALLOC_LIMBS (5*MAX_LIMBS);
+
+ for (i = 0; i < count; i++)
+ {
+ mp_size_t n;
+ mp_limb_t k;
+
+ n = 1 + gmp_urandomm_ui (rands, MAX_LIMBS);
+
+ if (i & 1)
+ mpn_random2 (ap, n);
+ else
+ mpn_random (ap, n);
+
+ ap[0] |= 1;
+
+ if (i < 100)
+ k = 3 + 2*i;
+ else
+ {
+ mpn_random (&k, 1);
+ if (k < 3)
+ k = 3;
+ else
+ k |= 1;
+ }
+ mpn_brootinv (rp, ap, n, k, scratch);
+ mpn_powlo (pp, rp, &k, 1, n, scratch);
+ mpn_mullo_n (app, ap, pp, n);
+
+ if (app[0] != 1 || !(n == 1 || mpn_zero_p (app+1, n-1)))
+ {
+ gmp_fprintf (stderr,
+ "mpn_brootinv returned bad result: %u limbs\n",
+ (unsigned) n);
+ gmp_fprintf (stderr, "k = %Mx\n", k);
+ gmp_fprintf (stderr, "a = %Nx\n", ap, n);
+ gmp_fprintf (stderr, "r = %Nx\n", rp, n);
+ gmp_fprintf (stderr, "r^n = %Nx\n", pp, n);
+ gmp_fprintf (stderr, "a r^n = %Nx\n", app, n);
+ abort ();
+ }
+ }
+ TMP_FREE;
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-div.c b/vendor/gmp-6.3.0/tests/mpn/t-div.c
new file mode 100644
index 0000000..110385f
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-div.c
@@ -0,0 +1,497 @@
+/* Copyright 2006, 2007, 2009, 2010, 2013-2015, 2018 Free Software
+ Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdlib.h> /* for strtol */
+#include <stdio.h> /* for printf */
+
+#include "gmp-impl.h"
+#include "longlong.h"
+#include "tests/tests.h"
+
+
+static void
+dumpy (mp_srcptr p, mp_size_t n)
+{
+ mp_size_t i;
+ if (n > 20)
+ {
+ for (i = n - 1; i >= n - 4; i--)
+ {
+ printf ("%0*lx", (int) (2 * sizeof (mp_limb_t)), p[i]);
+ printf (" ");
+ }
+ printf ("... ");
+ for (i = 3; i >= 0; i--)
+ {
+ printf ("%0*lx", (int) (2 * sizeof (mp_limb_t)), p[i]);
+ printf (i == 0 ? "" : " ");
+ }
+ }
+ else
+ {
+ for (i = n - 1; i >= 0; i--)
+ {
+ printf ("%0*lx", (int) (2 * sizeof (mp_limb_t)), p[i]);
+ printf (i == 0 ? "" : " ");
+ }
+ }
+ puts ("");
+}
+
+static signed long test;
+
+static void
+check_one (mp_ptr qp, mp_srcptr rp,
+ mp_srcptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn,
+ const char *fname, mp_limb_t q_allowed_err)
+{
+ mp_size_t qn = nn - dn + 1;
+ mp_ptr tp;
+ const char *msg;
+ const char *tvalue;
+ mp_limb_t i;
+ TMP_DECL;
+ TMP_MARK;
+
+ tp = TMP_ALLOC_LIMBS (nn + 1);
+ if (dn >= qn)
+ refmpn_mul (tp, dp, dn, qp, qn);
+ else
+ refmpn_mul (tp, qp, qn, dp, dn);
+
+ for (i = 0; i < q_allowed_err && (tp[nn] > 0 || mpn_cmp (tp, np, nn) > 0); i++)
+ ASSERT_NOCARRY (refmpn_sub (tp, tp, nn+1, dp, dn));
+
+ if (tp[nn] > 0 || mpn_cmp (tp, np, nn) > 0)
+ {
+ msg = "q too large";
+ tvalue = "Q*D";
+ error:
+ printf ("\r*******************************************************************************\n");
+ printf ("%s failed test %ld: %s\n", fname, test, msg);
+ printf ("N= "); dumpy (np, nn);
+ printf ("D= "); dumpy (dp, dn);
+ printf ("Q= "); dumpy (qp, qn);
+ if (rp)
+ { printf ("R= "); dumpy (rp, dn); }
+ printf ("%5s=", tvalue); dumpy (tp, nn+1);
+ printf ("nn = %ld, dn = %ld, qn = %ld\n", nn, dn, qn);
+ abort ();
+ }
+
+ ASSERT_NOCARRY (refmpn_sub_n (tp, np, tp, nn));
+ tvalue = "N-Q*D";
+ if (!(nn == dn || mpn_zero_p (tp + dn, nn - dn)) || mpn_cmp (tp, dp, dn) >= 0)
+ {
+ msg = "q too small";
+ goto error;
+ }
+
+ if (rp && mpn_cmp (rp, tp, dn) != 0)
+ {
+ msg = "r incorrect";
+ goto error;
+ }
+
+ TMP_FREE;
+}
+
+
+/* These are *bit* sizes. */
+#ifndef SIZE_LOG
+#define SIZE_LOG 17
+#endif
+#define MAX_DN (1L << SIZE_LOG)
+#define MAX_NN (1L << (SIZE_LOG + 1))
+
+#define COUNT 200
+
+int
+main (int argc, char **argv)
+{
+ gmp_randstate_ptr rands;
+ unsigned long maxnbits, maxdbits, nbits, dbits;
+ mpz_t n, d, q, r, tz, junk;
+ mp_size_t maxnn, maxdn, nn, dn, clearn, i;
+ mp_ptr np, dup, dnp, qp, rp, junkp;
+ mp_limb_t t;
+ gmp_pi1_t dinv;
+ long count = COUNT;
+ mp_ptr scratch;
+ mp_limb_t ran;
+ mp_size_t alloc, itch;
+ mp_limb_t rran0, rran1, qran0, qran1;
+ TMP_DECL;
+
+ TESTS_REPS (count, argv, argc);
+
+ maxdbits = MAX_DN;
+ maxnbits = MAX_NN;
+
+ tests_start ();
+ rands = RANDS;
+
+ mpz_init (n);
+ mpz_init (d);
+ mpz_init (q);
+ mpz_init (r);
+ mpz_init (tz);
+ mpz_init (junk);
+
+ maxnn = maxnbits / GMP_NUMB_BITS + 1;
+ maxdn = maxdbits / GMP_NUMB_BITS + 1;
+
+ TMP_MARK;
+
+ qp = TMP_ALLOC_LIMBS (maxnn + 2) + 1;
+ rp = TMP_ALLOC_LIMBS (maxnn + 2) + 1;
+ dnp = TMP_ALLOC_LIMBS (maxdn);
+
+ alloc = 1;
+ scratch = __GMP_ALLOCATE_FUNC_LIMBS (alloc);
+
+ for (test = -300; test < count; test++)
+ {
+ nbits = urandom () % (maxnbits - GMP_NUMB_BITS) + 2 * GMP_NUMB_BITS;
+
+ if (test < 0)
+ dbits = (test + 300) % (nbits - 1) + 1;
+ else
+ dbits = urandom () % (nbits - 1) % maxdbits + 1;
+
+#if RAND_UNIFORM
+#define RANDFUNC mpz_urandomb
+#else
+#define RANDFUNC mpz_rrandomb
+#endif
+
+ do
+ RANDFUNC (d, rands, dbits);
+ while (mpz_sgn (d) == 0);
+ dn = SIZ (d);
+ dup = PTR (d);
+ MPN_COPY (dnp, dup, dn);
+ dnp[dn - 1] |= GMP_NUMB_HIGHBIT;
+
+ if (test % 2 == 0)
+ {
+ RANDFUNC (n, rands, nbits);
+ nn = SIZ (n);
+ ASSERT_ALWAYS (nn >= dn);
+ }
+ else
+ {
+ do
+ {
+ RANDFUNC (q, rands, urandom () % (nbits - dbits + 1));
+ RANDFUNC (r, rands, urandom () % mpz_sizeinbase (d, 2));
+ mpz_mul (n, q, d);
+ mpz_add (n, n, r);
+ nn = SIZ (n);
+ }
+ while (nn > maxnn || nn < dn);
+ }
+
+ ASSERT_ALWAYS (nn <= maxnn);
+ ASSERT_ALWAYS (dn <= maxdn);
+
+ mpz_urandomb (junk, rands, nbits);
+ junkp = PTR (junk);
+
+ np = PTR (n);
+
+ mpz_urandomb (tz, rands, 32);
+ t = mpz_get_ui (tz);
+
+ if (t % 17 == 0)
+ {
+ dnp[dn - 1] = GMP_NUMB_MAX;
+ dup[dn - 1] = GMP_NUMB_MAX;
+ }
+
+ switch ((int) t % 16)
+ {
+ case 0:
+ clearn = urandom () % nn;
+ for (i = clearn; i < nn; i++)
+ np[i] = 0;
+ break;
+ case 1:
+ mpn_sub_1 (np + nn - dn, dnp, dn, urandom ());
+ break;
+ case 2:
+ mpn_add_1 (np + nn - dn, dnp, dn, urandom ());
+ break;
+ }
+
+ if (dn >= 2)
+ invert_pi1 (dinv, dnp[dn - 1], dnp[dn - 2]);
+
+ rran0 = urandom ();
+ rran1 = urandom ();
+ qran0 = urandom ();
+ qran1 = urandom ();
+
+ qp[-1] = qran0;
+ qp[nn - dn + 1] = qran1;
+ rp[-1] = rran0;
+
+ ran = urandom ();
+
+ if ((double) (nn - dn) * dn < 1e5)
+ {
+ /* Test mpn_sbpi1_div_qr */
+ if (dn > 2)
+ {
+ MPN_COPY (rp, np, nn);
+ if (nn > dn)
+ MPN_COPY (qp, junkp, nn - dn);
+ qp[nn - dn] = mpn_sbpi1_div_qr (qp, rp, nn, dnp, dn, dinv.inv32);
+ check_one (qp, rp, np, nn, dnp, dn, "mpn_sbpi1_div_qr", 0);
+ }
+
+ /* Test mpn_sbpi1_divappr_q */
+ if (dn > 2)
+ {
+ MPN_COPY (rp, np, nn);
+ if (nn > dn)
+ MPN_COPY (qp, junkp, nn - dn);
+ qp[nn - dn] = mpn_sbpi1_divappr_q (qp, rp, nn, dnp, dn, dinv.inv32);
+ check_one (qp, NULL, np, nn, dnp, dn, "mpn_sbpi1_divappr_q", 1);
+ }
+
+ /* Test mpn_sbpi1_div_q */
+ if (dn > 2)
+ {
+ MPN_COPY (rp, np, nn);
+ if (nn > dn)
+ MPN_COPY (qp, junkp, nn - dn);
+ qp[nn - dn] = mpn_sbpi1_div_q (qp, rp, nn, dnp, dn, dinv.inv32);
+ check_one (qp, NULL, np, nn, dnp, dn, "mpn_sbpi1_div_q", 0);
+ }
+
+ /* Test mpn_sec_div_qr */
+ itch = mpn_sec_div_qr_itch (nn, dn);
+ if (itch + 1 > alloc)
+ {
+ scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
+ alloc = itch + 1;
+ }
+ scratch[itch] = ran;
+ MPN_COPY (rp, np, nn);
+ if (nn >= dn)
+ MPN_COPY (qp, junkp, nn - dn + 1);
+ qp[nn - dn] = mpn_sec_div_qr (qp, rp, nn, dup, dn, scratch);
+ ASSERT_ALWAYS (ran == scratch[itch]);
+ check_one (qp, rp, np, nn, dup, dn, "mpn_sec_div_qr (unnorm)", 0);
+
+ /* Test mpn_sec_div_r */
+ itch = mpn_sec_div_r_itch (nn, dn);
+ if (itch + 1 > alloc)
+ {
+ scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
+ alloc = itch + 1;
+ }
+ scratch[itch] = ran;
+ MPN_COPY (rp, np, nn);
+ mpn_sec_div_r (rp, nn, dup, dn, scratch);
+ ASSERT_ALWAYS (ran == scratch[itch]);
+ /* Note: Since check_one cannot cope with remainder-only functions, we
+ pass qp[] from the previous function, mpn_sec_div_qr. */
+ check_one (qp, rp, np, nn, dup, dn, "mpn_sec_div_r (unnorm)", 0);
+
+ /* Normalised case, mpn_sec_div_qr */
+ itch = mpn_sec_div_qr_itch (nn, dn);
+ scratch[itch] = ran;
+
+ MPN_COPY (rp, np, nn);
+ if (nn >= dn)
+ MPN_COPY (qp, junkp, nn - dn + 1);
+ qp[nn - dn] = mpn_sec_div_qr (qp, rp, nn, dnp, dn, scratch);
+ ASSERT_ALWAYS (ran == scratch[itch]);
+ check_one (qp, rp, np, nn, dnp, dn, "mpn_sec_div_qr (norm)", 0);
+
+ /* Normalised case, mpn_sec_div_r */
+ itch = mpn_sec_div_r_itch (nn, dn);
+ scratch[itch] = ran;
+ MPN_COPY (rp, np, nn);
+ mpn_sec_div_r (rp, nn, dnp, dn, scratch);
+ ASSERT_ALWAYS (ran == scratch[itch]);
+ /* Note: Since check_one cannot cope with remainder-only functions, we
+ pass qp[] from the previous function, mpn_sec_div_qr. */
+ check_one (qp, rp, np, nn, dnp, dn, "mpn_sec_div_r (norm)", 0);
+ }
+
+ /* Test mpn_dcpi1_div_qr */
+ if (dn >= 6 && nn - dn >= 3)
+ {
+ MPN_COPY (rp, np, nn);
+ if (nn > dn)
+ MPN_COPY (qp, junkp, nn - dn);
+ qp[nn - dn] = mpn_dcpi1_div_qr (qp, rp, nn, dnp, dn, &dinv);
+ ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
+ ASSERT_ALWAYS (rp[-1] == rran0);
+ check_one (qp, rp, np, nn, dnp, dn, "mpn_dcpi1_div_qr", 0);
+ }
+
+ /* Test mpn_dcpi1_divappr_q */
+ if (dn >= 6 && nn - dn >= 3)
+ {
+ MPN_COPY (rp, np, nn);
+ if (nn > dn)
+ MPN_COPY (qp, junkp, nn - dn);
+ qp[nn - dn] = mpn_dcpi1_divappr_q (qp, rp, nn, dnp, dn, &dinv);
+ ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
+ ASSERT_ALWAYS (rp[-1] == rran0);
+ check_one (qp, NULL, np, nn, dnp, dn, "mpn_dcpi1_divappr_q", 1);
+ }
+
+ /* Test mpn_dcpi1_div_q */
+ if (dn >= 6 && nn - dn >= 3)
+ {
+ MPN_COPY (rp, np, nn);
+ if (nn > dn)
+ MPN_COPY (qp, junkp, nn - dn);
+ qp[nn - dn] = mpn_dcpi1_div_q (qp, rp, nn, dnp, dn, &dinv);
+ ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
+ ASSERT_ALWAYS (rp[-1] == rran0);
+ check_one (qp, NULL, np, nn, dnp, dn, "mpn_dcpi1_div_q", 0);
+ }
+
+ /* Test mpn_mu_div_qr */
+ if (nn - dn > 2 && dn >= 2)
+ {
+ itch = mpn_mu_div_qr_itch (nn, dn, 0);
+ if (itch + 1 > alloc)
+ {
+ scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
+ alloc = itch + 1;
+ }
+ scratch[itch] = ran;
+ MPN_COPY (qp, junkp, nn - dn);
+ MPN_ZERO (rp, dn);
+ rp[dn] = rran1;
+ qp[nn - dn] = mpn_mu_div_qr (qp, rp, np, nn, dnp, dn, scratch);
+ ASSERT_ALWAYS (ran == scratch[itch]);
+ ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
+ ASSERT_ALWAYS (rp[-1] == rran0); ASSERT_ALWAYS (rp[dn] == rran1);
+ check_one (qp, rp, np, nn, dnp, dn, "mpn_mu_div_qr", 0);
+ }
+
+ /* Test mpn_mu_divappr_q */
+ if (nn - dn > 2 && dn >= 2)
+ {
+ itch = mpn_mu_divappr_q_itch (nn, dn, 0);
+ if (itch + 1 > alloc)
+ {
+ scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
+ alloc = itch + 1;
+ }
+ scratch[itch] = ran;
+ MPN_COPY (qp, junkp, nn - dn);
+ qp[nn - dn] = mpn_mu_divappr_q (qp, np, nn, dnp, dn, scratch);
+ ASSERT_ALWAYS (ran == scratch[itch]);
+ ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
+ check_one (qp, NULL, np, nn, dnp, dn, "mpn_mu_divappr_q", 4);
+ }
+
+ /* Test mpn_mu_div_q */
+ if (nn - dn > 2 && dn >= 2)
+ {
+ itch = mpn_mu_div_q_itch (nn, dn, 0);
+ if (itch + 1> alloc)
+ {
+ scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
+ alloc = itch + 1;
+ }
+ scratch[itch] = ran;
+ MPN_COPY (qp, junkp, nn - dn);
+ qp[nn - dn] = mpn_mu_div_q (qp, np, nn, dnp, dn, scratch);
+ ASSERT_ALWAYS (ran == scratch[itch]);
+ ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
+ check_one (qp, NULL, np, nn, dnp, dn, "mpn_mu_div_q", 0);
+ }
+
+ if (1)
+ {
+ itch = nn + 1;
+ if (itch + 1> alloc)
+ {
+ scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
+ alloc = itch + 1;
+ }
+ scratch[itch] = ran;
+ MPN_COPY (qp, junkp, nn - dn + 1);
+ mpn_div_q (qp, np, nn, dup, dn, scratch);
+ ASSERT_ALWAYS (ran == scratch[itch]);
+ ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
+ check_one (qp, NULL, np, nn, dup, dn, "mpn_div_q", 0);
+ }
+
+ if (dn >= 2 && nn >= 2)
+ {
+ mp_limb_t qh;
+
+ /* mpn_divrem_2 */
+ MPN_COPY (rp, np, nn);
+ qp[nn - 2] = qp[nn-1] = qran1;
+
+ qh = mpn_divrem_2 (qp, 0, rp, nn, dnp + dn - 2);
+ ASSERT_ALWAYS (qp[nn - 2] == qran1);
+ ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - 1] == qran1);
+ qp[nn - 2] = qh;
+ check_one (qp, rp, np, nn, dnp + dn - 2, 2, "mpn_divrem_2", 0);
+
+ /* Missing: divrem_2 with fraction limbs. */
+
+ /* mpn_div_qr_2 */
+ qp[nn - 2] = qran1;
+
+ qh = mpn_div_qr_2 (qp, rp, np, nn, dup + dn - 2);
+ ASSERT_ALWAYS (qp[nn - 2] == qran1);
+ ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - 1] == qran1);
+ qp[nn - 2] = qh;
+ check_one (qp, rp, np, nn, dup + dn - 2, 2, "mpn_div_qr_2", 0);
+ }
+ if (dn >= 1 && nn >= 1)
+ {
+ /* mpn_div_qr_1 */
+ mp_limb_t qh;
+ qp[nn-1] = qran1;
+ rp[0] = mpn_div_qr_1 (qp, &qh, np, nn, dnp[dn - 1]);
+ ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - 1] == qran1);
+ qp[nn - 1] = qh;
+ check_one (qp, rp, np, nn, dnp + dn - 1, 1, "mpn_div_qr_1", 0);
+ }
+ }
+
+ __GMP_FREE_FUNC_LIMBS (scratch, alloc);
+
+ TMP_FREE;
+
+ mpz_clear (n);
+ mpz_clear (d);
+ mpz_clear (q);
+ mpz_clear (r);
+ mpz_clear (tz);
+ mpz_clear (junk);
+
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-divrem_1.c b/vendor/gmp-6.3.0/tests/mpn/t-divrem_1.c
new file mode 100644
index 0000000..991b7da
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-divrem_1.c
@@ -0,0 +1,123 @@
+/* Test mpn_divrem_1 and mpn_preinv_divrem_1.
+
+Copyright 2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_data (void)
+{
+ static const struct {
+ mp_limb_t n[1];
+ mp_size_t nsize;
+ mp_limb_t d;
+ mp_size_t qxn;
+ mp_limb_t want_q[5];
+ mp_limb_t want_r;
+ } data[] = {
+ { { 0 }, 1, 1, 0,
+ { 0 }, 0},
+
+ { { 5 }, 1, 2, 0,
+ { 2 }, 1},
+
+ /* Exercises the q update in the nl == constant 0 case of
+ udiv_qrnnd_preinv3. Test case copied from t-fat.c. */
+ { { 287 }, 1, 7, 1,
+ { 0, 41 }, 0 },
+
+#if GMP_NUMB_BITS == 32
+ { { 0x3C }, 1, 0xF2, 1,
+ { 0x3F789854, 0 }, 0x98 },
+#endif
+
+#if GMP_NUMB_BITS == 64
+ { { 0x3C }, 1, 0xF2, 1,
+ { CNST_LIMB(0x3F789854A0CB1B81), 0 }, 0x0E },
+
+ /* This case exposed some wrong code generated by SGI cc on mips64 irix
+ 6.5 with -n32 -O2, in the fractional loop for normalized divisor
+ using udiv_qrnnd_preinv. A test "x>al" in one of the sub_ddmmss
+ expansions came out wrong, leading to an incorrect quotient. */
+ { { CNST_LIMB(0x3C00000000000000) }, 1, CNST_LIMB(0xF200000000000000), 1,
+ { CNST_LIMB(0x3F789854A0CB1B81), 0 }, CNST_LIMB(0x0E00000000000000) },
+#endif
+ };
+
+ mp_limb_t dinv, got_r, got_q[numberof(data[0].want_q)];
+ mp_size_t qsize;
+ int i, shift;
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ qsize = data[i].nsize + data[i].qxn;
+ ASSERT_ALWAYS (qsize <= numberof (got_q));
+
+ got_r = mpn_divrem_1 (got_q, data[i].qxn, data[i].n, data[i].nsize,
+ data[i].d);
+ if (got_r != data[i].want_r
+ || refmpn_cmp (got_q, data[i].want_q, qsize) != 0)
+ {
+ printf ("mpn_divrem_1 wrong at data[%d]\n", i);
+ bad:
+ mpn_trace (" n", data[i].n, data[i].nsize);
+ printf (" nsize=%ld\n", (long) data[i].nsize);
+ mp_limb_trace (" d", data[i].d);
+ printf (" qxn=%ld\n", (long) data[i].qxn);
+ mpn_trace (" want q", data[i].want_q, qsize);
+ mpn_trace (" got q", got_q, qsize);
+ mp_limb_trace (" want r", data[i].want_r);
+ mp_limb_trace (" got r", got_r);
+ abort ();
+ }
+
+ /* test if available */
+#if USE_PREINV_DIVREM_1 || HAVE_NATIVE_mpn_preinv_divrem_1
+ shift = refmpn_count_leading_zeros (data[i].d);
+ dinv = refmpn_invert_limb (data[i].d << shift);
+ got_r = mpn_preinv_divrem_1 (got_q, data[i].qxn,
+ data[i].n, data[i].nsize,
+ data[i].d, dinv, shift);
+ if (got_r != data[i].want_r
+ || refmpn_cmp (got_q, data[i].want_q, qsize) != 0)
+ {
+ printf ("mpn_preinv divrem_1 wrong at data[%d]\n", i);
+ printf (" shift=%d\n", shift);
+ mp_limb_trace (" dinv", dinv);
+ goto bad;
+ }
+#endif
+ }
+}
+
+int
+main (void)
+{
+ tests_start ();
+ mp_trace_base = -16;
+
+ check_data ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-fat.c b/vendor/gmp-6.3.0/tests/mpn/t-fat.c
new file mode 100644
index 0000000..4e71017
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-fat.c
@@ -0,0 +1,310 @@
+/* Test fat binary setups.
+
+Copyright 2003, 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gmp-impl.h"
+#include "longlong.h"
+#include "tests.h"
+
+
+/* In this program we're aiming to pick up certain subtle problems that
+ might creep into a fat binary.
+
+ 1. We want to ensure the application entry point routines like
+ __gmpn_add_n dispatch to the correct field of __gmpn_cpuvec.
+
+ Note that these routines are not exercised as a side effect of other
+ tests (eg. the mpz routines). Internally the fields of __gmpn_cpuvec
+ are used directly, so we need to write test code explicitly calling
+ the mpn functions, like an application will have.
+
+ 2. We want to ensure the initial __gmpn_cpuvec data has the initializer
+ function pointers in the correct fields, and that those initializer
+ functions dispatch to their correct corresponding field once
+ initialization has been done.
+
+ Only one of the initializer routines executes in a normal program,
+ since that routine sets all the pointers to actual mpn functions. We
+ forcibly reset __gmpn_cpuvec so we can run each.
+
+ In both cases for the above, the data put through the functions is
+ nothing special, just enough to verify that for instance an add_n is
+ really doing an add_n and has not for instance mistakenly gone to sub_n
+ or something.
+
+ The loop around each test will exercise the initializer routine on the
+ first iteration, and the dispatcher routine on the second.
+
+ If the dispatcher and/or initializer routines are generated mechanically
+ via macros (eg. mpn/x86/fat/fat_entry.asm) then there shouldn't be too
+ much risk of them going wrong, provided the structure layout is correctly
+ expressed. But if they're in C then it's good to guard against typos in
+ what is rather repetitive code. The initializer data for __gmpn_cpuvec
+ in fat.c is always done by hand and is likewise a bit repetitive. */
+
+
+/* dummies when not a fat binary */
+#if ! WANT_FAT_BINARY
+struct cpuvec_t {
+ int dummy;
+};
+struct cpuvec_t __gmpn_cpuvec;
+#define ITERATE_FAT_THRESHOLDS() do { } while (0)
+#endif
+
+/* saved from program startup */
+struct cpuvec_t initial_cpuvec;
+
+void
+check_functions (void)
+{
+ mp_limb_t wp[2], xp[2], yp[2], r;
+ int i;
+
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = 123;
+ yp[0] = 456;
+ mpn_add_n (wp, xp, yp, (mp_size_t) 1);
+ ASSERT_ALWAYS (wp[0] == 579);
+ }
+
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = 123;
+ wp[0] = 456;
+ r = mpn_addmul_1 (wp, xp, (mp_size_t) 1, CNST_LIMB(2));
+ ASSERT_ALWAYS (wp[0] == 702);
+ ASSERT_ALWAYS (r == 0);
+ }
+
+#if HAVE_NATIVE_mpn_copyd
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = 123;
+ xp[1] = 456;
+ mpn_copyd (xp+1, xp, (mp_size_t) 1);
+ ASSERT_ALWAYS (xp[1] == 123);
+ }
+#endif
+
+#if HAVE_NATIVE_mpn_copyi
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = 123;
+ xp[1] = 456;
+ mpn_copyi (xp, xp+1, (mp_size_t) 1);
+ ASSERT_ALWAYS (xp[0] == 456);
+ }
+#endif
+
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = 1605;
+ mpn_divexact_1 (wp, xp, (mp_size_t) 1, CNST_LIMB(5));
+ ASSERT_ALWAYS (wp[0] == 321);
+ }
+
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = 1296;
+ r = mpn_divexact_by3c (wp, xp, (mp_size_t) 1, CNST_LIMB(0));
+ ASSERT_ALWAYS (wp[0] == 432);
+ ASSERT_ALWAYS (r == 0);
+ }
+
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = 287;
+ r = mpn_divrem_1 (wp, (mp_size_t) 1, xp, (mp_size_t) 1, CNST_LIMB(7));
+ ASSERT_ALWAYS (wp[1] == 41);
+ ASSERT_ALWAYS (wp[0] == 0);
+ ASSERT_ALWAYS (r == 0);
+ }
+
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = 12;
+ r = mpn_gcd_1 (xp, (mp_size_t) 1, CNST_LIMB(9));
+ ASSERT_ALWAYS (r == 3);
+ }
+
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = 0x1001;
+ mpn_lshift (wp, xp, (mp_size_t) 1, 1);
+ ASSERT_ALWAYS (wp[0] == 0x2002);
+ }
+
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = 14;
+ r = mpn_mod_1 (xp, (mp_size_t) 1, CNST_LIMB(4));
+ ASSERT_ALWAYS (r == 2);
+ }
+
+#if (GMP_NUMB_BITS % 4) == 0
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ int bits = (GMP_NUMB_BITS / 4) * 3;
+ mp_limb_t mod = (CNST_LIMB(1) << bits) - 1;
+ mp_limb_t want = GMP_NUMB_MAX % mod;
+ xp[0] = GMP_NUMB_MAX;
+ r = mpn_mod_34lsub1 (xp, (mp_size_t) 1);
+ ASSERT_ALWAYS (r % mod == want);
+ }
+#endif
+
+ /* DECL_modexact_1c_odd ((*modexact_1c_odd)); */
+
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = 14;
+ r = mpn_mul_1 (wp, xp, (mp_size_t) 1, CNST_LIMB(4));
+ ASSERT_ALWAYS (wp[0] == 56);
+ ASSERT_ALWAYS (r == 0);
+ }
+
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = 5;
+ yp[0] = 7;
+ mpn_mul_basecase (wp, xp, (mp_size_t) 1, yp, (mp_size_t) 1);
+ ASSERT_ALWAYS (wp[0] == 35);
+ ASSERT_ALWAYS (wp[1] == 0);
+ }
+
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = 5;
+ yp[0] = 7;
+ mpn_mullo_basecase (wp, xp, yp, (mp_size_t) 1);
+ ASSERT_ALWAYS (wp[0] == 35);
+ }
+
+#if HAVE_NATIVE_mpn_preinv_divrem_1 && GMP_NAIL_BITS == 0
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = 0x101;
+ r = mpn_preinv_divrem_1 (wp, (mp_size_t) 1, xp, (mp_size_t) 1,
+ GMP_LIMB_HIGHBIT,
+ refmpn_invert_limb (GMP_LIMB_HIGHBIT), 0);
+ ASSERT_ALWAYS (wp[0] == 0x202);
+ ASSERT_ALWAYS (wp[1] == 0);
+ ASSERT_ALWAYS (r == 0);
+ }
+#endif
+
+#if GMP_NAIL_BITS == 0
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = GMP_LIMB_HIGHBIT+123;
+ r = mpn_preinv_mod_1 (xp, (mp_size_t) 1, GMP_LIMB_HIGHBIT,
+ refmpn_invert_limb (GMP_LIMB_HIGHBIT));
+ ASSERT_ALWAYS (r == 123);
+ }
+#endif
+
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = 0x8008;
+ mpn_rshift (wp, xp, (mp_size_t) 1, 1);
+ ASSERT_ALWAYS (wp[0] == 0x4004);
+ }
+
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = 5;
+ mpn_sqr_basecase (wp, xp, (mp_size_t) 1);
+ ASSERT_ALWAYS (wp[0] == 25);
+ ASSERT_ALWAYS (wp[1] == 0);
+ }
+
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = 999;
+ yp[0] = 666;
+ mpn_sub_n (wp, xp, yp, (mp_size_t) 1);
+ ASSERT_ALWAYS (wp[0] == 333);
+ }
+
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
+ for (i = 0; i < 2; i++)
+ {
+ xp[0] = 123;
+ wp[0] = 456;
+ r = mpn_submul_1 (wp, xp, (mp_size_t) 1, CNST_LIMB(2));
+ ASSERT_ALWAYS (wp[0] == 210);
+ ASSERT_ALWAYS (r == 0);
+ }
+}
+
+/* Expect the first use of each fat threshold to invoke the necessary
+ initialization. */
+void
+check_thresholds (void)
+{
+#define ITERATE(name,field) \
+ do { \
+ __gmpn_cpuvec_initialized = 0; \
+ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec)); \
+ ASSERT_ALWAYS (name != 0); \
+ ASSERT_ALWAYS (name == __gmpn_cpuvec.field); \
+ ASSERT_ALWAYS (__gmpn_cpuvec_initialized); \
+ } while (0)
+
+ ITERATE_FAT_THRESHOLDS ();
+}
+
+
+int
+main (void)
+{
+ memcpy (&initial_cpuvec, &__gmpn_cpuvec, sizeof (__gmpn_cpuvec));
+
+ tests_start ();
+
+ check_functions ();
+ check_thresholds ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-fib2m.c b/vendor/gmp-6.3.0/tests/mpn/t-fib2m.c
new file mode 100644
index 0000000..5ad3942
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-fib2m.c
@@ -0,0 +1,344 @@
+/* Test mpn_fib2m.
+
+Copyright 2018 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#define MAX_K_BITS 16
+#define MAX_K (1L << MAX_K_BITS)
+#define MIN_K 1
+
+#define MAX_MN 20
+#define MAX_KN 30
+
+#define COUNT 200
+
+static int
+test_fib2_fib2m (int count, gmp_randstate_ptr rands)
+{
+ int test;
+ mp_ptr fk, fks1, fkm, fks1m, mp, qp;
+ mp_size_t mn, fn, size, max_mn;
+ TMP_DECL;
+
+ size = MPN_FIB2_SIZE (MAX_K);
+ max_mn = size / 4 + 10;
+ ASSERT (max_mn < size);
+
+ TMP_MARK;
+ fk = TMP_ALLOC_LIMBS (size);
+ fks1 = TMP_ALLOC_LIMBS (size);
+ qp = TMP_ALLOC_LIMBS (size);
+ mp = TMP_ALLOC_LIMBS (max_mn);
+ fkm = 1 + TMP_ALLOC_LIMBS (max_mn * 2 + 1 + 2);
+ fks1m = 1 + TMP_ALLOC_LIMBS (max_mn * 2 + 1 + 2);
+
+ for (test = 1; test <= count; ++test)
+ {
+ mp_limb_t fk_before, fk_after, fk1_before, fk1_after;
+ int signflip;
+ unsigned long k;
+
+ k = MIN_K +
+ gmp_urandomm_ui (rands, test < MAX_K_BITS ?
+ MAX_K >> test : (MAX_K - MIN_K));
+
+ fn = mpn_fib2_ui (fk, fks1, k);
+ do {
+ mn = gmp_urandomm_ui (rands, MAX_K) % (fn / 4 + 10);
+ } while (mn == 0);
+ ASSERT (mn <= max_mn);
+ mpn_random2 (mp, mn);
+ ASSERT (mp [mn - 1] != 0);
+
+ if (fn >= mn)
+ {
+ mpn_tdiv_qr (qp, fk, 0, fk, fn, mp, mn);
+ mpn_tdiv_qr (qp, fks1, 0, fks1, fn, mp, mn);
+ }
+ else
+ {
+ MPN_ZERO (fk + fn, mn - fn);
+ MPN_ZERO (fks1 + fn, mn - fn);
+ }
+
+ mpn_random2 (fkm - 1, 2*mn+1+2);
+ fk_before = fkm [-1];
+ fk_after = fkm [2 * mn + 1];
+
+ mpn_random2 (fks1m - 1, 2*mn+1+2);
+ fk1_before = fks1m [-1];
+ fk1_after = fks1m [2 * mn + 1];
+
+ qp [0] = k;
+ signflip = mpn_fib2m (fkm, fks1m, qp, 1, mp, mn);
+ if (fkm [-1] != fk_before || fkm [2 * mn + 1] != fk_after
+ || fks1m [-1] != fk1_before || fks1m [2 * mn + 1] != fk1_after)
+ {
+ printf ("REDZONE violation in test %d, k = %lu, mn = %u\n",
+ test, k, (unsigned) mn);
+ if (fkm[-1] != fk_before)
+ {
+ printf ("before fkm:"); mpn_dump (fkm - 1, 1);
+ printf ("keep: "); mpn_dump (&fk_before, 1);
+ }
+ if (fkm[2 * mn + 1] != fk_after)
+ {
+ printf ("after fkm:"); mpn_dump (fkm + 2 * mn + 1, 1);
+ printf ("keep: "); mpn_dump (&fk_after, 1);
+ }
+ if (fks1m[-1] != fk1_before)
+ {
+ printf ("before fks1m:"); mpn_dump (fks1m - 1, 1);
+ printf ("keep: "); mpn_dump (&fk1_before, 1);
+ }
+ if (fks1m[2 * mn + 1] != fk1_after)
+ {
+ printf ("after fks1m:"); mpn_dump (fks1m + 2 * mn + 1, 1);
+ printf ("keep: "); mpn_dump (&fk1_after, 1);
+ }
+ abort();
+ }
+
+ if (mpn_cmp (fkm, fk, mn) != 0)
+ {
+ if (mpn_sub_n (fk, mp, fk, mn) || mpn_cmp (fkm, fk, mn) != 0)
+ {
+ printf ("ERROR(k) in test %d, k = %lu, mn = %u\n",
+ test, k, (unsigned) mn);
+ mpn_dump (fk, mn);
+ mpn_dump (fkm, mn);
+ mpn_dump (mp, mn);
+ abort();
+ }
+ signflip ^= 1;
+ }
+
+ if (mpn_cmp (fks1m, fks1, mn) != 0)
+ {
+ if (mpn_sub_n (fks1, mp, fks1, mn) || mpn_cmp (fks1m, fks1, mn) != 0)
+ {
+ printf ("ERROR(k-1) in test %d, k = %lu, mn = %u\n",
+ test, k, (unsigned) mn);
+ mpn_dump (fks1, mn);
+ mpn_dump (fks1m, mn);
+ mpn_dump (mp, mn);
+ abort();
+ }
+ signflip ^= 1;
+ }
+
+ if (signflip != 0 && ! mpn_zero_p (fks1m, mn) && ! mpn_zero_p (fkm, mn))
+ {
+ if ((mp [0] & 1) == 0) /* Should we test only odd modulus-es? */
+ {
+ if (! mpn_lshift (fks1m, fks1m, mn, 1) &&
+ mpn_cmp (mp, fks1m, mn) == 0)
+ continue;
+ if (! mpn_lshift (fkm, fkm, mn, 1) &&
+ mpn_cmp (mp, fkm, mn) == 0)
+ continue;
+ }
+ printf ("ERROR(sign) in test %d, k = %lu, mn = %u\n",
+ test, k, (unsigned) mn);
+ abort();
+ }
+ }
+ TMP_FREE;
+ return 0;
+}
+
+static int
+test_fib2m_2exp (int count, gmp_randstate_ptr rands)
+{
+ int test;
+ mp_ptr fka, fks1a, fkb, fks1b, mp, kp;
+ TMP_DECL;
+
+ TMP_MARK;
+ kp = TMP_ALLOC_LIMBS (MAX_KN);
+ mp = TMP_ALLOC_LIMBS (MAX_MN);
+ fka = 1 + TMP_ALLOC_LIMBS (MAX_MN * 2 + 1 + 2);
+ fks1a = 1 + TMP_ALLOC_LIMBS (MAX_MN * 2 + 1 + 2);
+ fkb = 1 + TMP_ALLOC_LIMBS (MAX_MN * 2 + 1 + 2);
+ fks1b = 1 + TMP_ALLOC_LIMBS (MAX_MN * 2 + 1 + 2);
+
+ for (test = 1; test <= count; ++test)
+ {
+ mp_limb_t fka_before, fka_after, fk1a_before, fk1a_after;
+ mp_limb_t fkb_before, fkb_after, fk1b_before, fk1b_after;
+ mp_size_t mn, kn;
+ int signflip;
+ mp_bitcnt_t exp2;
+
+ mn = gmp_urandomm_ui (rands, MAX_MN - 1) + 1;
+ mpn_random2 (mp, mn);
+
+ exp2 = MIN_K + 1 + gmp_urandomm_ui (rands, MAX_KN * GMP_NUMB_BITS - MIN_K - 1);
+
+ kn = BITS_TO_LIMBS (exp2);
+ MPN_ZERO (kp, kn - 1);
+ kp [kn - 1] = CNST_LIMB (1) << ((exp2 - 1) % GMP_NUMB_BITS);
+
+ mpn_random2 (fka - 1, 2*mn+1+2);
+ fka_before = fka [-1];
+ fka_after = fka [2 * mn + 1];
+
+ mpn_random2 (fks1a - 1, 2*mn+1+2);
+ fk1a_before = fks1a [-1];
+ fk1a_after = fks1a [2 * mn + 1];
+
+ signflip = mpn_fib2m (fka, fks1a, kp, kn, mp, mn);
+ if (fka [-1] != fka_before || fka [2 * mn + 1] != fka_after
+ || fks1a [-1] != fk1a_before || fks1a [2 * mn + 1] != fk1a_after)
+ {
+ printf ("REDZONE(a) violation in test %d, exp2 = %lu\n", test, exp2);
+ if (fka[-1] != fka_before)
+ {
+ printf ("before fka:"); mpn_dump (fka - 1, 1);
+ printf ("keep: "); mpn_dump (&fka_before, 1);
+ }
+ if (fka[2 * mn + 1] != fka_after)
+ {
+ printf ("after fka:"); mpn_dump (fka + 2 * mn + 1, 1);
+ printf ("keep: "); mpn_dump (&fka_after, 1);
+ }
+ if (fks1a[-1] != fk1a_before)
+ {
+ printf ("before fks1a:"); mpn_dump (fks1a - 1, 1);
+ printf ("keep: "); mpn_dump (&fk1a_before, 1);
+ }
+ if (fks1a[2 * mn + 1] != fk1a_after)
+ {
+ printf ("after fks1a:"); mpn_dump (fks1a + 2 * mn + 1, 1);
+ printf ("keep: "); mpn_dump (&fk1a_after, 1);
+ }
+ abort();
+ }
+
+ if (signflip && ! mpn_zero_p (fks1a, mn))
+ mpn_sub_n (fks1a, mp, fks1a, mn);
+ if (mpn_sub_n (fka, fka, fks1a, mn))
+ ASSERT_CARRY (mpn_add_n (fka, fka, mp, mn));
+
+ mpn_sub_1 (kp, kp, kn, 1);
+ ASSERT (exp2 % GMP_NUMB_BITS == 1 || kp [kn - 1] != 0);
+ kn -= kp [kn - 1] == 0;
+
+ mpn_random2 (fkb - 1, 2*mn+1+2);
+ fkb_before = fkb [-1];
+ fkb_after = fkb [2 * mn + 1];
+
+ mpn_random2 (fks1b - 1, 2*mn+1+2);
+ fk1b_before = fks1b [-1];
+ fk1b_after = fks1b [2 * mn + 1];
+
+ signflip = mpn_fib2m (fkb, fks1b, kp, kn, mp, mn);
+ if (fkb [-1] != fkb_before || fkb [2 * mn + 1] != fkb_after
+ || fks1b [-1] != fk1b_before || fks1b [2 * mn + 1] != fk1b_after)
+ {
+ printf ("REDZONE(b) violation in test %d, exp2 = %lu\n", test, exp2);
+ if (fkb[-1] != fkb_before)
+ {
+ printf ("before fkb:"); mpn_dump (fkb - 1, 1);
+ printf ("keep: "); mpn_dump (&fkb_before, 1);
+ }
+ if (fkb[2 * mn + 1] != fkb_after)
+ {
+ printf ("after fkb:"); mpn_dump (fkb + 2 * mn + 1, 1);
+ printf ("keep: "); mpn_dump (&fkb_after, 1);
+ }
+ if (fks1b[-1] != fk1b_before)
+ {
+ printf ("before fks1b:"); mpn_dump (fks1b - 1, 1);
+ printf ("keep: "); mpn_dump (&fk1b_before, 1);
+ }
+ if (fks1b[2 * mn + 1] != fk1b_after)
+ {
+ printf ("after fks1b:"); mpn_dump (fks1b + 2 * mn + 1, 1);
+ printf ("keep: "); mpn_dump (&fk1b_after, 1);
+ }
+ abort();
+ }
+
+ if (mpn_cmp (fks1a, fkb, mn) != 0)
+ {
+ if (mpn_sub_n (fkb, mp, fkb, mn) || mpn_cmp (fks1a, fkb, mn) != 0)
+ {
+ printf ("ERROR(k) in test %d, exp2 = %lu\n", test, exp2);
+ mpn_dump (fks1a, mn);
+ mpn_dump (fkb, mn);
+ mpn_dump (mp, mn);
+ abort();
+ }
+ signflip ^= 1;
+ }
+
+ if (mpn_cmp (fka, fks1b, mn) != 0)
+ {
+ if (mpn_sub_n (fks1b, mp, fks1b, mn) || mpn_cmp (fka, fks1b, mn) != 0)
+ {
+ printf ("ERROR(k-1) in test %d, exp2 = %lu\n", test, exp2);
+ mpn_dump (fka, mn);
+ mpn_dump (fks1b, mn);
+ mpn_dump (mp, mn);
+ abort();
+ }
+ signflip ^= 1;
+ }
+
+ if (signflip != 0 && ! mpn_zero_p (fks1b, mn) && ! mpn_zero_p (fkb, mn))
+ {
+ if ((mp [0] & 1) == 0) /* Should we test only odd modulus-es? */
+ {
+ if (! mpn_lshift (fks1b, fks1b, mn, 1) &&
+ mpn_cmp (mp, fks1b, mn) == 0)
+ continue;
+ if (! mpn_lshift (fkb, fkb, mn, 1) &&
+ mpn_cmp (mp, fkb, mn) == 0)
+ continue;
+ }
+ printf ("ERROR(sign) in test %d, exp2 = %lu\n",
+ test, exp2);
+ abort();
+ }
+ }
+ TMP_FREE;
+ return 0;
+}
+
+int
+main (int argc, char **argv)
+{
+ int count = COUNT;
+ gmp_randstate_ptr rands;
+
+ tests_start ();
+ TESTS_REPS (count, argv, argc);
+ rands = RANDS;
+
+ test_fib2_fib2m (count / 2, rands);
+ test_fib2m_2exp (count / 2, rands);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-gcd_11.c b/vendor/gmp-6.3.0/tests/mpn/t-gcd_11.c
new file mode 100644
index 0000000..2b4de2f
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-gcd_11.c
@@ -0,0 +1,86 @@
+/* Test mpn_gcd_11.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#ifndef COUNT
+#define COUNT 500000
+#endif
+
+static void
+one_test (mp_limb_t a, mp_limb_t b, mp_limb_t ref)
+{
+ mp_limb_t r = mpn_gcd_11 (a, b);
+ if (r != ref)
+ {
+ gmp_fprintf (stderr,
+ "gcd_11 (0x%Mx, 0x%Mx) failed, got: 0x%Mx, ref: 0x%Mx\n",
+ a, b, r, ref);
+ abort();
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ mpz_t a, b;
+ int count = COUNT;
+ int test;
+ gmp_randstate_ptr rands;
+
+ TESTS_REPS (count, argv, argc);
+
+ tests_start ();
+ rands = RANDS;
+
+ mpz_init (a);
+ mpz_init (b);
+ for (test = 0; test < count; test++)
+ {
+ mp_limb_t al, bl;
+ mp_bitcnt_t asize = 1 + gmp_urandomm_ui(rands, GMP_NUMB_BITS);
+ mp_bitcnt_t bsize = 1 + gmp_urandomm_ui(rands, GMP_NUMB_BITS);
+ if (test & 1)
+ {
+ mpz_urandomb (a, rands, asize);
+ mpz_urandomb (b, rands, bsize);
+ }
+ else
+ {
+ mpz_rrandomb (a, rands, asize);
+ mpz_rrandomb (b, rands, bsize);
+ }
+
+ mpz_setbit (a, 0);
+ mpz_setbit (b, 0);
+ al = mpz_getlimbn (a, 0);
+ bl = mpz_getlimbn (b, 0);
+ one_test (al, bl, refmpn_gcd_11 (al, bl));
+ }
+
+ mpz_clear (a);
+ mpz_clear (b);
+
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-gcd_22.c b/vendor/gmp-6.3.0/tests/mpn/t-gcd_22.c
new file mode 100644
index 0000000..314bf18
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-gcd_22.c
@@ -0,0 +1,87 @@
+/* Test mpn_gcd_22.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#ifndef COUNT
+#define COUNT 150000
+#endif
+
+static void
+one_test (mpz_srcptr a, mpz_srcptr b, mpz_srcptr ref)
+{
+ mp_double_limb_t r = mpn_gcd_22 (mpz_getlimbn (a, 1), mpz_getlimbn (a, 0),
+ mpz_getlimbn (b, 1), mpz_getlimbn (b, 0));
+ if (r.d0 != mpz_getlimbn (ref, 0) || r.d1 != mpz_getlimbn (ref, 1))
+ {
+ gmp_fprintf (stderr,
+ "gcd_22 (0x%Zx, 0x%Zx) failed, got: g1 = 0x%Mx g0 = %Mx, ref: 0x%Zx\n",
+ a, b, r.d1, r.d0, ref);
+ abort();
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ mpz_t a, b, ref;
+ int count = COUNT;
+ int test;
+ gmp_randstate_ptr rands;
+
+ TESTS_REPS (count, argv, argc);
+
+ tests_start ();
+ rands = RANDS;
+
+ mpz_init (a);
+ mpz_init (b);
+ mpz_init (ref);
+ for (test = 0; test < count; test++)
+ {
+ mp_bitcnt_t asize = 1 + gmp_urandomm_ui(rands, 2*GMP_NUMB_BITS);
+ mp_bitcnt_t bsize = 1 + gmp_urandomm_ui(rands, 2*GMP_NUMB_BITS);
+ if (test & 1)
+ {
+ mpz_urandomb (a, rands, asize);
+ mpz_urandomb (b, rands, bsize);
+ }
+ else
+ {
+ mpz_rrandomb (a, rands, asize);
+ mpz_rrandomb (b, rands, bsize);
+ }
+
+ mpz_setbit (a, 0);
+ mpz_setbit (b, 0);
+ refmpz_gcd (ref, a, b);
+ one_test (a, b, ref);
+ }
+
+ mpz_clear (a);
+ mpz_clear (b);
+ mpz_clear (ref);
+
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-gcdext_1.c b/vendor/gmp-6.3.0/tests/mpn/t-gcdext_1.c
new file mode 100644
index 0000000..1e73a11
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-gcdext_1.c
@@ -0,0 +1,134 @@
+/* Test mpn_gcdext_1.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#ifndef COUNT
+#define COUNT 250000
+#endif
+
+static void
+set_signed_limb (mpz_t r, mp_limb_signed_t x)
+{
+ mpz_t t;
+ mp_limb_t abs_x = ABS_CAST(mp_limb_t, x);
+ mpz_set (r, mpz_roinit_n (t, &abs_x, 1));
+ if (x < 0)
+ mpz_neg (r, r);
+}
+
+static void
+one_test (mp_limb_t a, mp_limb_t b)
+{
+ mp_limb_signed_t s, t;
+ mp_limb_t g;
+
+ g = mpn_gcdext_1 (&s, &t, a, b);
+
+ if (g > 0)
+ {
+ mpz_t d, sz, tz, tmp;
+
+ mpz_init (d);
+ mpz_init (sz);
+ mpz_init (tz);
+
+ set_signed_limb (sz, s);
+ set_signed_limb (tz, t);
+
+ mpz_mul (d, mpz_roinit_n (tmp, &a, 1), sz);
+ mpz_addmul (d, mpz_roinit_n (tmp, &b, 1), tz);
+
+ if (mpz_cmp (d, mpz_roinit_n (tmp, &g, 1)) == 0
+ && a % g == 0 && b % g == 0)
+ {
+ mp_limb_t a_div_g = a / g;
+ mp_limb_t b_div_g = b / g;
+ mp_limb_t abs_s = ABS_CAST(mp_limb_t, s);
+ mp_limb_t abs_t = ABS_CAST(mp_limb_t, t);
+ mpz_mul_ui (sz, sz, 2);
+ mpz_mul_ui (tz, tz, 2);
+ if ((abs_s == 1 || mpz_cmpabs (sz, mpz_roinit_n (tmp, &b_div_g, 1)) < 0)
+ && (abs_t == 1 || mpz_cmpabs (tz, mpz_roinit_n (tmp, &a_div_g, 1)) < 0))
+ {
+ mpz_clear (d);
+ mpz_clear (sz);
+ mpz_clear (tz);
+
+ return;
+ }
+ }
+ }
+ gmp_fprintf (stderr,
+ "gcdext_1 (0x%Mx, 0x%Mx) failed, got: g = 0x%Mx, s = %s0x%Mx, t = %s0x%Mx\n",
+ a, b, g,
+ s < 0 ? "-" : "", ABS_CAST(mp_limb_t, s),
+ t < 0 ? "-" : "", ABS_CAST(mp_limb_t, t));
+ abort();
+}
+
+int
+main (int argc, char **argv)
+{
+ mpz_t a, b;
+ int count = COUNT;
+ int test;
+ gmp_randstate_ptr rands;
+
+ TESTS_REPS (count, argv, argc);
+
+ tests_start ();
+ rands = RANDS;
+
+ mpz_init (a);
+ mpz_init (b);
+ for (test = 0; test < count; test++)
+ {
+ mp_limb_t al, bl;
+ mp_bitcnt_t asize = 1 + gmp_urandomm_ui(rands, GMP_NUMB_BITS);
+ mp_bitcnt_t bsize = 1 + gmp_urandomm_ui(rands, GMP_NUMB_BITS);
+ if (test & 1)
+ {
+ mpz_urandomb (a, rands, asize);
+ mpz_urandomb (b, rands, bsize);
+ }
+ else
+ {
+ mpz_rrandomb (a, rands, asize);
+ mpz_rrandomb (b, rands, bsize);
+ }
+
+ al = mpz_getlimbn (a, 0);
+ bl = mpz_getlimbn (b, 0);
+ al += (al == 0);
+ bl += (bl == 0);
+
+ one_test (al, bl);
+ }
+
+ mpz_clear (a);
+ mpz_clear (b);
+
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-get_d.c b/vendor/gmp-6.3.0/tests/mpn/t-get_d.c
new file mode 100644
index 0000000..ab0e2ec
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-get_d.c
@@ -0,0 +1,497 @@
+/* Test mpn_get_d.
+
+Copyright 2002-2004 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <setjmp.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+#ifndef _GMP_IEEE_FLOATS
+#define _GMP_IEEE_FLOATS 0
+#endif
+
+
+/* Exercise various 2^n values, with various exponents and positive and
+ negative. */
+void
+check_onebit (void)
+{
+ static const int bit_table[] = {
+ 0, 1, 2, 3,
+ GMP_NUMB_BITS - 2, GMP_NUMB_BITS - 1,
+ GMP_NUMB_BITS,
+ GMP_NUMB_BITS + 1, GMP_NUMB_BITS + 2,
+ 2 * GMP_NUMB_BITS - 2, 2 * GMP_NUMB_BITS - 1,
+ 2 * GMP_NUMB_BITS,
+ 2 * GMP_NUMB_BITS + 1, 2 * GMP_NUMB_BITS + 2,
+ 3 * GMP_NUMB_BITS - 2, 3 * GMP_NUMB_BITS - 1,
+ 3 * GMP_NUMB_BITS,
+ 3 * GMP_NUMB_BITS + 1, 3 * GMP_NUMB_BITS + 2,
+ 4 * GMP_NUMB_BITS - 2, 4 * GMP_NUMB_BITS - 1,
+ 4 * GMP_NUMB_BITS,
+ 4 * GMP_NUMB_BITS + 1, 4 * GMP_NUMB_BITS + 2,
+ 5 * GMP_NUMB_BITS - 2, 5 * GMP_NUMB_BITS - 1,
+ 5 * GMP_NUMB_BITS,
+ 5 * GMP_NUMB_BITS + 1, 5 * GMP_NUMB_BITS + 2,
+ 6 * GMP_NUMB_BITS - 2, 6 * GMP_NUMB_BITS - 1,
+ 6 * GMP_NUMB_BITS,
+ 6 * GMP_NUMB_BITS + 1, 6 * GMP_NUMB_BITS + 2,
+ };
+ static const int exp_table[] = {
+ 0, -100, -10, -1, 1, 10, 100,
+ };
+
+ /* FIXME: It'd be better to base this on the float format. */
+#if defined (__vax) || defined (__vax__)
+ int limit = 127; /* vax fp numbers have limited range */
+#else
+ int limit = 511;
+#endif
+
+ int bit_i, exp_i, i;
+ double got, want;
+ mp_size_t nsize, sign;
+ long bit, exp, want_bit;
+ mp_limb_t np[20];
+
+ for (bit_i = 0; bit_i < numberof (bit_table); bit_i++)
+ {
+ bit = bit_table[bit_i];
+
+ nsize = BITS_TO_LIMBS (bit+1);
+ refmpn_zero (np, nsize);
+ np[bit/GMP_NUMB_BITS] = CNST_LIMB(1) << (bit % GMP_NUMB_BITS);
+
+ for (exp_i = 0; exp_i < numberof (exp_table); exp_i++)
+ {
+ exp = exp_table[exp_i];
+
+ want_bit = bit + exp;
+ if (want_bit >= limit || want_bit <= -limit)
+ continue;
+
+ want = 1.0;
+ for (i = 0; i < want_bit; i++)
+ want *= 2.0;
+ for (i = 0; i > want_bit; i--)
+ want *= 0.5;
+
+ for (sign = 0; sign >= -1; sign--, want = -want)
+ {
+ got = mpn_get_d (np, nsize, sign, exp);
+ if (got != want)
+ {
+ printf ("mpn_get_d wrong on 2^n\n");
+ printf (" bit %ld\n", bit);
+ printf (" exp %ld\n", exp);
+ printf (" want_bit %ld\n", want_bit);
+ printf (" sign %ld\n", (long) sign);
+ mpn_trace (" n ", np, nsize);
+ printf (" nsize %ld\n", (long) nsize);
+ d_trace (" want ", want);
+ d_trace (" got ", got);
+ abort();
+ }
+ }
+ }
+ }
+}
+
+
+/* Exercise values 2^n+1, while such a value fits the mantissa of a double. */
+void
+check_twobit (void)
+{
+ int i, mant_bits;
+ double got, want;
+ mp_size_t nsize, sign;
+ mp_ptr np;
+
+ mant_bits = tests_dbl_mant_bits ();
+ if (mant_bits == 0)
+ return;
+
+ np = refmpn_malloc_limbs (BITS_TO_LIMBS (mant_bits));
+ want = 3.0;
+ for (i = 1; i < mant_bits; i++)
+ {
+ nsize = BITS_TO_LIMBS (i+1);
+ refmpn_zero (np, nsize);
+ np[i/GMP_NUMB_BITS] = CNST_LIMB(1) << (i % GMP_NUMB_BITS);
+ np[0] |= 1;
+
+ for (sign = 0; sign >= -1; sign--)
+ {
+ got = mpn_get_d (np, nsize, sign, 0);
+ if (got != want)
+ {
+ printf ("mpn_get_d wrong on 2^%d + 1\n", i);
+ printf (" sign %ld\n", (long) sign);
+ mpn_trace (" n ", np, nsize);
+ printf (" nsize %ld\n", (long) nsize);
+ d_trace (" want ", want);
+ d_trace (" got ", got);
+ abort();
+ }
+ want = -want;
+ }
+
+ want = 2.0 * want - 1.0;
+ }
+
+ free (np);
+}
+
+
+/* Expect large negative exponents to underflow to 0.0.
+ Some systems might have hardware traps for such an underflow (though
+ usually it's not the default), so watch out for SIGFPE. */
+void
+check_underflow (void)
+{
+ static const long exp_table[] = {
+ -999999L, LONG_MIN,
+ };
+ static const mp_limb_t np[1] = { 1 };
+
+ static long exp;
+ mp_size_t nsize, sign;
+ double got;
+ int exp_i;
+
+ nsize = numberof (np);
+
+ if (tests_setjmp_sigfpe() == 0)
+ {
+ for (exp_i = 0; exp_i < numberof (exp_table); exp_i++)
+ {
+ exp = exp_table[exp_i];
+
+ for (sign = 0; sign >= -1; sign--)
+ {
+ got = mpn_get_d (np, nsize, sign, exp);
+ if (got != 0.0)
+ {
+ printf ("mpn_get_d wrong, didn't get 0.0 on underflow\n");
+ printf (" nsize %ld\n", (long) nsize);
+ printf (" exp %ld\n", exp);
+ printf (" sign %ld\n", (long) sign);
+ d_trace (" got ", got);
+ abort ();
+ }
+ }
+ }
+ }
+ else
+ {
+ printf ("Warning, underflow to zero tests skipped due to SIGFPE (exp=%ld)\n", exp);
+ }
+ tests_sigfpe_done ();
+}
+
+
+/* Expect large values to result in +/-inf, on IEEE systems. */
+void
+check_inf (void)
+{
+ static const long exp_table[] = {
+ 999999L, LONG_MAX,
+ };
+ static const mp_limb_t np[4] = { 1, 1, 1, 1 };
+ long exp;
+ mp_size_t nsize, sign, got_sign;
+ double got;
+ int exp_i;
+
+ if (! _GMP_IEEE_FLOATS)
+ return;
+
+ for (nsize = 1; nsize <= numberof (np); nsize++)
+ {
+ for (exp_i = 0; exp_i < numberof (exp_table); exp_i++)
+ {
+ exp = exp_table[exp_i];
+
+ for (sign = 0; sign >= -1; sign--)
+ {
+ got = mpn_get_d (np, nsize, sign, exp);
+ got_sign = (got >= 0 ? 0 : -1);
+ if (! tests_isinf (got))
+ {
+ printf ("mpn_get_d wrong, didn't get infinity\n");
+ bad:
+ printf (" nsize %ld\n", (long) nsize);
+ printf (" exp %ld\n", exp);
+ printf (" sign %ld\n", (long) sign);
+ d_trace (" got ", got);
+ printf (" got sign %ld\n", (long) got_sign);
+ abort ();
+ }
+ if (got_sign != sign)
+ {
+ printf ("mpn_get_d wrong sign on infinity\n");
+ goto bad;
+ }
+ }
+ }
+ }
+}
+
+/* Check values 2^n approaching and into IEEE denorm range.
+ Some systems might not support denorms, or might have traps setup, so
+ watch out for SIGFPE. */
+void
+check_ieee_denorm (void)
+{
+ static long exp;
+ mp_limb_t n = 1;
+ long i;
+ mp_size_t sign;
+ double want, got;
+
+ if (! _GMP_IEEE_FLOATS)
+ return;
+
+ if (tests_setjmp_sigfpe() == 0)
+ {
+ exp = -1020;
+ want = 1.0;
+ for (i = 0; i > exp; i--)
+ want *= 0.5;
+
+ for ( ; exp > -1500 && want != 0.0; exp--)
+ {
+ for (sign = 0; sign >= -1; sign--)
+ {
+ got = mpn_get_d (&n, (mp_size_t) 1, sign, exp);
+ if (got != want)
+ {
+ printf ("mpn_get_d wrong on denorm\n");
+ printf (" n=1\n");
+ printf (" exp %ld\n", exp);
+ printf (" sign %ld\n", (long) sign);
+ d_trace (" got ", got);
+ d_trace (" want ", want);
+ abort ();
+ }
+ want = -want;
+ }
+ want *= 0.5;
+ FORCE_DOUBLE (want);
+ }
+ }
+ else
+ {
+ printf ("Warning, IEEE denorm tests skipped due to SIGFPE (exp=%ld)\n", exp);
+ }
+ tests_sigfpe_done ();
+}
+
+
+/* Check values 2^n approaching exponent overflow.
+ Some systems might trap on overflow, so watch out for SIGFPE. */
+void
+check_ieee_overflow (void)
+{
+ static long exp;
+ mp_limb_t n = 1;
+ long i;
+ mp_size_t sign;
+ double want, got;
+
+ if (! _GMP_IEEE_FLOATS)
+ return;
+
+ if (tests_setjmp_sigfpe() == 0)
+ {
+ exp = 1010;
+ want = 1.0;
+ for (i = 0; i < exp; i++)
+ want *= 2.0;
+
+ for ( ; exp < 1050; exp++)
+ {
+ for (sign = 0; sign >= -1; sign--)
+ {
+ got = mpn_get_d (&n, (mp_size_t) 1, sign, exp);
+ if (got != want)
+ {
+ printf ("mpn_get_d wrong on overflow\n");
+ printf (" n=1\n");
+ printf (" exp %ld\n", exp);
+ printf (" sign %ld\n", (long) sign);
+ d_trace (" got ", got);
+ d_trace (" want ", want);
+ abort ();
+ }
+ want = -want;
+ }
+ want *= 2.0;
+ FORCE_DOUBLE (want);
+ }
+ }
+ else
+ {
+ printf ("Warning, IEEE overflow tests skipped due to SIGFPE (exp=%ld)\n", exp);
+ }
+ tests_sigfpe_done ();
+}
+
+
+/* ARM gcc 2.95.4 was seen generating bad code for ulong->double
+ conversions, resulting in for instance 0x81c25113 incorrectly converted.
+ This test exercises that value, to see mpn_get_d has avoided the
+ problem. */
+void
+check_0x81c25113 (void)
+{
+#if GMP_NUMB_BITS >= 32
+ double want = 2176995603.0;
+ double got;
+ mp_limb_t np[4];
+ mp_size_t nsize;
+ long exp;
+
+ if (tests_dbl_mant_bits() < 32)
+ return;
+
+ for (nsize = 1; nsize <= numberof (np); nsize++)
+ {
+ refmpn_zero (np, nsize-1);
+ np[nsize-1] = CNST_LIMB(0x81c25113);
+ exp = - (nsize-1) * GMP_NUMB_BITS;
+ got = mpn_get_d (np, nsize, (mp_size_t) 0, exp);
+ if (got != want)
+ {
+ printf ("mpn_get_d wrong on 2176995603 (0x81c25113)\n");
+ printf (" nsize %ld\n", (long) nsize);
+ printf (" exp %ld\n", exp);
+ d_trace (" got ", got);
+ d_trace (" want ", want);
+ abort ();
+ }
+ }
+#endif
+}
+
+
+void
+check_rand (void)
+{
+ gmp_randstate_ptr rands = RANDS;
+ int rep, i;
+ unsigned long mant_bits;
+ long exp, exp_min, exp_max;
+ double got, want, d;
+ mp_size_t nalloc, nsize, sign;
+ mp_limb_t nhigh_mask;
+ mp_ptr np;
+
+ mant_bits = tests_dbl_mant_bits ();
+ if (mant_bits == 0)
+ return;
+
+ /* Allow for vax D format with exponent 127 to -128 only.
+ FIXME: Do something to probe for a valid exponent range. */
+ exp_min = -100 - mant_bits;
+ exp_max = 100 - mant_bits;
+
+ /* space for mant_bits */
+ nalloc = BITS_TO_LIMBS (mant_bits);
+ np = refmpn_malloc_limbs (nalloc);
+ nhigh_mask = MP_LIMB_T_MAX
+ >> (GMP_NAIL_BITS + nalloc * GMP_NUMB_BITS - mant_bits);
+
+ for (rep = 0; rep < 200; rep++)
+ {
+ /* random exp_min to exp_max, inclusive */
+ exp = exp_min + (long) gmp_urandomm_ui (rands, exp_max - exp_min + 1);
+
+ /* mant_bits worth of random at np */
+ if (rep & 1)
+ mpn_random (np, nalloc);
+ else
+ mpn_random2 (np, nalloc);
+ nsize = nalloc;
+ np[nsize-1] &= nhigh_mask;
+ MPN_NORMALIZE (np, nsize);
+ if (nsize == 0)
+ continue;
+
+ sign = (mp_size_t) gmp_urandomb_ui (rands, 1L) - 1;
+
+ /* want = {np,nsize}, converting one bit at a time */
+ want = 0.0;
+ for (i = 0, d = 1.0; i < mant_bits; i++, d *= 2.0)
+ if (np[i/GMP_NUMB_BITS] & (CNST_LIMB(1) << (i%GMP_NUMB_BITS)))
+ want += d;
+ if (sign < 0)
+ want = -want;
+
+ /* want = want * 2^exp */
+ for (i = 0; i < exp; i++)
+ want *= 2.0;
+ for (i = 0; i > exp; i--)
+ want *= 0.5;
+
+ got = mpn_get_d (np, nsize, sign, exp);
+
+ if (got != want)
+ {
+ printf ("mpn_get_d wrong on random data\n");
+ printf (" sign %ld\n", (long) sign);
+ mpn_trace (" n ", np, nsize);
+ printf (" nsize %ld\n", (long) nsize);
+ printf (" exp %ld\n", exp);
+ d_trace (" want ", want);
+ d_trace (" got ", got);
+ abort();
+ }
+ }
+
+ free (np);
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+ mp_trace_base = -16;
+
+ check_onebit ();
+ check_twobit ();
+ check_inf ();
+ check_underflow ();
+ check_ieee_denorm ();
+ check_ieee_overflow ();
+ check_0x81c25113 ();
+#if ! (defined (__vax) || defined (__vax__))
+ check_rand ();
+#endif
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-hgcd.c b/vendor/gmp-6.3.0/tests/mpn/t-hgcd.c
new file mode 100644
index 0000000..07f83e9
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-hgcd.c
@@ -0,0 +1,406 @@
+/* Test mpn_hgcd.
+
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2004 Free Software Foundation,
+Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+static mp_size_t one_test (mpz_t, mpz_t, int);
+static void debug_mp (mpz_t, int);
+
+#define MIN_OPERAND_SIZE 2
+
+/* Fixed values, for regression testing of mpn_hgcd. */
+struct value { int res; const char *a; const char *b; };
+static const struct value hgcd_values[] = {
+#if GMP_NUMB_BITS == 32
+ { 5,
+ "0x1bddff867272a9296ac493c251d7f46f09a5591fe",
+ "0xb55930a2a68a916450a7de006031068c5ddb0e5c" },
+ { 4,
+ "0x2f0ece5b1ee9c15e132a01d55768dc13",
+ "0x1c6f4fd9873cdb24466e6d03e1cc66e7" },
+ { 3, "0x7FFFFC003FFFFFFFFFC5", "0x3FFFFE001FFFFFFFFFE3"},
+#endif
+ { -1, NULL, NULL }
+};
+
+struct hgcd_ref
+{
+ mpz_t m[2][2];
+};
+
+static void hgcd_ref_init (struct hgcd_ref *);
+static void hgcd_ref_clear (struct hgcd_ref *);
+static int hgcd_ref (struct hgcd_ref *, mpz_t, mpz_t);
+static int hgcd_ref_equal (const struct hgcd_matrix *, const struct hgcd_ref *);
+
+int
+main (int argc, char **argv)
+{
+ mpz_t op1, op2, temp1, temp2;
+ int i, j, chain_len;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long size_range;
+
+ tests_start ();
+ rands = RANDS;
+
+ mpz_init (bs);
+ mpz_init (op1);
+ mpz_init (op2);
+ mpz_init (temp1);
+ mpz_init (temp2);
+
+ for (i = 0; hgcd_values[i].res >= 0; i++)
+ {
+ mp_size_t res;
+
+ mpz_set_str (op1, hgcd_values[i].a, 0);
+ mpz_set_str (op2, hgcd_values[i].b, 0);
+
+ res = one_test (op1, op2, -1-i);
+ if (res != hgcd_values[i].res)
+ {
+ fprintf (stderr, "ERROR in test %d\n", -1-i);
+ fprintf (stderr, "Bad return code from hgcd\n");
+ fprintf (stderr, "op1="); debug_mp (op1, -16);
+ fprintf (stderr, "op2="); debug_mp (op2, -16);
+ fprintf (stderr, "expected: %d\n", hgcd_values[i].res);
+ fprintf (stderr, "hgcd: %d\n", (int) res);
+ abort ();
+ }
+ }
+
+ for (i = 0; i < 15; i++)
+ {
+ /* Generate plain operands with unknown gcd. These types of operands
+ have proven to trigger certain bugs in development versions of the
+ gcd code. */
+
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 13 + 2;
+
+ mpz_urandomb (bs, rands, size_range);
+ mpz_rrandomb (op1, rands, mpz_get_ui (bs) + MIN_OPERAND_SIZE);
+ mpz_urandomb (bs, rands, size_range);
+ mpz_rrandomb (op2, rands, mpz_get_ui (bs) + MIN_OPERAND_SIZE);
+
+ if (mpz_cmp (op1, op2) < 0)
+ mpz_swap (op1, op2);
+
+ if (mpz_size (op1) > 0)
+ one_test (op1, op2, i);
+
+ /* Generate a division chain backwards, allowing otherwise
+ unlikely huge quotients. */
+
+ mpz_set_ui (op1, 0);
+ mpz_urandomb (bs, rands, 32);
+ mpz_urandomb (bs, rands, mpz_get_ui (bs) % 16 + 1);
+ mpz_rrandomb (op2, rands, mpz_get_ui (bs));
+ mpz_add_ui (op2, op2, 1);
+
+#if 0
+ chain_len = 1000000;
+#else
+ mpz_urandomb (bs, rands, 32);
+ chain_len = mpz_get_ui (bs) % (GMP_NUMB_BITS * GCD_DC_THRESHOLD / 256);
+#endif
+
+ for (j = 0; j < chain_len; j++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ mpz_urandomb (bs, rands, mpz_get_ui (bs) % 12 + 1);
+ mpz_rrandomb (temp2, rands, mpz_get_ui (bs) + 1);
+ mpz_add_ui (temp2, temp2, 1);
+ mpz_mul (temp1, op2, temp2);
+ mpz_add (op1, op1, temp1);
+
+ /* Don't generate overly huge operands. */
+ if (SIZ (op1) > 3 * GCD_DC_THRESHOLD)
+ break;
+
+ mpz_urandomb (bs, rands, 32);
+ mpz_urandomb (bs, rands, mpz_get_ui (bs) % 12 + 1);
+ mpz_rrandomb (temp2, rands, mpz_get_ui (bs) + 1);
+ mpz_add_ui (temp2, temp2, 1);
+ mpz_mul (temp1, op1, temp2);
+ mpz_add (op2, op2, temp1);
+
+ /* Don't generate overly huge operands. */
+ if (SIZ (op2) > 3 * GCD_DC_THRESHOLD)
+ break;
+ }
+ if (mpz_cmp (op1, op2) < 0)
+ mpz_swap (op1, op2);
+
+ if (mpz_size (op1) > 0)
+ one_test (op1, op2, i);
+ }
+
+ mpz_clear (bs);
+ mpz_clear (op1);
+ mpz_clear (op2);
+ mpz_clear (temp1);
+ mpz_clear (temp2);
+
+ tests_end ();
+ exit (0);
+}
+
+static void
+debug_mp (mpz_t x, int base)
+{
+ mpz_out_str (stderr, base, x); fputc ('\n', stderr);
+}
+
+static int
+mpz_mpn_equal (const mpz_t a, mp_srcptr bp, mp_size_t bsize);
+
+static mp_size_t
+one_test (mpz_t a, mpz_t b, int i)
+{
+ struct hgcd_matrix hgcd;
+ struct hgcd_ref ref;
+
+ mpz_t ref_r0;
+ mpz_t ref_r1;
+ mpz_t hgcd_r0;
+ mpz_t hgcd_r1;
+
+ mp_size_t res[2];
+ mp_size_t asize;
+ mp_size_t bsize;
+
+ mp_size_t hgcd_init_scratch;
+ mp_size_t hgcd_scratch;
+
+ mp_ptr hgcd_init_tp;
+ mp_ptr hgcd_tp;
+
+ asize = a->_mp_size;
+ bsize = b->_mp_size;
+
+ ASSERT (asize >= bsize);
+
+ hgcd_init_scratch = MPN_HGCD_MATRIX_INIT_ITCH (asize);
+ hgcd_init_tp = refmpn_malloc_limbs (hgcd_init_scratch);
+ mpn_hgcd_matrix_init (&hgcd, asize, hgcd_init_tp);
+
+ hgcd_scratch = mpn_hgcd_itch (asize);
+ hgcd_tp = refmpn_malloc_limbs (hgcd_scratch);
+
+#if 0
+ fprintf (stderr,
+ "one_test: i = %d asize = %d, bsize = %d\n",
+ i, a->_mp_size, b->_mp_size);
+
+ gmp_fprintf (stderr,
+ "one_test: i = %d\n"
+ " a = %Zx\n"
+ " b = %Zx\n",
+ i, a, b);
+#endif
+ hgcd_ref_init (&ref);
+
+ mpz_init_set (ref_r0, a);
+ mpz_init_set (ref_r1, b);
+ res[0] = hgcd_ref (&ref, ref_r0, ref_r1);
+
+ mpz_init_set (hgcd_r0, a);
+ mpz_init_set (hgcd_r1, b);
+ if (bsize < asize)
+ {
+ _mpz_realloc (hgcd_r1, asize);
+ MPN_ZERO (hgcd_r1->_mp_d + bsize, asize - bsize);
+ }
+ res[1] = mpn_hgcd (hgcd_r0->_mp_d,
+ hgcd_r1->_mp_d,
+ asize,
+ &hgcd, hgcd_tp);
+
+ if (res[0] != res[1])
+ {
+ fprintf (stderr, "ERROR in test %d\n", i);
+ fprintf (stderr, "Different return value from hgcd and hgcd_ref\n");
+ fprintf (stderr, "op1="); debug_mp (a, -16);
+ fprintf (stderr, "op2="); debug_mp (b, -16);
+ fprintf (stderr, "hgcd_ref: %ld\n", (long) res[0]);
+ fprintf (stderr, "mpn_hgcd: %ld\n", (long) res[1]);
+ abort ();
+ }
+ if (res[0] > 0)
+ {
+ if (!hgcd_ref_equal (&hgcd, &ref)
+ || !mpz_mpn_equal (ref_r0, hgcd_r0->_mp_d, res[1])
+ || !mpz_mpn_equal (ref_r1, hgcd_r1->_mp_d, res[1]))
+ {
+ fprintf (stderr, "ERROR in test %d\n", i);
+ fprintf (stderr, "mpn_hgcd and hgcd_ref returned different values\n");
+ fprintf (stderr, "op1="); debug_mp (a, -16);
+ fprintf (stderr, "op2="); debug_mp (b, -16);
+ abort ();
+ }
+ }
+
+ refmpn_free_limbs (hgcd_init_tp);
+ refmpn_free_limbs (hgcd_tp);
+ hgcd_ref_clear (&ref);
+ mpz_clear (ref_r0);
+ mpz_clear (ref_r1);
+ mpz_clear (hgcd_r0);
+ mpz_clear (hgcd_r1);
+
+ return res[0];
+}
+
+static void
+hgcd_ref_init (struct hgcd_ref *hgcd)
+{
+ unsigned i;
+ for (i = 0; i<2; i++)
+ {
+ unsigned j;
+ for (j = 0; j<2; j++)
+ mpz_init (hgcd->m[i][j]);
+ }
+}
+
+static void
+hgcd_ref_clear (struct hgcd_ref *hgcd)
+{
+ unsigned i;
+ for (i = 0; i<2; i++)
+ {
+ unsigned j;
+ for (j = 0; j<2; j++)
+ mpz_clear (hgcd->m[i][j]);
+ }
+}
+
+
+static int
+sdiv_qr (mpz_t q, mpz_t r, mp_size_t s, const mpz_t a, const mpz_t b)
+{
+ mpz_fdiv_qr (q, r, a, b);
+ if (mpz_size (r) <= s)
+ {
+ mpz_add (r, r, b);
+ mpz_sub_ui (q, q, 1);
+ }
+
+ return (mpz_sgn (q) > 0);
+}
+
+static int
+hgcd_ref (struct hgcd_ref *hgcd, mpz_t a, mpz_t b)
+{
+ mp_size_t n = MAX (mpz_size (a), mpz_size (b));
+ mp_size_t s = n/2 + 1;
+ mp_size_t asize;
+ mp_size_t bsize;
+ mpz_t q;
+ int res;
+
+ if (mpz_size (a) <= s || mpz_size (b) <= s)
+ return 0;
+
+ res = mpz_cmp (a, b);
+ if (res < 0)
+ {
+ mpz_sub (b, b, a);
+ if (mpz_size (b) <= s)
+ return 0;
+
+ mpz_set_ui (hgcd->m[0][0], 1); mpz_set_ui (hgcd->m[0][1], 0);
+ mpz_set_ui (hgcd->m[1][0], 1); mpz_set_ui (hgcd->m[1][1], 1);
+ }
+ else if (res > 0)
+ {
+ mpz_sub (a, a, b);
+ if (mpz_size (a) <= s)
+ return 0;
+
+ mpz_set_ui (hgcd->m[0][0], 1); mpz_set_ui (hgcd->m[0][1], 1);
+ mpz_set_ui (hgcd->m[1][0], 0); mpz_set_ui (hgcd->m[1][1], 1);
+ }
+ else
+ return 0;
+
+ mpz_init (q);
+
+ for (;;)
+ {
+ ASSERT (mpz_size (a) > s);
+ ASSERT (mpz_size (b) > s);
+
+ if (mpz_cmp (a, b) > 0)
+ {
+ if (!sdiv_qr (q, a, s, a, b))
+ break;
+ mpz_addmul (hgcd->m[0][1], q, hgcd->m[0][0]);
+ mpz_addmul (hgcd->m[1][1], q, hgcd->m[1][0]);
+ }
+ else
+ {
+ if (!sdiv_qr (q, b, s, b, a))
+ break;
+ mpz_addmul (hgcd->m[0][0], q, hgcd->m[0][1]);
+ mpz_addmul (hgcd->m[1][0], q, hgcd->m[1][1]);
+ }
+ }
+
+ mpz_clear (q);
+
+ asize = mpz_size (a);
+ bsize = mpz_size (b);
+ return MAX (asize, bsize);
+}
+
+static int
+mpz_mpn_equal (const mpz_t a, mp_srcptr bp, mp_size_t bsize)
+{
+ mp_srcptr ap = a->_mp_d;
+ mp_size_t asize = a->_mp_size;
+
+ MPN_NORMALIZE (bp, bsize);
+ return asize == bsize && mpn_cmp (ap, bp, asize) == 0;
+}
+
+static int
+hgcd_ref_equal (const struct hgcd_matrix *hgcd, const struct hgcd_ref *ref)
+{
+ unsigned i;
+
+ for (i = 0; i<2; i++)
+ {
+ unsigned j;
+
+ for (j = 0; j<2; j++)
+ if (!mpz_mpn_equal (ref->m[i][j], hgcd->p[i][j], hgcd->n))
+ return 0;
+ }
+
+ return 1;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-hgcd_appr.c b/vendor/gmp-6.3.0/tests/mpn/t-hgcd_appr.c
new file mode 100644
index 0000000..f9e2ea8
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-hgcd_appr.c
@@ -0,0 +1,563 @@
+/* Test mpn_hgcd_appr.
+
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2004, 2011 Free Software
+Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+static mp_size_t one_test (mpz_t, mpz_t, int);
+static void debug_mp (mpz_t, int);
+
+#define MIN_OPERAND_SIZE 2
+
+struct hgcd_ref
+{
+ mpz_t m[2][2];
+};
+
+static void hgcd_ref_init (struct hgcd_ref *hgcd);
+static void hgcd_ref_clear (struct hgcd_ref *hgcd);
+static int hgcd_ref (struct hgcd_ref *hgcd, mpz_t a, mpz_t b);
+static int hgcd_ref_equal (const struct hgcd_ref *, const struct hgcd_ref *);
+static int hgcd_appr_valid_p (mpz_t, mpz_t, mp_size_t, struct hgcd_ref *,
+ mpz_t, mpz_t, mp_size_t, struct hgcd_matrix *);
+
+static int verbose_flag = 0;
+
+int
+main (int argc, char **argv)
+{
+ mpz_t op1, op2, temp1, temp2;
+ int i, j, chain_len;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long size_range;
+
+ if (argc > 1)
+ {
+ if (strcmp (argv[1], "-v") == 0)
+ verbose_flag = 1;
+ else
+ {
+ fprintf (stderr, "Invalid argument.\n");
+ return 1;
+ }
+ }
+
+ tests_start ();
+ rands = RANDS;
+
+ mpz_init (bs);
+ mpz_init (op1);
+ mpz_init (op2);
+ mpz_init (temp1);
+ mpz_init (temp2);
+
+ for (i = 0; i < 15; i++)
+ {
+ /* Generate plain operands with unknown gcd. These types of operands
+ have proven to trigger certain bugs in development versions of the
+ gcd code. */
+
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 13 + 2;
+
+ mpz_urandomb (bs, rands, size_range);
+ mpz_urandomb (op1, rands, mpz_get_ui (bs) + MIN_OPERAND_SIZE);
+ mpz_urandomb (bs, rands, size_range);
+ mpz_urandomb (op2, rands, mpz_get_ui (bs) + MIN_OPERAND_SIZE);
+
+ if (mpz_cmp (op1, op2) < 0)
+ mpz_swap (op1, op2);
+
+ if (mpz_size (op1) > 0)
+ one_test (op1, op2, i);
+
+ /* Generate a division chain backwards, allowing otherwise
+ unlikely huge quotients. */
+
+ mpz_set_ui (op1, 0);
+ mpz_urandomb (bs, rands, 32);
+ mpz_urandomb (bs, rands, mpz_get_ui (bs) % 16 + 1);
+ mpz_rrandomb (op2, rands, mpz_get_ui (bs));
+ mpz_add_ui (op2, op2, 1);
+
+#if 0
+ chain_len = 1000000;
+#else
+ mpz_urandomb (bs, rands, 32);
+ chain_len = mpz_get_ui (bs) % (GMP_NUMB_BITS * GCD_DC_THRESHOLD / 256);
+#endif
+
+ for (j = 0; j < chain_len; j++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ mpz_urandomb (bs, rands, mpz_get_ui (bs) % 12 + 1);
+ mpz_rrandomb (temp2, rands, mpz_get_ui (bs) + 1);
+ mpz_add_ui (temp2, temp2, 1);
+ mpz_mul (temp1, op2, temp2);
+ mpz_add (op1, op1, temp1);
+
+ /* Don't generate overly huge operands. */
+ if (SIZ (op1) > 3 * GCD_DC_THRESHOLD)
+ break;
+
+ mpz_urandomb (bs, rands, 32);
+ mpz_urandomb (bs, rands, mpz_get_ui (bs) % 12 + 1);
+ mpz_rrandomb (temp2, rands, mpz_get_ui (bs) + 1);
+ mpz_add_ui (temp2, temp2, 1);
+ mpz_mul (temp1, op1, temp2);
+ mpz_add (op2, op2, temp1);
+
+ /* Don't generate overly huge operands. */
+ if (SIZ (op2) > 3 * GCD_DC_THRESHOLD)
+ break;
+ }
+ if (mpz_cmp (op1, op2) < 0)
+ mpz_swap (op1, op2);
+
+ if (mpz_size (op1) > 0)
+ one_test (op1, op2, i);
+ }
+
+ mpz_clear (bs);
+ mpz_clear (op1);
+ mpz_clear (op2);
+ mpz_clear (temp1);
+ mpz_clear (temp2);
+
+ tests_end ();
+ exit (0);
+}
+
+static void
+debug_mp (mpz_t x, int base)
+{
+ mpz_out_str (stderr, base, x); fputc ('\n', stderr);
+}
+
+static mp_size_t
+one_test (mpz_t a, mpz_t b, int i)
+{
+ struct hgcd_matrix hgcd;
+ struct hgcd_ref ref;
+
+ mpz_t ref_r0;
+ mpz_t ref_r1;
+ mpz_t hgcd_r0;
+ mpz_t hgcd_r1;
+
+ int res[2];
+ mp_size_t asize;
+ mp_size_t bsize;
+
+ mp_size_t hgcd_init_scratch;
+ mp_size_t hgcd_scratch;
+
+ mp_ptr hgcd_init_tp;
+ mp_ptr hgcd_tp;
+ mp_limb_t marker[4];
+
+ asize = a->_mp_size;
+ bsize = b->_mp_size;
+
+ ASSERT (asize >= bsize);
+
+ hgcd_init_scratch = MPN_HGCD_MATRIX_INIT_ITCH (asize);
+ hgcd_init_tp = refmpn_malloc_limbs (hgcd_init_scratch + 2) + 1;
+ mpn_hgcd_matrix_init (&hgcd, asize, hgcd_init_tp);
+
+ hgcd_scratch = mpn_hgcd_appr_itch (asize);
+ hgcd_tp = refmpn_malloc_limbs (hgcd_scratch + 2) + 1;
+
+ mpn_random (marker, 4);
+
+ hgcd_init_tp[-1] = marker[0];
+ hgcd_init_tp[hgcd_init_scratch] = marker[1];
+ hgcd_tp[-1] = marker[2];
+ hgcd_tp[hgcd_scratch] = marker[3];
+
+#if 0
+ fprintf (stderr,
+ "one_test: i = %d asize = %d, bsize = %d\n",
+ i, a->_mp_size, b->_mp_size);
+
+ gmp_fprintf (stderr,
+ "one_test: i = %d\n"
+ " a = %Zx\n"
+ " b = %Zx\n",
+ i, a, b);
+#endif
+ hgcd_ref_init (&ref);
+
+ mpz_init_set (ref_r0, a);
+ mpz_init_set (ref_r1, b);
+ res[0] = hgcd_ref (&ref, ref_r0, ref_r1);
+
+ mpz_init_set (hgcd_r0, a);
+ mpz_init_set (hgcd_r1, b);
+ if (bsize < asize)
+ {
+ _mpz_realloc (hgcd_r1, asize);
+ MPN_ZERO (hgcd_r1->_mp_d + bsize, asize - bsize);
+ }
+ res[1] = mpn_hgcd_appr (hgcd_r0->_mp_d,
+ hgcd_r1->_mp_d,
+ asize,
+ &hgcd, hgcd_tp);
+
+ if (hgcd_init_tp[-1] != marker[0]
+ || hgcd_init_tp[hgcd_init_scratch] != marker[1]
+ || hgcd_tp[-1] != marker[2]
+ || hgcd_tp[hgcd_scratch] != marker[3])
+ {
+ fprintf (stderr, "ERROR in test %d\n", i);
+ fprintf (stderr, "scratch space overwritten!\n");
+
+ if (hgcd_init_tp[-1] != marker[0])
+ gmp_fprintf (stderr,
+ "before init_tp: %Mx\n"
+ "expected: %Mx\n",
+ hgcd_init_tp[-1], marker[0]);
+ if (hgcd_init_tp[hgcd_init_scratch] != marker[1])
+ gmp_fprintf (stderr,
+ "after init_tp: %Mx\n"
+ "expected: %Mx\n",
+ hgcd_init_tp[hgcd_init_scratch], marker[1]);
+ if (hgcd_tp[-1] != marker[2])
+ gmp_fprintf (stderr,
+ "before tp: %Mx\n"
+ "expected: %Mx\n",
+ hgcd_tp[-1], marker[2]);
+ if (hgcd_tp[hgcd_scratch] != marker[3])
+ gmp_fprintf (stderr,
+ "after tp: %Mx\n"
+ "expected: %Mx\n",
+ hgcd_tp[hgcd_scratch], marker[3]);
+
+ abort ();
+ }
+
+ if (!hgcd_appr_valid_p (a, b, res[0], &ref, ref_r0, ref_r1,
+ res[1], &hgcd))
+ {
+ fprintf (stderr, "ERROR in test %d\n", i);
+ fprintf (stderr, "Invalid results for hgcd and hgcd_ref\n");
+ fprintf (stderr, "op1="); debug_mp (a, -16);
+ fprintf (stderr, "op2="); debug_mp (b, -16);
+ fprintf (stderr, "hgcd_ref: %ld\n", (long) res[0]);
+ fprintf (stderr, "mpn_hgcd_appr: %ld\n", (long) res[1]);
+ abort ();
+ }
+
+ refmpn_free_limbs (hgcd_init_tp - 1);
+ refmpn_free_limbs (hgcd_tp - 1);
+ hgcd_ref_clear (&ref);
+ mpz_clear (ref_r0);
+ mpz_clear (ref_r1);
+ mpz_clear (hgcd_r0);
+ mpz_clear (hgcd_r1);
+
+ return res[0];
+}
+
+static void
+hgcd_ref_init (struct hgcd_ref *hgcd)
+{
+ unsigned i;
+ for (i = 0; i<2; i++)
+ {
+ unsigned j;
+ for (j = 0; j<2; j++)
+ mpz_init (hgcd->m[i][j]);
+ }
+}
+
+static void
+hgcd_ref_clear (struct hgcd_ref *hgcd)
+{
+ unsigned i;
+ for (i = 0; i<2; i++)
+ {
+ unsigned j;
+ for (j = 0; j<2; j++)
+ mpz_clear (hgcd->m[i][j]);
+ }
+}
+
+static int
+sdiv_qr (mpz_t q, mpz_t r, mp_size_t s, const mpz_t a, const mpz_t b)
+{
+ mpz_fdiv_qr (q, r, a, b);
+ if (mpz_size (r) <= s)
+ {
+ mpz_add (r, r, b);
+ mpz_sub_ui (q, q, 1);
+ }
+
+ return (mpz_sgn (q) > 0);
+}
+
+static int
+hgcd_ref (struct hgcd_ref *hgcd, mpz_t a, mpz_t b)
+{
+ mp_size_t n = MAX (mpz_size (a), mpz_size (b));
+ mp_size_t s = n/2 + 1;
+ mpz_t q;
+ int res;
+
+ if (mpz_size (a) <= s || mpz_size (b) <= s)
+ return 0;
+
+ res = mpz_cmp (a, b);
+ if (res < 0)
+ {
+ mpz_sub (b, b, a);
+ if (mpz_size (b) <= s)
+ return 0;
+
+ mpz_set_ui (hgcd->m[0][0], 1); mpz_set_ui (hgcd->m[0][1], 0);
+ mpz_set_ui (hgcd->m[1][0], 1); mpz_set_ui (hgcd->m[1][1], 1);
+ }
+ else if (res > 0)
+ {
+ mpz_sub (a, a, b);
+ if (mpz_size (a) <= s)
+ return 0;
+
+ mpz_set_ui (hgcd->m[0][0], 1); mpz_set_ui (hgcd->m[0][1], 1);
+ mpz_set_ui (hgcd->m[1][0], 0); mpz_set_ui (hgcd->m[1][1], 1);
+ }
+ else
+ return 0;
+
+ mpz_init (q);
+
+ for (;;)
+ {
+ ASSERT (mpz_size (a) > s);
+ ASSERT (mpz_size (b) > s);
+
+ if (mpz_cmp (a, b) > 0)
+ {
+ if (!sdiv_qr (q, a, s, a, b))
+ break;
+ mpz_addmul (hgcd->m[0][1], q, hgcd->m[0][0]);
+ mpz_addmul (hgcd->m[1][1], q, hgcd->m[1][0]);
+ }
+ else
+ {
+ if (!sdiv_qr (q, b, s, b, a))
+ break;
+ mpz_addmul (hgcd->m[0][0], q, hgcd->m[0][1]);
+ mpz_addmul (hgcd->m[1][0], q, hgcd->m[1][1]);
+ }
+ }
+
+ mpz_clear (q);
+
+ return 1;
+}
+
+static int
+hgcd_ref_equal (const struct hgcd_ref *A, const struct hgcd_ref *B)
+{
+ unsigned i;
+
+ for (i = 0; i<2; i++)
+ {
+ unsigned j;
+
+ for (j = 0; j<2; j++)
+ if (mpz_cmp (A->m[i][j], B->m[i][j]) != 0)
+ return 0;
+ }
+
+ return 1;
+}
+
+static int
+hgcd_appr_valid_p (mpz_t a, mpz_t b, mp_size_t res0,
+ struct hgcd_ref *ref, mpz_t ref_r0, mpz_t ref_r1,
+ mp_size_t res1, struct hgcd_matrix *hgcd)
+{
+ mp_size_t n = MAX (mpz_size (a), mpz_size (b));
+ mp_size_t s = n/2 + 1;
+
+ mp_bitcnt_t dbits, abits, margin;
+ mpz_t appr_r0, appr_r1, t, q;
+ struct hgcd_ref appr;
+
+ if (!res0)
+ {
+ if (!res1)
+ return 1;
+
+ fprintf (stderr, "mpn_hgcd_appr returned 1 when no reduction possible.\n");
+ return 0;
+ }
+
+ /* NOTE: No *_clear calls on error return, since we're going to
+ abort anyway. */
+ mpz_init (t);
+ mpz_init (q);
+ hgcd_ref_init (&appr);
+ mpz_init (appr_r0);
+ mpz_init (appr_r1);
+
+ if (mpz_size (ref_r0) <= s)
+ {
+ fprintf (stderr, "ref_r0 too small!!!: "); debug_mp (ref_r0, 16);
+ return 0;
+ }
+ if (mpz_size (ref_r1) <= s)
+ {
+ fprintf (stderr, "ref_r1 too small!!!: "); debug_mp (ref_r1, 16);
+ return 0;
+ }
+
+ mpz_sub (t, ref_r0, ref_r1);
+ dbits = mpz_sizeinbase (t, 2);
+ if (dbits > s*GMP_NUMB_BITS)
+ {
+ fprintf (stderr, "ref |r0 - r1| too large!!!: "); debug_mp (t, 16);
+ return 0;
+ }
+
+ if (!res1)
+ {
+ mpz_set (appr_r0, a);
+ mpz_set (appr_r1, b);
+ }
+ else
+ {
+ unsigned i;
+
+ for (i = 0; i<2; i++)
+ {
+ unsigned j;
+
+ for (j = 0; j<2; j++)
+ {
+ mp_size_t mn = hgcd->n;
+ MPN_NORMALIZE (hgcd->p[i][j], mn);
+ mpz_realloc (appr.m[i][j], mn);
+ MPN_COPY (PTR (appr.m[i][j]), hgcd->p[i][j], mn);
+ SIZ (appr.m[i][j]) = mn;
+ }
+ }
+ mpz_mul (appr_r0, appr.m[1][1], a);
+ mpz_mul (t, appr.m[0][1], b);
+ mpz_sub (appr_r0, appr_r0, t);
+ if (mpz_sgn (appr_r0) <= 0
+ || mpz_size (appr_r0) <= s)
+ {
+ fprintf (stderr, "appr_r0 too small: "); debug_mp (appr_r0, 16);
+ return 0;
+ }
+
+ mpz_mul (appr_r1, appr.m[1][0], a);
+ mpz_mul (t, appr.m[0][0], b);
+ mpz_sub (appr_r1, t, appr_r1);
+ if (mpz_sgn (appr_r1) <= 0
+ || mpz_size (appr_r1) <= s)
+ {
+ fprintf (stderr, "appr_r1 too small: "); debug_mp (appr_r1, 16);
+ return 0;
+ }
+ }
+
+ mpz_sub (t, appr_r0, appr_r1);
+ abits = mpz_sizeinbase (t, 2);
+ if (abits < dbits)
+ {
+ fprintf (stderr, "|r0 - r1| too small: "); debug_mp (t, 16);
+ return 0;
+ }
+
+ /* We lose one bit each time we discard the least significant limbs.
+ For the lehmer code, that can happen at most s * (GMP_NUMB_BITS)
+ / (GMP_NUMB_BITS - 1) times. For the dc code, we lose an entire
+ limb (or more?) for each level of recursion. */
+
+ margin = (n/2+1) * GMP_NUMB_BITS / (GMP_NUMB_BITS - 1);
+ {
+ mp_size_t rn;
+ for (rn = n; ABOVE_THRESHOLD (rn, HGCD_APPR_THRESHOLD); rn = (rn + 1)/2)
+ margin += GMP_NUMB_BITS;
+ }
+
+ if (verbose_flag && abits > dbits)
+ fprintf (stderr, "n = %u: sbits = %u: ref #(r0-r1): %u, appr #(r0-r1): %u excess: %d, margin: %u\n",
+ (unsigned) n, (unsigned) s*GMP_NUMB_BITS,
+ (unsigned) dbits, (unsigned) abits,
+ (int) (abits - s * GMP_NUMB_BITS), (unsigned) margin);
+
+ if (abits > s*GMP_NUMB_BITS + margin)
+ {
+ fprintf (stderr, "appr |r0 - r1| much larger than minimal (by %u bits, margin = %u bits)\n",
+ (unsigned) (abits - s*GMP_NUMB_BITS), (unsigned) margin);
+ return 0;
+ }
+
+ while (mpz_cmp (appr_r0, ref_r0) > 0 || mpz_cmp (appr_r1, ref_r1) > 0)
+ {
+ ASSERT (mpz_size (appr_r0) > s);
+ ASSERT (mpz_size (appr_r1) > s);
+
+ if (mpz_cmp (appr_r0, appr_r1) > 0)
+ {
+ if (!sdiv_qr (q, appr_r0, s, appr_r0, appr_r1))
+ break;
+ mpz_addmul (appr.m[0][1], q, appr.m[0][0]);
+ mpz_addmul (appr.m[1][1], q, appr.m[1][0]);
+ }
+ else
+ {
+ if (!sdiv_qr (q, appr_r1, s, appr_r1, appr_r0))
+ break;
+ mpz_addmul (appr.m[0][0], q, appr.m[0][1]);
+ mpz_addmul (appr.m[1][0], q, appr.m[1][1]);
+ }
+ }
+
+ if (mpz_cmp (appr_r0, ref_r0) != 0
+ || mpz_cmp (appr_r1, ref_r1) != 0
+ || !hgcd_ref_equal (ref, &appr))
+ {
+ fprintf (stderr, "appr_r0: "); debug_mp (appr_r0, 16);
+ fprintf (stderr, "ref_r0: "); debug_mp (ref_r0, 16);
+
+ fprintf (stderr, "appr_r1: "); debug_mp (appr_r1, 16);
+ fprintf (stderr, "ref_r1: "); debug_mp (ref_r1, 16);
+
+ return 0;
+ }
+ mpz_clear (t);
+ mpz_clear (q);
+ hgcd_ref_clear (&appr);
+ mpz_clear (appr_r0);
+ mpz_clear (appr_r1);
+
+ return 1;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-instrument.c b/vendor/gmp-6.3.0/tests/mpn/t-instrument.c
new file mode 100644
index 0000000..694e171
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-instrument.c
@@ -0,0 +1,415 @@
+/* Test assembler support for --enable-profiling=instrument.
+
+Copyright 2002, 2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "longlong.h"
+#include "tests.h"
+
+
+#if WANT_PROFILING_INSTRUMENT
+
+/* This program exercises each mpn routine that might be implemented in
+ assembler. It ensures the __cyg_profile_func_enter and exit calls have
+ come out right, and that in the x86 code "ret_internal" is correctly used
+ for PIC setups. */
+
+
+/* Changes to enter_seen done by __cyg_profile_func_enter are essentially
+ unknown to the optimizer, so must use volatile. */
+volatile int enter_seen;
+
+/* Dummy used to stop various calls going dead. */
+unsigned long notdead;
+
+const char *name = "<none>";
+int old_ncall;
+
+struct {
+ void *this_fn;
+ void *call_site;
+} call[100];
+int ncall;
+
+
+void __cyg_profile_func_enter (void *, void *)
+ __attribute__ ((no_instrument_function));
+
+void
+__cyg_profile_func_enter (void *this_fn, void *call_site)
+{
+#if 0
+ printf ("%24s %p %p\n", name, this_fn, call_site);
+#endif
+ ASSERT_ALWAYS (ncall >= 0);
+ ASSERT_ALWAYS (ncall <= numberof (call));
+
+ if (ncall >= numberof (call))
+ {
+ printf ("__cyg_profile_func_enter: oops, call stack full, from %s\n", name);
+ abort ();
+ }
+
+ enter_seen = 1;
+ call[ncall].this_fn = this_fn;
+ call[ncall].call_site = call_site;
+ ncall++;
+}
+
+void __cyg_profile_func_exit (void *, void *)
+ __attribute__ ((no_instrument_function));
+
+void
+__cyg_profile_func_exit (void *this_fn, void *call_site)
+{
+ ASSERT_ALWAYS (ncall >= 0);
+ ASSERT_ALWAYS (ncall <= numberof (call));
+
+ if (ncall == 0)
+ {
+ printf ("__cyg_profile_func_exit: call stack empty, from %s\n", name);
+ abort ();
+ }
+
+ ncall--;
+ if (this_fn != call[ncall].this_fn || call_site != call[ncall].call_site)
+ {
+ printf ("__cyg_profile_func_exit: unbalanced this_fn/call_site from %s\n", name);
+ printf (" this_fn got %p\n", this_fn);
+ printf (" want %p\n", call[ncall].this_fn);
+ printf (" call_site got %p\n", call_site);
+ printf (" want %p\n", call[ncall].call_site);
+ abort ();
+ }
+}
+
+
+void
+pre (const char *str)
+{
+ name = str;
+ enter_seen = 0;
+ old_ncall = ncall;
+}
+
+void
+post (void)
+{
+ if (! enter_seen)
+ {
+ printf ("did not reach __cyg_profile_func_enter from %s\n", name);
+ abort ();
+ }
+
+ if (ncall != old_ncall)
+ {
+ printf ("unbalance enter/exit calls from %s\n", name);
+ printf (" ncall %d\n", ncall);
+ printf (" old_ncall %d\n", old_ncall);
+ abort ();
+ }
+}
+
+void
+check (void)
+{
+ mp_limb_t wp[100], xp[100], yp[100];
+ mp_size_t size = 100;
+
+ refmpn_zero (xp, size);
+ refmpn_zero (yp, size);
+ refmpn_zero (wp, size);
+
+ pre ("mpn_add_n");
+ mpn_add_n (wp, xp, yp, size);
+ post ();
+
+#if HAVE_NATIVE_mpn_add_nc
+ pre ("mpn_add_nc");
+ mpn_add_nc (wp, xp, yp, size, CNST_LIMB(0));
+ post ();
+#endif
+
+#if HAVE_NATIVE_mpn_addlsh1_n
+ pre ("mpn_addlsh1_n");
+ mpn_addlsh1_n (wp, xp, yp, size);
+ post ();
+#endif
+
+#if HAVE_NATIVE_mpn_and_n
+ pre ("mpn_and_n");
+ mpn_and_n (wp, xp, yp, size);
+ post ();
+#endif
+
+#if HAVE_NATIVE_mpn_andn_n
+ pre ("mpn_andn_n");
+ mpn_andn_n (wp, xp, yp, size);
+ post ();
+#endif
+
+ pre ("mpn_addmul_1");
+ mpn_addmul_1 (wp, xp, size, yp[0]);
+ post ();
+
+#if HAVE_NATIVE_mpn_addmul_1c
+ pre ("mpn_addmul_1c");
+ mpn_addmul_1c (wp, xp, size, yp[0], CNST_LIMB(0));
+ post ();
+#endif
+
+#if HAVE_NATIVE_mpn_com
+ pre ("mpn_com");
+ mpn_com (wp, xp, size);
+ post ();
+#endif
+
+#if HAVE_NATIVE_mpn_copyd
+ pre ("mpn_copyd");
+ mpn_copyd (wp, xp, size);
+ post ();
+#endif
+
+#if HAVE_NATIVE_mpn_copyi
+ pre ("mpn_copyi");
+ mpn_copyi (wp, xp, size);
+ post ();
+#endif
+
+ pre ("mpn_divexact_1");
+ mpn_divexact_1 (wp, xp, size, CNST_LIMB(123));
+ post ();
+
+ pre ("mpn_divexact_by3c");
+ mpn_divexact_by3c (wp, xp, size, CNST_LIMB(0));
+ post ();
+
+ pre ("mpn_divrem_1");
+ mpn_divrem_1 (wp, (mp_size_t) 0, xp, size, CNST_LIMB(123));
+ post ();
+
+#if HAVE_NATIVE_mpn_divrem_1c
+ pre ("mpn_divrem_1c");
+ mpn_divrem_1c (wp, (mp_size_t) 0, xp, size, CNST_LIMB(123), CNST_LIMB(122));
+ post ();
+#endif
+
+ pre ("mpn_gcd_1");
+ xp[0] |= 1;
+ notdead += (unsigned long) mpn_gcd_1 (xp, size, CNST_LIMB(123));
+ post ();
+
+ pre ("mpn_hamdist");
+ notdead += mpn_hamdist (xp, yp, size);
+ post ();
+
+#if HAVE_NATIVE_mpn_ior_n
+ pre ("mpn_ior_n");
+ mpn_ior_n (wp, xp, yp, size);
+ post ();
+#endif
+
+#if HAVE_NATIVE_mpn_iorn_n
+ pre ("mpn_iorn_n");
+ mpn_iorn_n (wp, xp, yp, size);
+ post ();
+#endif
+
+ pre ("mpn_lshift");
+ mpn_lshift (wp, xp, size, 1);
+ post ();
+
+ pre ("mpn_mod_1");
+ notdead += mpn_mod_1 (xp, size, CNST_LIMB(123));
+ post ();
+
+#if HAVE_NATIVE_mpn_mod_1c
+ pre ("mpn_mod_1c");
+ notdead += mpn_mod_1c (xp, size, CNST_LIMB(123), CNST_LIMB(122));
+ post ();
+#endif
+
+#if GMP_NUMB_BITS % 4 == 0
+ pre ("mpn_mod_34lsub1");
+ notdead += mpn_mod_34lsub1 (xp, size);
+ post ();
+#endif
+
+ pre ("mpn_modexact_1_odd");
+ notdead += mpn_modexact_1_odd (xp, size, CNST_LIMB(123));
+ post ();
+
+ pre ("mpn_modexact_1c_odd");
+ notdead += mpn_modexact_1c_odd (xp, size, CNST_LIMB(123), CNST_LIMB(456));
+ post ();
+
+ pre ("mpn_mul_1");
+ mpn_mul_1 (wp, xp, size, yp[0]);
+ post ();
+
+#if HAVE_NATIVE_mpn_mul_1c
+ pre ("mpn_mul_1c");
+ mpn_mul_1c (wp, xp, size, yp[0], CNST_LIMB(0));
+ post ();
+#endif
+
+#if HAVE_NATIVE_mpn_mul_2
+ pre ("mpn_mul_2");
+ mpn_mul_2 (wp, xp, size-1, yp);
+ post ();
+#endif
+
+ pre ("mpn_mul_basecase");
+ mpn_mul_basecase (wp, xp, (mp_size_t) 3, yp, (mp_size_t) 3);
+ post ();
+
+#if HAVE_NATIVE_mpn_nand_n
+ pre ("mpn_nand_n");
+ mpn_nand_n (wp, xp, yp, size);
+ post ();
+#endif
+
+#if HAVE_NATIVE_mpn_nior_n
+ pre ("mpn_nior_n");
+ mpn_nior_n (wp, xp, yp, size);
+ post ();
+#endif
+
+ pre ("mpn_popcount");
+ notdead += mpn_popcount (xp, size);
+ post ();
+
+ pre ("mpn_preinv_mod_1");
+ notdead += mpn_preinv_mod_1 (xp, size, GMP_NUMB_MAX,
+ refmpn_invert_limb (GMP_NUMB_MAX));
+ post ();
+
+#if USE_PREINV_DIVREM_1 || HAVE_NATIVE_mpn_preinv_divrem_1
+ pre ("mpn_preinv_divrem_1");
+ mpn_preinv_divrem_1 (wp, (mp_size_t) 0, xp, size, GMP_NUMB_MAX,
+ refmpn_invert_limb (GMP_NUMB_MAX), 0);
+ post ();
+#endif
+
+#if HAVE_NATIVE_mpn_rsh1add_n
+ pre ("mpn_rsh1add_n");
+ mpn_rsh1add_n (wp, xp, yp, size);
+ post ();
+#endif
+
+#if HAVE_NATIVE_mpn_rsh1sub_n
+ pre ("mpn_rsh1sub_n");
+ mpn_rsh1sub_n (wp, xp, yp, size);
+ post ();
+#endif
+
+ pre ("mpn_rshift");
+ mpn_rshift (wp, xp, size, 1);
+ post ();
+
+ pre ("mpn_sqr_basecase");
+ mpn_sqr_basecase (wp, xp, (mp_size_t) 3);
+ post ();
+
+ pre ("mpn_submul_1");
+ mpn_submul_1 (wp, xp, size, yp[0]);
+ post ();
+
+#if HAVE_NATIVE_mpn_submul_1c
+ pre ("mpn_submul_1c");
+ mpn_submul_1c (wp, xp, size, yp[0], CNST_LIMB(0));
+ post ();
+#endif
+
+ pre ("mpn_sub_n");
+ mpn_sub_n (wp, xp, yp, size);
+ post ();
+
+#if HAVE_NATIVE_mpn_sub_nc
+ pre ("mpn_sub_nc");
+ mpn_sub_nc (wp, xp, yp, size, CNST_LIMB(0));
+ post ();
+#endif
+
+#if HAVE_NATIVE_mpn_sublsh1_n
+ pre ("mpn_sublsh1_n");
+ mpn_sublsh1_n (wp, xp, yp, size);
+ post ();
+#endif
+
+#if HAVE_NATIVE_mpn_udiv_qrnnd
+ pre ("mpn_udiv_qrnnd");
+ mpn_udiv_qrnnd (&wp[0], CNST_LIMB(122), xp[0], CNST_LIMB(123));
+ post ();
+#endif
+
+#if HAVE_NATIVE_mpn_udiv_qrnnd_r
+ pre ("mpn_udiv_qrnnd_r");
+ mpn_udiv_qrnnd (CNST_LIMB(122), xp[0], CNST_LIMB(123), &wp[0]);
+ post ();
+#endif
+
+#if HAVE_NATIVE_mpn_umul_ppmm
+ pre ("mpn_umul_ppmm");
+ mpn_umul_ppmm (&wp[0], xp[0], yp[0]);
+ post ();
+#endif
+
+#if HAVE_NATIVE_mpn_umul_ppmm_r
+ pre ("mpn_umul_ppmm_r");
+ mpn_umul_ppmm_r (&wp[0], xp[0], yp[0]);
+ post ();
+#endif
+
+#if HAVE_NATIVE_mpn_xor_n
+ pre ("mpn_xor_n");
+ mpn_xor_n (wp, xp, yp, size);
+ post ();
+#endif
+
+#if HAVE_NATIVE_mpn_xnor_n
+ pre ("mpn_xnor_n");
+ mpn_xnor_n (wp, xp, yp, size);
+ post ();
+#endif
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+
+ check ();
+
+ tests_end ();
+ exit (0);
+}
+
+
+#else /* ! WANT_PROFILING_INSTRUMENT */
+
+int
+main (void)
+{
+ exit (0);
+}
+
+#endif
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-invert.c b/vendor/gmp-6.3.0/tests/mpn/t-invert.c
new file mode 100644
index 0000000..1493467
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-invert.c
@@ -0,0 +1,151 @@
+/* Test for mpn_invert function.
+
+ Contributed to the GNU project by Marco Bodrato.
+
+Copyright 2009 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+/* Sizes are up to 2^SIZE_LOG limbs */
+#ifndef SIZE_LOG
+#define SIZE_LOG 12
+#endif
+
+#ifndef COUNT
+#define COUNT 1000
+#endif
+
+#define MAX_N (1L << SIZE_LOG)
+#define MIN_N 1
+
+
+static int
+invert_valid (mp_srcptr ip, mp_srcptr dp, mp_size_t n)
+{
+ mp_ptr tp;
+ int cy;
+ TMP_DECL;
+
+ TMP_MARK;
+ tp = TMP_ALLOC_LIMBS (2*n);
+
+ refmpn_mul (tp, ip, n, dp, n);
+ cy = refmpn_add_n (tp + n, tp + n, dp, n); /* This must not give a carry. */
+ cy -= refmpn_add (tp, tp, 2*n, dp, n); /* This must give a carry. */
+ TMP_FREE;
+
+ return (cy == -1);
+}
+
+/*
+ Check the result of the mpn_invert function in the library.
+*/
+
+int
+main (int argc, char **argv)
+{
+ mp_ptr ip, dp, scratch;
+ int count = COUNT;
+ int test;
+ gmp_randstate_ptr rands;
+ TMP_DECL;
+ TMP_MARK;
+
+ TESTS_REPS (count, argv, argc);
+
+ tests_start ();
+ rands = RANDS;
+
+ dp = TMP_ALLOC_LIMBS (MAX_N);
+ ip = 1+TMP_ALLOC_LIMBS (MAX_N + 2);
+ scratch
+ = 1+TMP_ALLOC_LIMBS (mpn_invert_itch (MAX_N) + 2);
+
+ for (test = 0; test < count; test++)
+ {
+ unsigned size_min;
+ unsigned size_range;
+ mp_size_t n;
+ mp_size_t itch;
+ mp_limb_t i_before, i_after, s_before, s_after;
+
+ for (size_min = 1; (1L << size_min) < MIN_N; size_min++)
+ ;
+
+ /* We generate an in the MIN_N <= n <= (1 << size_range). */
+ size_range = size_min
+ + gmp_urandomm_ui (rands, SIZE_LOG + 1 - size_min);
+
+ n = MIN_N
+ + gmp_urandomm_ui (rands, (1L << size_range) + 1 - MIN_N);
+
+ mpn_random2 (dp, n);
+
+ mpn_random2 (ip-1, n + 2);
+ i_before = ip[-1];
+ i_after = ip[n];
+
+ itch = mpn_invert_itch (n);
+ ASSERT_ALWAYS (itch <= mpn_invert_itch (MAX_N));
+ mpn_random2 (scratch-1, itch+2);
+ s_before = scratch[-1];
+ s_after = scratch[itch];
+
+ dp[n-1] |= GMP_NUMB_HIGHBIT;
+ mpn_invert (ip, dp, n, scratch);
+ if (ip[-1] != i_before || ip[n] != i_after
+ || scratch[-1] != s_before || scratch[itch] != s_after
+ || ! invert_valid(ip, dp, n))
+ {
+ printf ("ERROR in test %d, n = %d\n",
+ test, (int) n);
+ if (ip[-1] != i_before)
+ {
+ printf ("before ip:"); mpn_dump (ip -1, 1);
+ printf ("keep: "); mpn_dump (&i_before, 1);
+ }
+ if (ip[n] != i_after)
+ {
+ printf ("after ip:"); mpn_dump (ip + n, 1);
+ printf ("keep: "); mpn_dump (&i_after, 1);
+ }
+ if (scratch[-1] != s_before)
+ {
+ printf ("before scratch:"); mpn_dump (scratch-1, 1);
+ printf ("keep: "); mpn_dump (&s_before, 1);
+ }
+ if (scratch[itch] != s_after)
+ {
+ printf ("after scratch:"); mpn_dump (scratch + itch, 1);
+ printf ("keep: "); mpn_dump (&s_after, 1);
+ }
+ mpn_dump (dp, n);
+ mpn_dump (ip, n);
+
+ abort();
+ }
+ }
+ TMP_FREE;
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-iord_u.c b/vendor/gmp-6.3.0/tests/mpn/t-iord_u.c
new file mode 100644
index 0000000..2b27713
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-iord_u.c
@@ -0,0 +1,220 @@
+/* Test MPN_INCR_U and MPN_DECR_U.
+
+Copyright 2001, 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+/* The i386 MPN_INCR_U and MPN_DECR_U have special cases for "n" being a
+ compile-time constant 1, so that's exercised explicitly. */
+
+
+#define M GMP_NUMB_MAX
+#define SIZE ((mp_size_t) 10)
+
+
+void
+check_one (const char *name, int i,
+ mp_srcptr src, mp_limb_t n,
+ mp_srcptr got, mp_srcptr want, mp_size_t size)
+{
+ if (! refmpn_equal_anynail (got, want, size))
+ {
+ printf ("Wrong at %s i=%d\n", name, i);
+ mpn_trace (" src", src, size);
+ mpn_trace (" n", &n, (mp_size_t) 1);
+ mpn_trace (" got", got, size);
+ mpn_trace (" want", want, size);
+ abort ();
+ }
+}
+
+
+void
+check_incr_data (void)
+{
+ static const struct {
+ mp_limb_t n;
+ const mp_limb_t src[SIZE];
+ const mp_limb_t want[SIZE];
+ } data[] = {
+ { 1, { 0 }, { 1 } },
+ { 1, { 123 }, { 124 } },
+ { 2, { 0 }, { 2 } },
+ { 2, { 123 }, { 125 } },
+ { M, { 0 }, { M } },
+
+ { 1, { M, 0 }, { 0, 1 } },
+ { 1, { M, 123 }, { 0, 124 } },
+ { 2, { M, 0 }, { 1, 1 } },
+ { 2, { M, 123 }, { 1, 124 } },
+ { M, { M, 0 }, { M-1, 1 } },
+ { M, { M, 123 }, { M-1, 124 } },
+
+ { 1, { M, M, 0 }, { 0, 0, 1 } },
+ { 1, { M, M, 123 }, { 0, 0, 124 } },
+ { 2, { M, M, 0 }, { 1, 0, 1 } },
+ { 2, { M, M, 123 }, { 1, 0, 124 } },
+ { M, { M, M, 0 }, { M-1, 0, 1 } },
+ { M, { M, M, 123 }, { M-1, 0, 124 } },
+
+ { 1, { M, M, M, 0 }, { 0, 0, 0, 1 } },
+ { 1, { M, M, M, 123 }, { 0, 0, 0, 124 } },
+ { 2, { M, M, M, 0 }, { 1, 0, 0, 1 } },
+ { 2, { M, M, M, 123 }, { 1, 0, 0, 124 } },
+ { M, { M, M, M, 0 }, { M-1, 0, 0, 1 } },
+ { M, { M, M, M, 123 }, { M-1, 0, 0, 124 } },
+
+ { 1, { M, M, M, M, 0 }, { 0, 0, 0, 0, 1 } },
+ { 1, { M, M, M, M, 123 }, { 0, 0, 0, 0, 124 } },
+ { 2, { M, M, M, M, 0 }, { 1, 0, 0, 0, 1 } },
+ { 2, { M, M, M, M, 123 }, { 1, 0, 0, 0, 124 } },
+ { M, { M, M, M, M, 0 }, { M-1, 0, 0, 0, 1 } },
+ { M, { M, M, M, M, 123 }, { M-1, 0, 0, 0, 124
+#if defined (__hpux) && ! defined (__GNUC__)
+ /* Some versions (at least HP92453-01 B.11.11.23709.GP) of the
+ HP C compilers fail to zero-fill aggregates as the ISO C standard
+ requires (cf 6.5.7 Initialization). Compensate here: */
+ , 0, 0, 0, 0, 0
+#endif
+ } }
+ };
+
+ mp_limb_t got[SIZE];
+ int i;
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ refmpn_copyi (got, data[i].src, SIZE);
+ MPN_INCR_U (got, SIZE, data[i].n);
+ check_one ("check_incr (general)", i,
+ data[i].src, data[i].n,
+ got, data[i].want, SIZE);
+
+ if (data[i].n == 1)
+ {
+ refmpn_copyi (got, data[i].src, SIZE);
+ MPN_INCR_U (got, SIZE, CNST_LIMB(1));
+ check_one ("check_incr (const 1)", i,
+ data[i].src, data[i].n,
+ got, data[i].want, SIZE);
+ }
+ }
+}
+
+void
+check_decr_data (void)
+{
+ static const struct {
+ mp_limb_t n;
+ const mp_limb_t src[SIZE];
+ const mp_limb_t want[SIZE];
+ } data[] = {
+ { 1, { 1 }, { 0 } },
+ { 1, { 123 }, { 122 } },
+ { 1, { M }, { M-1 } },
+ { 2, { 2 }, { 0 } },
+ { 2, { 123 }, { 121 } },
+ { M, { M }, { 0 } },
+ { M-1, { M }, { 1 } },
+
+ { 1, { 0, 1 }, { M, 0 } },
+ { 1, { 0, 123 }, { M, 122 } },
+ { 1, { 0, M }, { M, M-1 } },
+ { 2, { 0, 123 }, { M-1, 122 } },
+ { 2, { 1, 123 }, { M, 122 } },
+ { M, { 0, 123 }, { 1, 122 } },
+ { M, { M-1, M }, { M, M-1 } },
+
+ { 1, { 0, 0, 1 }, { M, M, 0 } },
+ { 1, { 0, 0, 123 }, { M, M, 122 } },
+ { 1, { 0, 0, M }, { M, M, M-1 } },
+ { 2, { 0, 0, 123 }, { M-1, M, 122 } },
+ { 2, { 1, 0, 123 }, { M, M, 122 } },
+ { M, { 0, 0, 123 }, { 1, M, 122 } },
+ { M, { M-1, 0, M }, { M, M, M-1 } },
+
+ { 1, { 0, 0, 0, 1 }, { M, M, M, 0 } },
+ { 1, { 0, 0, 0, 123 }, { M, M, M, 122 } },
+ { 1, { 0, 0, 0, M }, { M, M, M, M-1 } },
+ { 2, { 0, 0, 0, 123 }, { M-1, M, M, 122 } },
+ { 2, { 1, 0, 0, 123 }, { M, M, M, 122 } },
+ { M, { 0, 0, 0, 123 }, { 1, M, M, 122 } },
+ { M, { M-1, 0, 0, M }, { M, M, M, M-1 } },
+
+ { 1, { 0, 0, 0, 0, 1 }, { M, M, M, M, 0 } },
+ { 1, { 0, 0, 0, 0, 123 }, { M, M, M, M, 122 } },
+ { 1, { 0, 0, 0, 0, M }, { M, M, M, M, M-1 } },
+ { 2, { 0, 0, 0, 0, 123 }, { M-1, M, M, M, 122 } },
+ { 2, { 1, 0, 0, 0, 123 }, { M, M, M, M, 122 } },
+ { M, { 0, 0, 0, 0, 123 }, { 1, M, M, M, 122 } },
+ { M, { M-1, 0, 0, 0, M }, { M, M, M, M, M-1 } },
+
+ { 1, { 0, 0, 0, 0, 0, 1 }, { M, M, M, M, M, 0 } },
+ { 1, { 0, 0, 0, 0, 0, 123 }, { M, M, M, M, M, 122 } },
+ { 1, { 0, 0, 0, 0, 0, M }, { M, M, M, M, M, M-1 } },
+ { 2, { 0, 0, 0, 0, 0, 123 }, { M-1, M, M, M, M, 122 } },
+ { 2, { 1, 0, 0, 0, 0, 123 }, { M, M, M, M, M, 122 } },
+ { M, { 0, 0, 0, 0, 0, 123 }, { 1, M, M, M, M, 122 } },
+ { M, { M-1, 0, 0, 0, 0, M }, { M, M, M, M, M, M-1
+#if defined (__hpux) && ! defined (__GNUC__)
+ /* For explanation of this garbage, see previous function. */
+ , 0, 0, 0, 0
+#endif
+ } }
+ };
+
+ mp_limb_t got[SIZE];
+ int i;
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ refmpn_copyi (got, data[i].src, SIZE);
+ MPN_DECR_U (got, SIZE, data[i].n);
+ check_one ("check_decr_data", i,
+ data[i].src, data[i].n,
+ got, data[i].want, SIZE);
+
+ if (data[i].n == 1)
+ {
+ refmpn_copyi (got, data[i].src, SIZE);
+ MPN_DECR_U (got, SIZE, CNST_LIMB(1));
+ check_one ("check_decr (const 1)", i,
+ data[i].src, data[i].n,
+ got, data[i].want, SIZE);
+ }
+ }
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+ mp_trace_base = -16;
+
+ check_incr_data ();
+ check_decr_data ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-matrix22.c b/vendor/gmp-6.3.0/tests/mpn/t-matrix22.c
new file mode 100644
index 0000000..1fa1e3f
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-matrix22.c
@@ -0,0 +1,206 @@
+/* Tests matrix22_mul.
+
+Copyright 2008 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+struct matrix {
+ mp_size_t alloc;
+ mp_size_t n;
+ mp_ptr e00, e01, e10, e11;
+};
+
+static void
+matrix_init (struct matrix *M, mp_size_t n)
+{
+ mp_ptr p = refmpn_malloc_limbs (4*(n+1));
+ M->e00 = p; p += n+1;
+ M->e01 = p; p += n+1;
+ M->e10 = p; p += n+1;
+ M->e11 = p;
+ M->alloc = n + 1;
+ M->n = 0;
+}
+
+static void
+matrix_clear (struct matrix *M)
+{
+ refmpn_free_limbs (M->e00);
+}
+
+static void
+matrix_copy (struct matrix *R, const struct matrix *M)
+{
+ R->n = M->n;
+ MPN_COPY (R->e00, M->e00, M->n);
+ MPN_COPY (R->e01, M->e01, M->n);
+ MPN_COPY (R->e10, M->e10, M->n);
+ MPN_COPY (R->e11, M->e11, M->n);
+}
+
+/* Used with same size, so no need for normalization. */
+static int
+matrix_equal_p (const struct matrix *A, const struct matrix *B)
+{
+ return (A->n == B->n
+ && mpn_cmp (A->e00, B->e00, A->n) == 0
+ && mpn_cmp (A->e01, B->e01, A->n) == 0
+ && mpn_cmp (A->e10, B->e10, A->n) == 0
+ && mpn_cmp (A->e11, B->e11, A->n) == 0);
+}
+
+static void
+matrix_random(struct matrix *M, mp_size_t n, gmp_randstate_ptr rands)
+{
+ M->n = n;
+ mpn_random (M->e00, n);
+ mpn_random (M->e01, n);
+ mpn_random (M->e10, n);
+ mpn_random (M->e11, n);
+}
+
+#define MUL(rp, ap, an, bp, bn) do { \
+ if (an > bn) \
+ mpn_mul (rp, ap, an, bp, bn); \
+ else \
+ mpn_mul (rp, bp, bn, ap, an); \
+ } while(0)
+
+static void
+ref_matrix22_mul (struct matrix *R,
+ const struct matrix *A,
+ const struct matrix *B, mp_ptr tp)
+{
+ mp_size_t an, bn, n;
+ mp_ptr r00, r01, r10, r11, a00, a01, a10, a11, b00, b01, b10, b11;
+
+ if (A->n >= B->n)
+ {
+ r00 = R->e00; a00 = A->e00; b00 = B->e00;
+ r01 = R->e01; a01 = A->e01; b01 = B->e01;
+ r10 = R->e10; a10 = A->e10; b10 = B->e10;
+ r11 = R->e11; a11 = A->e11; b11 = B->e11;
+ an = A->n, bn = B->n;
+ }
+ else
+ {
+ /* Transpose */
+ r00 = R->e00; a00 = B->e00; b00 = A->e00;
+ r01 = R->e10; a01 = B->e10; b01 = A->e10;
+ r10 = R->e01; a10 = B->e01; b10 = A->e01;
+ r11 = R->e11; a11 = B->e11; b11 = A->e11;
+ an = B->n, bn = A->n;
+ }
+ n = an + bn;
+ R->n = n + 1;
+
+ mpn_mul (r00, a00, an, b00, bn);
+ mpn_mul (tp, a01, an, b10, bn);
+ r00[n] = mpn_add_n (r00, r00, tp, n);
+
+ mpn_mul (r01, a00, an, b01, bn);
+ mpn_mul (tp, a01, an, b11, bn);
+ r01[n] = mpn_add_n (r01, r01, tp, n);
+
+ mpn_mul (r10, a10, an, b00, bn);
+ mpn_mul (tp, a11, an, b10, bn);
+ r10[n] = mpn_add_n (r10, r10, tp, n);
+
+ mpn_mul (r11, a10, an, b01, bn);
+ mpn_mul (tp, a11, an, b11, bn);
+ r11[n] = mpn_add_n (r11, r11, tp, n);
+}
+
+static void
+one_test (const struct matrix *A, const struct matrix *B, int i)
+{
+ struct matrix R;
+ struct matrix P;
+ mp_ptr tp;
+
+ matrix_init (&R, A->n + B->n + 1);
+ matrix_init (&P, A->n + B->n + 1);
+
+ tp = refmpn_malloc_limbs (mpn_matrix22_mul_itch (A->n, B->n));
+
+ ref_matrix22_mul (&R, A, B, tp);
+ matrix_copy (&P, A);
+ mpn_matrix22_mul (P.e00, P.e01, P.e10, P.e11, A->n,
+ B->e00, B->e01, B->e10, B->e11, B->n, tp);
+ P.n = A->n + B->n + 1;
+ if (!matrix_equal_p (&R, &P))
+ {
+ fprintf (stderr, "ERROR in test %d\n", i);
+ gmp_fprintf (stderr, "A = (%Nx, %Nx\n %Nx, %Nx)\n"
+ "B = (%Nx, %Nx\n %Nx, %Nx)\n"
+ "R = (%Nx, %Nx (expected)\n %Nx, %Nx)\n"
+ "P = (%Nx, %Nx (incorrect)\n %Nx, %Nx)\n",
+ A->e00, A->n, A->e01, A->n, A->e10, A->n, A->e11, A->n,
+ B->e00, B->n, B->e01, B->n, B->e10, B->n, B->e11, B->n,
+ R.e00, R.n, R.e01, R.n, R.e10, R.n, R.e11, R.n,
+ P.e00, P.n, P.e01, P.n, P.e10, P.n, P.e11, P.n);
+ abort();
+ }
+ refmpn_free_limbs (tp);
+ matrix_clear (&R);
+ matrix_clear (&P);
+}
+
+#define MAX_SIZE (2+2*MATRIX22_STRASSEN_THRESHOLD)
+
+int
+main (int argc, char **argv)
+{
+ struct matrix A;
+ struct matrix B;
+
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ int i;
+
+ tests_start ();
+ rands = RANDS;
+
+ matrix_init (&A, MAX_SIZE);
+ matrix_init (&B, MAX_SIZE);
+ mpz_init (bs);
+
+ for (i = 0; i < 1000; i++)
+ {
+ mp_size_t an, bn;
+ mpz_urandomb (bs, rands, 32);
+ an = 1 + mpz_get_ui (bs) % MAX_SIZE;
+ mpz_urandomb (bs, rands, 32);
+ bn = 1 + mpz_get_ui (bs) % MAX_SIZE;
+
+ matrix_random (&A, an, rands);
+ matrix_random (&B, bn, rands);
+
+ one_test (&A, &B, i);
+ }
+ mpz_clear (bs);
+ matrix_clear (&A);
+ matrix_clear (&B);
+
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-minvert.c b/vendor/gmp-6.3.0/tests/mpn/t-minvert.c
new file mode 100644
index 0000000..ca5690f
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-minvert.c
@@ -0,0 +1,167 @@
+/* Copyright 2013-2015 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h> /* for strtol */
+
+#include "gmp-impl.h"
+#include "longlong.h"
+#include "tests/tests.h"
+
+#define MAX_SIZE 50
+
+#define COUNT 200
+
+static void
+mpz_to_mpn (mp_ptr ap, mp_size_t an, const mpz_t b)
+{
+ mp_size_t bn = mpz_size (b);
+ ASSERT_ALWAYS (bn <= an);
+ MPN_COPY_INCR (ap, mpz_limbs_read (b), bn);
+ MPN_ZERO (ap + bn, an - bn);
+}
+
+int
+mpz_eq_mpn (mp_ptr ap, mp_size_t an, const mpz_t b)
+{
+ mp_size_t bn = mpz_size (b);
+
+ return (bn >= 0 && bn <= an
+ && mpn_cmp (ap, mpz_limbs_read (b), bn) == 0
+ && (an == bn || mpn_zero_p (ap + bn, an - bn)));
+}
+
+static mp_bitcnt_t
+bit_size (mp_srcptr xp, mp_size_t n)
+{
+ MPN_NORMALIZE (xp, n);
+ return n > 0 ? mpn_sizeinbase (xp, n, 2) : 0;
+}
+
+int
+main (int argc, char **argv)
+{
+ gmp_randstate_ptr rands;
+ long count = COUNT;
+ mp_ptr mp;
+ mp_ptr ap;
+ mp_ptr tp;
+ mp_ptr scratch;
+ mpz_t m, a, r, g;
+ int test;
+ mp_limb_t ran;
+ mp_size_t itch;
+ TMP_DECL;
+
+ tests_start ();
+ rands = RANDS;
+
+
+ TMP_MARK;
+ mpz_init (m);
+ mpz_init (a);
+ mpz_init (r);
+ mpz_init (g);
+
+ TESTS_REPS (count, argv, argc);
+
+ mp = TMP_ALLOC_LIMBS (MAX_SIZE);
+ ap = TMP_ALLOC_LIMBS (MAX_SIZE);
+ tp = TMP_ALLOC_LIMBS (MAX_SIZE);
+ scratch = TMP_ALLOC_LIMBS (mpn_sec_invert_itch (MAX_SIZE) + 1);
+
+ for (test = 0; test < count; test++)
+ {
+ mp_bitcnt_t bits;
+ int rres, tres;
+ mp_size_t n;
+
+ bits = urandom () % (GMP_NUMB_BITS * MAX_SIZE) + 1;
+
+ if (test & 1)
+ mpz_rrandomb (m, rands, bits);
+ else
+ mpz_urandomb (m, rands, bits);
+ if (test & 2)
+ mpz_rrandomb (a, rands, bits);
+ else
+ mpz_urandomb (a, rands, bits);
+
+ mpz_setbit (m, 0);
+ if (test & 4)
+ {
+ /* Ensure it really is invertible */
+ if (mpz_sgn (a) == 0)
+ mpz_set_ui (a, 1);
+ else
+ for (;;)
+ {
+ mpz_gcd (g, a, m);
+ if (mpz_cmp_ui (g, 1) == 0)
+ break;
+ mpz_remove (a, a, g);
+ }
+ }
+
+ rres = mpz_invert (r, a, m);
+ if ( (test & 4) && !rres)
+ {
+ gmp_fprintf (stderr, "test %d: Not invertible!\n"
+ "m = %Zd\n"
+ "a = %Zd\n", test, m, a);
+ abort ();
+ }
+ ASSERT_ALWAYS (! (test & 4) || rres);
+
+ n = (bits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
+ ASSERT_ALWAYS (n <= MAX_SIZE);
+ itch = mpn_sec_invert_itch (n);
+ scratch[itch] = ran = urandom ();
+
+ mpz_to_mpn (ap, n, a);
+ mpz_to_mpn (mp, n, m);
+ tres = mpn_sec_invert (tp, ap, mp, n,
+ bit_size (ap, n) + bit_size (mp, n),
+ scratch);
+
+ if (rres != tres || (rres == 1 && !mpz_eq_mpn (tp, n, r)) || ran != scratch[itch])
+ {
+ gmp_fprintf (stderr, "Test %d failed.\n"
+ "m = %Zd\n"
+ "a = %Zd\n", test, m, a);
+ fprintf (stderr, "ref ret: %d\n"
+ "got ret: %d\n", rres, tres);
+ if (rres)
+ gmp_fprintf (stderr, "ref: %Zd\n", r);
+ if (tres)
+ gmp_fprintf (stderr, "got: %Nd\n", tp, n);
+ if (ran != scratch[itch])
+ fprintf (stderr, "scratch[itch] changed.\n");
+ abort ();
+ }
+ }
+
+ TMP_FREE;
+
+ mpz_clear (m);
+ mpz_clear (a);
+ mpz_clear (r);
+ mpz_clear (g);
+
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-mod_1.c b/vendor/gmp-6.3.0/tests/mpn/t-mod_1.c
new file mode 100644
index 0000000..5b9570d
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-mod_1.c
@@ -0,0 +1,127 @@
+/* Test mpn_mod_1 variants.
+
+Copyright 2010, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+static void
+check_one (mp_srcptr ap, mp_size_t n, mp_limb_t b)
+{
+ mp_limb_t r_ref = refmpn_mod_1 (ap, n, b);
+ mp_limb_t r;
+
+ if (n >= 2)
+ {
+ mp_limb_t pre[4];
+ mpn_mod_1_1p_cps (pre, b);
+ r = mpn_mod_1_1p (ap, n, b << pre[1], pre);
+ if (r != r_ref)
+ {
+ printf ("mpn_mod_1_1p failed\n");
+ goto fail;
+ }
+ }
+ if ((b & GMP_NUMB_HIGHBIT) == 0)
+ {
+ mp_limb_t pre[5];
+ mpn_mod_1s_2p_cps (pre, b);
+ r = mpn_mod_1s_2p (ap, n, b << pre[1], pre);
+ if (r != r_ref)
+ {
+ printf ("mpn_mod_1s_2p failed\n");
+ goto fail;
+ }
+ }
+ if (b <= GMP_NUMB_MASK / 3)
+ {
+ mp_limb_t pre[6];
+ mpn_mod_1s_3p_cps (pre, b);
+ r = mpn_mod_1s_3p (ap, n, b << pre[1], pre);
+ if (r != r_ref)
+ {
+ printf ("mpn_mod_1s_3p failed\n");
+ goto fail;
+ }
+ }
+ if (b <= GMP_NUMB_MASK / 4)
+ {
+ mp_limb_t pre[7];
+ mpn_mod_1s_4p_cps (pre, b);
+ r = mpn_mod_1s_4p (ap, n, b << pre[1], pre);
+ if (r != r_ref)
+ {
+ printf ("mpn_mod_1s_4p failed\n");
+ goto fail;
+ }
+ }
+ r = mpn_mod_1 (ap, n, b);
+ if (r != r_ref)
+ {
+ printf ("mpn_mod_1 failed\n");
+ fail:
+ printf ("an = %d, a: ", (int) n); mpn_dump (ap, n);
+ printf ("b : "); mpn_dump (&b, 1);
+ printf ("r (expected): "); mpn_dump (&r_ref, 1);
+ printf ("r (bad) : "); mpn_dump (&r, 1);
+ abort();
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ gmp_randstate_ptr rands;
+ int i;
+ unsigned a_bits;
+ unsigned b_bits;
+ mpz_t a;
+ mpz_t b;
+
+ tests_start ();
+ rands = RANDS;
+ mpz_init (a);
+ mpz_init (b);
+
+ for (i = 0; i < 300; i++)
+ {
+ mp_size_t asize;
+ a_bits = 1 + gmp_urandomm_ui (rands, 1000);
+ b_bits = 1 + gmp_urandomm_ui (rands, GMP_NUMB_BITS);
+
+ mpz_rrandomb (a, rands, a_bits);
+ mpz_rrandomb (b, rands, b_bits);
+
+ asize = SIZ(a);
+ if (!asize)
+ asize = 1;
+ if (mpz_sgn (b) == 0)
+ mpz_set_ui (b, 1);
+
+ check_one (PTR(a), asize, PTR(b)[0]);
+ }
+
+ mpz_clear (a);
+ mpz_clear (b);
+
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-mp_bases.c b/vendor/gmp-6.3.0/tests/mpn/t-mp_bases.c
new file mode 100644
index 0000000..deb7f5c
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-mp_bases.c
@@ -0,0 +1,104 @@
+/* Check mp_bases values.
+
+Copyright 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "longlong.h"
+#include "tests.h"
+
+
+int
+main (int argc, char *argv[])
+{
+ mp_limb_t want_bb, want_bb_inv;
+ int base, want_chars_per_limb;
+
+ want_chars_per_limb = refmpn_chars_per_limb (10);
+ if (MP_BASES_CHARS_PER_LIMB_10 != want_chars_per_limb)
+ {
+ printf ("MP_BASES_CHARS_PER_LIMB_10 wrong\n");
+ abort ();
+ }
+
+ want_bb = refmpn_big_base (10);
+ if (MP_BASES_BIG_BASE_10 != want_bb)
+ {
+ printf ("MP_BASES_BIG_BASE_10 wrong\n");
+ abort ();
+ }
+
+ want_bb_inv = refmpn_invert_limb
+ (want_bb << refmpn_count_leading_zeros (want_bb));
+ if (MP_BASES_BIG_BASE_INVERTED_10 != want_bb_inv)
+ {
+ printf ("MP_BASES_BIG_BASE_INVERTED_10 wrong\n");
+ abort ();
+ }
+
+ if (MP_BASES_NORMALIZATION_STEPS_10
+ != refmpn_count_leading_zeros (MP_BASES_BIG_BASE_10))
+ {
+ printf ("MP_BASES_NORMALIZATION_STEPS_10 wrong\n");
+ abort ();
+ }
+
+ for (base = 2; base < numberof (mp_bases); base++)
+ {
+ want_chars_per_limb = refmpn_chars_per_limb (base);
+ if (mp_bases[base].chars_per_limb != want_chars_per_limb)
+ {
+ printf ("mp_bases[%d].chars_per_limb wrong\n", base);
+ printf (" got %d\n", mp_bases[base].chars_per_limb);
+ printf (" want %d\n", want_chars_per_limb);
+ abort ();
+ }
+
+ if (POW2_P (base))
+ {
+ want_bb = refmpn_count_trailing_zeros ((mp_limb_t) base);
+ if (mp_bases[base].big_base != want_bb)
+ {
+ printf ("mp_bases[%d].big_base (log2 of base) wrong\n", base);
+ abort ();
+ }
+ }
+ else
+ {
+ want_bb = refmpn_big_base (base);
+ if (mp_bases[base].big_base != want_bb)
+ {
+ printf ("mp_bases[%d].big_base wrong\n", base);
+ abort ();
+ }
+
+#if USE_PREINV_DIVREM_1
+ want_bb_inv = refmpn_invert_limb
+ (want_bb << refmpn_count_leading_zeros (want_bb));
+ if (mp_bases[base].big_base_inverted != want_bb_inv)
+ {
+ printf ("mp_bases[%d].big_base_inverted wrong\n", base);
+ abort ();
+ }
+#endif
+ }
+ }
+
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-mul.c b/vendor/gmp-6.3.0/tests/mpn/t-mul.c
new file mode 100644
index 0000000..40f6de7
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-mul.c
@@ -0,0 +1,97 @@
+/* Test mpn_mul function for all sizes up to a selected limit.
+
+Copyright 2011, 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+static unsigned
+isqrt (unsigned t)
+{
+ unsigned s, b;
+
+ for (b = 0, s = t; b++, s >>= 1; )
+ ;
+
+ s = 1 << (b >> 1);
+ if (b & 1)
+ s += s >> 1;
+
+ do
+ {
+ b = t / s;
+ s = (s + b) >> 1;
+ }
+ while (b < s);
+
+ return s;
+}
+
+int
+main (int argc, char **argv)
+{
+ mp_ptr ap, bp, rp, refp;
+ mp_size_t max_n, an, bn, rn;
+ int reps;
+ TMP_DECL;
+ TMP_MARK;
+
+ reps = 1;
+
+ tests_start ();
+ TESTS_REPS (reps, argv, argc);
+
+ /* Re-interpret reps argument as a size argument. */
+ max_n = isqrt (reps * 25000);
+
+ ap = TMP_ALLOC_LIMBS (max_n + 1);
+ bp = TMP_ALLOC_LIMBS (max_n + 1);
+ rp = TMP_ALLOC_LIMBS (2 * max_n);
+ refp = TMP_ALLOC_LIMBS (2 * max_n);
+
+ for (an = 1; an <= max_n; an += 1)
+ {
+ for (bn = 1; bn <= an; bn += 1)
+ {
+ mpn_random2 (ap, an + 1);
+ mpn_random2 (bp, bn + 1);
+
+ refmpn_mul (refp, ap, an, bp, bn);
+ mpn_mul (rp, ap, an, bp, bn);
+
+ rn = an + bn;
+ if (mpn_cmp (refp, rp, rn))
+ {
+ printf ("ERROR, an = %d, bn = %d, rn = %d\n",
+ (int) an, (int) bn, (int) rn);
+ printf ("a: "); mpn_dump (ap, an);
+ printf ("b: "); mpn_dump (bp, bn);
+ printf ("r: "); mpn_dump (rp, rn);
+ printf ("ref: "); mpn_dump (refp, rn);
+ abort();
+ }
+ }
+ }
+ TMP_FREE;
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-mullo.c b/vendor/gmp-6.3.0/tests/mpn/t-mullo.c
new file mode 100644
index 0000000..75a0f01
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-mullo.c
@@ -0,0 +1,132 @@
+/* Test for mullo function.
+
+Copyright 2009 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+/* Sizes are up to 2^SIZE_LOG limbs */
+#ifndef SIZE_LOG
+#define SIZE_LOG 10
+#endif
+
+#ifndef COUNT
+#define COUNT 10000
+#endif
+
+#define MAX_N (1L << SIZE_LOG)
+#define MIN_N (1)
+
+int
+main (int argc, char **argv)
+{
+ mp_ptr ap, bp, refp, pp, scratch;
+ int count = COUNT;
+ int test;
+ gmp_randstate_ptr rands;
+ TMP_DECL;
+ TMP_MARK;
+
+ TESTS_REPS (count, argv, argc);
+
+ tests_start ();
+ rands = RANDS;
+
+#define mpn_mullo_itch(n) (0)
+
+ ap = TMP_ALLOC_LIMBS (MAX_N);
+ bp = TMP_ALLOC_LIMBS (MAX_N);
+ refp = TMP_ALLOC_LIMBS (MAX_N * 2);
+ pp = 1+TMP_ALLOC_LIMBS (MAX_N + 2);
+ scratch
+ = 1+TMP_ALLOC_LIMBS (mpn_mullo_itch (MAX_N) + 2);
+
+ for (test = 0; test < count; test++)
+ {
+ unsigned size_min;
+ unsigned size_range;
+ mp_size_t n;
+ mp_size_t itch;
+ mp_limb_t p_before, p_after, s_before, s_after;
+
+ for (size_min = 1; (1L << size_min) < MIN_N; size_min++)
+ ;
+
+ /* We generate an in the MIN_N <= n <= (1 << size_range). */
+ size_range = size_min
+ + gmp_urandomm_ui (rands, SIZE_LOG + 1 - size_min);
+
+ n = MIN_N
+ + gmp_urandomm_ui (rands, (1L << size_range) + 1 - MIN_N);
+
+ mpn_random2 (ap, n);
+ mpn_random2 (bp, n);
+ mpn_random2 (pp-1, n + 2);
+ p_before = pp[-1];
+ p_after = pp[n];
+
+ itch = mpn_mullo_itch (n);
+ ASSERT_ALWAYS (itch <= mpn_mullo_itch (MAX_N));
+ mpn_random2 (scratch-1, itch+2);
+ s_before = scratch[-1];
+ s_after = scratch[itch];
+
+ mpn_mullo_n (pp, ap, bp, n);
+ mpn_mul_n (refp, ap, bp, n);
+ if (pp[-1] != p_before || pp[n] != p_after
+ || scratch[-1] != s_before || scratch[itch] != s_after
+ || mpn_cmp (refp, pp, n) != 0)
+ {
+ printf ("ERROR in test %d, n = %d",
+ test, (int) n);
+ if (pp[-1] != p_before)
+ {
+ printf ("before pp:"); mpn_dump (pp -1, 1);
+ printf ("keep: "); mpn_dump (&p_before, 1);
+ }
+ if (pp[n] != p_after)
+ {
+ printf ("after pp:"); mpn_dump (pp + n, 1);
+ printf ("keep: "); mpn_dump (&p_after, 1);
+ }
+ if (scratch[-1] != s_before)
+ {
+ printf ("before scratch:"); mpn_dump (scratch-1, 1);
+ printf ("keep: "); mpn_dump (&s_before, 1);
+ }
+ if (scratch[itch] != s_after)
+ {
+ printf ("after scratch:"); mpn_dump (scratch + itch, 1);
+ printf ("keep: "); mpn_dump (&s_after, 1);
+ }
+ mpn_dump (ap, n);
+ mpn_dump (bp, n);
+ mpn_dump (pp, n);
+ mpn_dump (refp, n);
+
+ abort();
+ }
+ }
+ TMP_FREE;
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-mulmid.c b/vendor/gmp-6.3.0/tests/mpn/t-mulmid.c
new file mode 100644
index 0000000..9491b0e
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-mulmid.c
@@ -0,0 +1,92 @@
+/* Test for mulmid function.
+
+Copyright 2011 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+/* Sizes are up to 2^SIZE_LOG limbs */
+#ifndef SIZE_LOG
+#define SIZE_LOG 9
+#endif
+
+#ifndef COUNT
+#define COUNT 5000
+#endif
+
+#define MAX_N (1L << SIZE_LOG)
+
+int
+main (int argc, char **argv)
+{
+ mp_ptr ap, bp, rp, refp;
+ gmp_randstate_ptr rands;
+ int test;
+ TMP_DECL;
+ TMP_MARK;
+
+ tests_start ();
+ rands = RANDS;
+
+ ap = TMP_ALLOC_LIMBS (MAX_N);
+ bp = TMP_ALLOC_LIMBS (MAX_N);
+ rp = TMP_ALLOC_LIMBS (MAX_N + 2);
+ refp = TMP_ALLOC_LIMBS (MAX_N + 2);
+
+ for (test = 0; test < COUNT; test++)
+ {
+ mp_size_t an, bn, rn;
+ unsigned size_log;
+
+ size_log = 1 + gmp_urandomm_ui (rands, SIZE_LOG);
+ an = 1 + gmp_urandomm_ui(rands, 1L << size_log);
+
+ size_log = 1 + gmp_urandomm_ui (rands, SIZE_LOG);
+ bn = 1 + gmp_urandomm_ui(rands, 1L << size_log);
+
+ /* Make sure an >= bn */
+ if (an < bn)
+ MP_SIZE_T_SWAP (an, bn);
+
+ mpn_random2 (ap, an);
+ mpn_random2 (bp, bn);
+
+ refmpn_mulmid (refp, ap, an, bp, bn);
+ mpn_mulmid (rp, ap, an, bp, bn);
+
+ rn = an + 3 - bn;
+ if (mpn_cmp (refp, rp, rn))
+ {
+ printf ("ERROR in test %d, an = %d, bn = %d, rn = %d\n",
+ test, (int) an, (int) bn, (int) rn);
+ printf("a: "); mpn_dump (ap, an);
+ printf("b: "); mpn_dump (bp, bn);
+ printf("r: "); mpn_dump (rp, rn);
+ printf("ref: "); mpn_dump (refp, rn);
+
+ abort();
+ }
+ }
+ TMP_FREE;
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-mulmod_bknp1.c b/vendor/gmp-6.3.0/tests/mpn/t-mulmod_bknp1.c
new file mode 100644
index 0000000..93da1eb
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-mulmod_bknp1.c
@@ -0,0 +1,202 @@
+/* Test for mulmod_bknp1 function.
+
+ Contributed to the GNU project by Marco Bodrato.
+
+Copyright 2009, 2020-2022 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#if MOD_BKNP1_USE11
+#define USE11 11,
+#else
+#define USE11
+#endif
+
+
+#if GMP_NUMB_BITS % 32 == 0
+#define MAX_K 17
+#define SUPPORTED_K {3, 5, 7, 13, USE11 MAX_K}
+#else
+#if GMP_NUMB_BITS % 16 == 0
+#define MAX_K 13
+#define SUPPORTED_K {3, 5, 7, USE11 MAX_K}
+#else
+#if GMP_NUMB_BITS % 8 == 0
+#define MAX_K 7
+#define SUPPORTED_K {3, USE11 MAX_K}
+#else
+#define SUPPORTED_K {USE11} /* Supported ? */
+#endif /* GMP_NUMB_BITS % 8 == 0 */
+#endif /* GMP_NUMB_BITS % 16 == 0 */
+#endif /* GMP_NUMB_BITS % 32 == 0 */
+
+#if MOD_BKNP1_ONLY3
+#undef SUPPORTED_K
+#undef MAX_K
+#define MAX_K 3
+#define SUPPORTED_K {3}
+#endif
+
+/* Sizes are up to MAX_K * 2^SIZE_LOG limbs */
+#ifndef SIZE_LOG
+#define SIZE_LOG 7
+#endif
+
+#ifndef COUNT
+#define COUNT 5000
+#endif
+
+#define MAX_N (MAX_K << SIZE_LOG)
+#define MIN_N 1
+
+/*
+ Reference function for multiplication modulo B^{k*rn}+1.
+*/
+
+static void
+ref_mulmod_bnp1 (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t rn)
+{
+ mp_limb_t cy;
+
+ mpn_mul_n (rp, ap, bp, rn + 1);
+ cy = rp[2 * rn];
+ MPN_INCR_U (rp, 2 * rn + 1, rp[2 * rn]);
+ cy = rp[2 * rn] - cy + mpn_sub_n (rp, rp, rp + rn, rn);
+ rp[rn] = 0;
+ MPN_INCR_U (rp, rn + 1, cy);
+}
+
+/*
+ Compare the result of the mpn_mulmod_bnp1 function in the library
+ with the reference function above.
+*/
+unsigned supported_k[] = SUPPORTED_K;
+
+int
+main (int argc, char **argv)
+{
+ mp_ptr ap, bp, refp, pp, scratch;
+ int count = COUNT;
+ int test;
+ gmp_randstate_ptr rands;
+ TMP_DECL;
+ TMP_MARK;
+
+ TESTS_REPS (count, argv, argc);
+
+ tests_start ();
+ rands = RANDS;
+
+ ap = TMP_ALLOC_LIMBS (MAX_N + 1);
+ bp = TMP_ALLOC_LIMBS (MAX_N + 1);
+ refp = TMP_ALLOC_LIMBS (MAX_N * 2 + 2);
+ pp = 1 + TMP_ALLOC_LIMBS (MAX_N + 3);
+ scratch
+ = 1 + TMP_ALLOC_LIMBS (mpn_mulmod_bknp1_itch (MAX_N) + 2);
+
+ for (test = 0; test < count; test++)
+ {
+ unsigned size_min;
+ unsigned size_range;
+ unsigned k;
+ mp_size_t rn, n;
+ mp_size_t itch;
+ mp_limb_t p_before, p_after, s_before, s_after;
+
+ for (size_min = 1; (1L << size_min) < MIN_N; size_min++)
+ ;
+
+ /* We generate rn in the MIN_N <= n <= (1 << size_range). */
+ size_range = size_min
+ + gmp_urandomm_ui (rands, SIZE_LOG + 1 - size_min);
+
+ k = supported_k[test % numberof (supported_k)];
+ n = MIN_N
+ + gmp_urandomm_ui (rands, (1L << size_range) + 1 - MIN_N);
+ rn = k * n;
+ if ((GMP_NUMB_MAX % k != 0) && (rn % 3 == 0))
+ n = rn / (k = 3);
+
+ if (test == 0)
+ {
+ mpn_random2 (ap, n);
+ mpn_add_1 (ap + n, ap, n, 1); /* {ap,an} = -1 mod B+1 */
+ MPN_ZERO (ap + 2 * n, rn - 2 * n + 1);
+ }
+ else
+ mpn_random2 (ap, rn + 1);
+ mpn_random2 (bp, rn + 1);
+
+ bp [rn] &= 1;
+ ap [rn] &= 1;
+
+ mpn_random2 (pp-1, rn + 3);
+ p_before = pp[-1];
+ p_after = pp[rn + 1];
+
+ itch = mpn_mulmod_bknp1_itch (rn);
+ ASSERT_ALWAYS (itch <= mpn_mulmod_bknp1_itch (MAX_N));
+ mpn_random2 (scratch - 1, itch + 2);
+ s_before = scratch[-1];
+ s_after = scratch[itch];
+
+ mpn_mulmod_bknp1 ( pp, ap, bp, n, k, scratch);
+ ref_mulmod_bnp1 (refp, ap, bp, rn);
+ if (pp[-1] != p_before || pp[rn + 1] != p_after
+ || scratch[-1] != s_before || scratch[itch] != s_after
+ || mpn_cmp (refp, pp, rn + 1) != 0)
+ {
+ printf ("ERROR in test %d, rn = %d, n = %d, k = %d\n",
+ test, (int) rn, (int) n, (int) k);
+ if (pp[-1] != p_before)
+ {
+ printf ("before pp:"); mpn_dump (pp - 1, 1);
+ printf ("keep: "); mpn_dump (&p_before, 1);
+ }
+ if (pp[rn + 1] != p_after)
+ {
+ printf ("after pp:"); mpn_dump (pp + rn + 1, 1);
+ printf ("keep: "); mpn_dump (&p_after, 1);
+ }
+ if (scratch[-1] != s_before)
+ {
+ printf ("before scratch:"); mpn_dump (scratch - 1, 1);
+ printf ("keep: "); mpn_dump (&s_before, 1);
+ }
+ if (scratch[itch] != s_after)
+ {
+ printf ("after scratch:"); mpn_dump (scratch + itch, 1);
+ printf ("keep: "); mpn_dump (&s_after, 1);
+ }
+ mpn_dump (ap, rn + 1);
+ mpn_dump (bp, rn + 1);
+ mpn_dump (pp, rn + 1);
+ mpn_dump (refp, rn + 1);
+
+ abort();
+ }
+ }
+ TMP_FREE;
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-mulmod_bnm1.c b/vendor/gmp-6.3.0/tests/mpn/t-mulmod_bnm1.c
new file mode 100644
index 0000000..08f59bb
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-mulmod_bnm1.c
@@ -0,0 +1,210 @@
+
+/* Test for mulmod_bnm1 function.
+
+ Contributed to the GNU project by Marco Bodrato.
+
+Copyright 2009, 2020 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+/* Sizes are up to 2^SIZE_LOG limbs */
+#ifndef SIZE_LOG
+#define SIZE_LOG 11
+#endif
+
+#ifndef COUNT
+#define COUNT 5000
+#endif
+
+#define MAX_N (1L << SIZE_LOG)
+#define MIN_N 1
+
+/*
+ Reference function for multiplication modulo B^rn-1.
+
+ The result is expected to be ZERO if and only if one of the operand
+ already is. Otherwise the class [0] Mod(B^rn-1) is represented by
+ B^rn-1. This should not be a problem if mulmod_bnm1 is used to
+ combine results and obtain a natural number when one knows in
+ advance that the final value is less than (B^rn-1).
+*/
+
+static void
+ref_mulmod_bnm1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
+{
+ mp_limb_t cy;
+
+ ASSERT (0 < an && an <= rn);
+ ASSERT (0 < bn && bn <= rn);
+
+ if (an >= bn)
+ refmpn_mul (rp, ap, an, bp, bn);
+ else
+ refmpn_mul (rp, bp, bn, ap, an);
+ an += bn;
+ if (an > rn) {
+ cy = mpn_add (rp, rp, rn, rp + rn, an - rn);
+ /* If cy == 1, then the value of rp is at most B^rn - 2, so there can
+ * be no overflow when adding in the carry. */
+ MPN_INCR_U (rp, rn, cy);
+ }
+}
+
+/*
+ Compare the result of the mpn_mulmod_bnm1 function in the library
+ with the reference function above.
+*/
+
+int
+main (int argc, char **argv)
+{
+ mp_ptr ap, bp, refp, pp, scratch;
+ int count = COUNT;
+ int test;
+ gmp_randstate_ptr rands;
+ TMP_DECL;
+ TMP_MARK;
+
+ TESTS_REPS (count, argv, argc);
+
+ tests_start ();
+ rands = RANDS;
+
+ ASSERT_ALWAYS (mpn_mulmod_bnm1_next_size (MAX_N) == MAX_N);
+
+ ap = TMP_ALLOC_LIMBS (MAX_N);
+ bp = TMP_ALLOC_LIMBS (MAX_N);
+ refp = TMP_ALLOC_LIMBS (MAX_N * 4);
+ pp = 1+TMP_ALLOC_LIMBS (MAX_N + 2);
+ scratch
+ = 1+TMP_ALLOC_LIMBS (mpn_mulmod_bnm1_itch (MAX_N, MAX_N, MAX_N) + 2);
+
+ for (test = 0; test < count; test++)
+ {
+ unsigned size_min;
+ unsigned size_range;
+ mp_size_t an,bn,rn,n;
+ mp_size_t itch;
+ mp_limb_t p_before, p_after, s_before, s_after;
+
+ for (size_min = 1; (1L << size_min) < MIN_N; size_min++)
+ ;
+
+ /* We generate an in the MIN_N <= n <= (1 << size_range). */
+ size_range = size_min
+ + gmp_urandomm_ui (rands, SIZE_LOG + 1 - size_min);
+
+ n = MIN_N
+ + gmp_urandomm_ui (rands, (1L << size_range) + 1 - MIN_N);
+ n = mpn_mulmod_bnm1_next_size (n);
+
+ if ( (test & 1) || n == 1) {
+ /* Half of the tests are done with the main scenario in mind:
+ both an and bn >= rn/2 */
+ an = ((n+1) >> 1) + gmp_urandomm_ui (rands, (n+1) >> 1);
+ bn = ((n+1) >> 1) + gmp_urandomm_ui (rands, (n+1) >> 1);
+ } else {
+ /* Second half of the tests are done using mulmod to compute a
+ full product with n/2 < an+bn <= n. */
+ an = 1 + gmp_urandomm_ui (rands, n - 1);
+ if (an >= n/2)
+ bn = 1 + gmp_urandomm_ui (rands, n - an);
+ else
+ bn = n/2 + 1 - an + gmp_urandomm_ui (rands, (n+1)/2);
+ }
+
+ /* Make sure an >= bn */
+ if (an < bn)
+ MP_SIZE_T_SWAP (an, bn);
+
+ mpn_random2 (ap, an);
+ mpn_random2 (bp, bn);
+
+ /* Sometime trigger the borderline conditions
+ A = -1,0,+1 or B = -1,0,+1 or A*B == -1,0,1 Mod(B^{n/2}+1).
+ This only makes sense if there is at least a split, i.e. n is even. */
+ if ((test & 0x1f) == 1 && (n & 1) == 0) {
+ mp_size_t x;
+ MPN_COPY (ap, ap + (n >> 1), an - (n >> 1));
+ MPN_ZERO (ap + an - (n >> 1) , n - an);
+ MPN_COPY (bp, bp + (n >> 1), bn - (n >> 1));
+ MPN_ZERO (bp + bn - (n >> 1) , n - bn);
+ x = 0;
+ /* x = (n == an) ? 0 : gmp_urandomm_ui (rands, n - an); */
+ ap[x] += gmp_urandomm_ui (rands, 3) - 1;
+ /* x = (n >> 1) - x % (n >> 1); */
+ bp[x] += gmp_urandomm_ui (rands, 3) - 1;
+ /* We don't propagate carry, this means that the desired condition
+ is not triggered all the times. A few times are enough anyway. */
+ }
+ rn = MIN(n, an + bn);
+ mpn_random2 (pp-1, rn + 2);
+ p_before = pp[-1];
+ p_after = pp[rn];
+
+ itch = mpn_mulmod_bnm1_itch (n, an, bn);
+ ASSERT_ALWAYS (itch <= mpn_mulmod_bnm1_itch (MAX_N, MAX_N, MAX_N));
+ mpn_random2 (scratch-1, itch+2);
+ s_before = scratch[-1];
+ s_after = scratch[itch];
+
+ mpn_mulmod_bnm1 ( pp, n, ap, an, bp, bn, scratch);
+ ref_mulmod_bnm1 (refp, n, ap, an, bp, bn);
+ if (pp[-1] != p_before || pp[rn] != p_after
+ || scratch[-1] != s_before || scratch[itch] != s_after
+ || mpn_cmp (refp, pp, rn) != 0)
+ {
+ printf ("ERROR in test %d, an = %d, bn = %d, n = %d\n",
+ test, (int) an, (int) bn, (int) n);
+ if (pp[-1] != p_before)
+ {
+ printf ("before pp:"); mpn_dump (pp -1, 1);
+ printf ("keep: "); mpn_dump (&p_before, 1);
+ }
+ if (pp[rn] != p_after)
+ {
+ printf ("after pp:"); mpn_dump (pp + rn, 1);
+ printf ("keep: "); mpn_dump (&p_after, 1);
+ }
+ if (scratch[-1] != s_before)
+ {
+ printf ("before scratch:"); mpn_dump (scratch-1, 1);
+ printf ("keep: "); mpn_dump (&s_before, 1);
+ }
+ if (scratch[itch] != s_after)
+ {
+ printf ("after scratch:"); mpn_dump (scratch + itch, 1);
+ printf ("keep: "); mpn_dump (&s_after, 1);
+ }
+ mpn_dump (ap, an);
+ mpn_dump (bp, bn);
+ mpn_dump (pp, rn);
+ mpn_dump (refp, rn);
+
+ abort();
+ }
+ }
+ TMP_FREE;
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-perfsqr.c b/vendor/gmp-6.3.0/tests/mpn/t-perfsqr.c
new file mode 100644
index 0000000..b65ee8b
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-perfsqr.c
@@ -0,0 +1,116 @@
+/* Test mpn_perfect_square_p data.
+
+Copyright 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#include "mpn/perfsqr.h"
+
+
+#define PERFSQR_MOD_MASK ((CNST_LIMB(1) << PERFSQR_MOD_BITS) - 1)
+
+void
+check_mod_2 (mp_limb_t d, mp_limb_t inv, mp_limb_t got_hi, mp_limb_t got_lo)
+{
+ int want[2*GMP_LIMB_BITS], got;
+ unsigned r, idx;
+ mp_limb_t q;
+
+ ASSERT_ALWAYS (d <= numberof (want));
+ ASSERT_ALWAYS (((inv * d) & PERFSQR_MOD_MASK) == 1);
+ ASSERT_ALWAYS (MP_LIMB_T_MAX / d >= PERFSQR_MOD_MASK);
+
+ /* the squares mod d */
+ for (r = 0; r < d; r++)
+ want[r] = 0;
+ for (r = 0; r < d; r++)
+ want[(r*r)%d] = 1;
+
+ /* for each remainder mod d, expect the table data to correctly identify
+ it as a residue or non-residue */
+ for (r = 0; r < d; r++)
+ {
+ /* as per PERFSQR_MOD_IDX */
+ q = ((r) * (inv)) & PERFSQR_MOD_MASK;
+ idx = (q * (d)) >> PERFSQR_MOD_BITS;
+
+ if (idx >= GMP_LIMB_BITS)
+ got = (got_hi >> (idx - GMP_LIMB_BITS)) & 1;
+ else
+ got = (got_lo >> idx) & 1;
+
+ if (got != want[r])
+ {
+ printf ("Wrong generated data\n");
+ printf (" d=%u\n", (unsigned) d);
+ printf (" r=%u\n", r);
+ printf (" idx=%u\n", idx);
+ printf (" got %d\n", got);
+ printf (" want %d\n", want[r]);
+ abort ();
+ }
+ }
+}
+
+/* Check the generated data in perfsqr.h. */
+void
+check_mod (void)
+{
+#define PERFSQR_MOD_34(r, up, usize) { r = 0; } /* so r isn't unused */
+#define PERFSQR_MOD_PP(r, up, usize) { r = 0; }
+#define PERFSQR_MOD_1(r, d, inv, mask) check_mod_2 (d, inv, CNST_LIMB(0), mask)
+#define PERFSQR_MOD_2(r, d, inv, mhi, mlo) check_mod_2 (d, inv, mhi, mlo)
+
+ PERFSQR_MOD_TEST (dummy, dummy);
+}
+
+/* Check PERFSQR_PP, if in use. */
+void
+check_pp (void)
+{
+#ifdef PERFSQR_PP
+ ASSERT_ALWAYS_LIMB (PERFSQR_PP);
+ ASSERT_ALWAYS_LIMB (PERFSQR_PP_NORM);
+ ASSERT_ALWAYS_LIMB (PERFSQR_PP_INVERTED);
+
+ /* preinv stuff only for nails==0 */
+ if (GMP_NAIL_BITS == 0)
+ {
+ ASSERT_ALWAYS (PERFSQR_PP_NORM
+ == PERFSQR_PP << refmpn_count_leading_zeros (PERFSQR_PP));
+ ASSERT_ALWAYS (PERFSQR_PP_INVERTED
+ == refmpn_invert_limb (PERFSQR_PP_NORM));
+ }
+#endif
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_mod ();
+ check_pp ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-scan.c b/vendor/gmp-6.3.0/tests/mpn/t-scan.c
new file mode 100644
index 0000000..ec25b95
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-scan.c
@@ -0,0 +1,144 @@
+/* Test mpn_scan0 and mpn_scan1.
+
+Copyright 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+
+#include "tests.h"
+
+
+#define SIZE ((mp_size_t) 3)
+mp_limb_t x[SIZE+1];
+
+void
+check (void)
+{
+ unsigned long i, got, want;
+
+ x[SIZE] = 1;
+ for (i = 0; i < SIZE*GMP_NUMB_BITS; i++)
+ {
+ got = refmpn_scan1 (x, i);
+ want = mpn_scan1 (x, i);
+ if (got != want)
+ {
+ printf ("mpn_scan1\n");
+ printf (" i %lu\n", i);
+ printf (" got %lu\n", got);
+ printf (" want %lu\n", want);
+ mpn_trace (" x ", x, SIZE);
+ abort ();
+ }
+ }
+
+ x[SIZE] = 0;
+ for (i = 0; i < SIZE*GMP_NUMB_BITS; i++)
+ {
+ got = refmpn_scan0 (x, i);
+ want = mpn_scan0 (x, i);
+ if (got != want)
+ {
+ printf ("mpn_scan0\n");
+ printf (" i %lu\n", i);
+ printf (" got %lu\n", got);
+ printf (" want %lu\n", want);
+ mpn_trace (" x ", x, SIZE);
+ abort ();
+ }
+ }
+}
+
+void
+check_twobits (void)
+{
+#define TWOBITS(a, b) \
+ ((CNST_LIMB(1) << (a)) | (CNST_LIMB(1) << (b)))
+
+ refmpn_zero (x, SIZE);
+ x[0] = TWOBITS (1, 0);
+ check ();
+
+ refmpn_zero (x, SIZE);
+ x[0] = TWOBITS (GMP_NUMB_BITS-1, 1);
+ check ();
+
+ refmpn_zero (x, SIZE);
+ x[0] = CNST_LIMB(1);
+ x[1] = CNST_LIMB(1);
+ check ();
+
+ refmpn_zero (x, SIZE);
+ x[0] = CNST_LIMB(1) << (GMP_NUMB_BITS-1);
+ x[1] = CNST_LIMB(1);
+ check ();
+
+ refmpn_zero (x, SIZE);
+ x[1] = TWOBITS (1, 0);
+ check ();
+
+ refmpn_zero (x, SIZE);
+ x[1] = CNST_LIMB(1);
+ x[2] = CNST_LIMB(1);
+ check ();
+}
+
+/* This is unused, it takes too long, especially on 64-bit systems. */
+void
+check_twobits_exhaustive (void)
+{
+ unsigned long i, j;
+
+ for (i = 0; i < GMP_NUMB_BITS * SIZE; i++)
+ {
+ for (j = 0; j < GMP_NUMB_BITS * SIZE; j++)
+ {
+ refmpn_zero (x, SIZE);
+ refmpn_setbit (x, i);
+ refmpn_setbit (x, j);
+ check ();
+ }
+ }
+}
+
+void
+check_rand (void)
+{
+ int i;
+
+ for (i = 0; i < 100; i++)
+ {
+ refmpn_random2 (x, SIZE);
+ check ();
+ }
+}
+
+int
+main (void)
+{
+ mp_trace_base = -16;
+ tests_start ();
+
+ check_twobits ();
+ check_rand ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-sizeinbase.c b/vendor/gmp-6.3.0/tests/mpn/t-sizeinbase.c
new file mode 100644
index 0000000..f34714a
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-sizeinbase.c
@@ -0,0 +1,98 @@
+/* Test for sizeinbase function.
+
+Copyright 2014 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+/* Exponents up to 2^SIZE_LOG */
+#ifndef SIZE_LOG
+#define SIZE_LOG 13
+#endif
+
+#ifndef COUNT
+#define COUNT 30
+#endif
+
+#define MAX_N (1<<SIZE_LOG)
+
+int
+main (int argc, char **argv)
+{
+ mp_limb_t a;
+ mp_ptr pp, scratch;
+ mp_limb_t max_b;
+ int count = COUNT;
+ int test;
+ gmp_randstate_ptr rands;
+ TMP_DECL;
+
+ TESTS_REPS (count, argv, argc);
+
+ tests_start ();
+ TMP_MARK;
+ rands = RANDS;
+
+ pp = TMP_ALLOC_LIMBS (MAX_N);
+ scratch = TMP_ALLOC_LIMBS (MAX_N);
+ max_b = numberof (mp_bases);
+
+ ASSERT_ALWAYS (max_b > 62);
+ ASSERT_ALWAYS (max_b < GMP_NUMB_MAX);
+
+ for (a = 2; a < max_b; ++a)
+ for (test = 0; test < count; ++test)
+ {
+ mp_size_t pn;
+ mp_limb_t exp;
+ mp_bitcnt_t res;
+
+ exp = gmp_urandomm_ui (rands, MAX_N);
+
+ pn = mpn_pow_1 (pp, &a, 1, exp, scratch);
+
+ res = mpn_sizeinbase (pp, pn, a) - 1;
+
+ if ((res < exp) || (res > exp + 1))
+ {
+ printf ("ERROR in test %d, base = %d, exp = %d, res = %d\n",
+ test, (int) a, (int) exp, (int) res);
+ abort();
+ }
+
+ mpn_sub_1 (pp, pp, pn, CNST_LIMB(1));
+ pn -= pp[pn-1] == 0;
+
+ res = mpn_sizeinbase (pp, pn, a);
+
+ if ((res < exp) || (res - 1 > exp))
+ {
+ printf ("ERROR in -1 test %d, base = %d, exp = %d, res = %d\n",
+ test, (int) a, (int) exp, (int) res);
+ abort();
+ }
+ }
+
+ TMP_FREE;
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-sqrlo.c b/vendor/gmp-6.3.0/tests/mpn/t-sqrlo.c
new file mode 100644
index 0000000..e9ab1e0
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-sqrlo.c
@@ -0,0 +1,129 @@
+/* Test for sqrlo function.
+
+Copyright 2009, 2015 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+/* Sizes are up to 2^SIZE_LOG limbs */
+#ifndef SIZE_LOG
+#define SIZE_LOG 10
+#endif
+
+#ifndef COUNT
+#define COUNT 10000
+#endif
+
+#define MAX_N (1L << SIZE_LOG)
+#define MIN_N (1)
+
+int
+main (int argc, char **argv)
+{
+ mp_ptr ap, refp, pp, scratch;
+ int count = COUNT;
+ int test;
+ gmp_randstate_ptr rands;
+ TMP_DECL;
+ TMP_MARK;
+
+ TESTS_REPS (count, argv, argc);
+
+ tests_start ();
+ rands = RANDS;
+
+#define mpn_sqrlo_itch(n) (0)
+
+ ap = TMP_ALLOC_LIMBS (MAX_N);
+ refp = TMP_ALLOC_LIMBS (MAX_N * 2);
+ pp = 1+TMP_ALLOC_LIMBS (MAX_N + 2);
+ scratch
+ = 1+TMP_ALLOC_LIMBS (mpn_sqrlo_itch (MAX_N) + 2);
+
+ for (test = 0; test < count; test++)
+ {
+ unsigned size_min;
+ unsigned size_range;
+ mp_size_t n;
+ mp_size_t itch;
+ mp_limb_t p_before, p_after, s_before, s_after;
+
+ for (size_min = 1; (1L << size_min) < MIN_N; size_min++)
+ ;
+
+ /* We generate an in the MIN_N <= n <= (1 << size_range). */
+ size_range = size_min
+ + gmp_urandomm_ui (rands, SIZE_LOG + 1 - size_min);
+
+ n = MIN_N
+ + gmp_urandomm_ui (rands, (1L << size_range) + 1 - MIN_N);
+
+ mpn_random2 (ap, n);
+ mpn_random2 (pp-1, n + 2);
+ p_before = pp[-1];
+ p_after = pp[n];
+
+ itch = mpn_sqrlo_itch (n);
+ ASSERT_ALWAYS (itch <= mpn_sqrlo_itch (MAX_N));
+ mpn_random2 (scratch-1, itch+2);
+ s_before = scratch[-1];
+ s_after = scratch[itch];
+
+ mpn_sqrlo (pp, ap, n);
+ mpn_sqr (refp, ap, n);
+ if (pp[-1] != p_before || pp[n] != p_after
+ || scratch[-1] != s_before || scratch[itch] != s_after
+ || mpn_cmp (refp, pp, n) != 0)
+ {
+ printf ("ERROR in test %d, n = %d",
+ test, (int) n);
+ if (pp[-1] != p_before)
+ {
+ printf ("before pp:"); mpn_dump (pp -1, 1);
+ printf ("keep: "); mpn_dump (&p_before, 1);
+ }
+ if (pp[n] != p_after)
+ {
+ printf ("after pp:"); mpn_dump (pp + n, 1);
+ printf ("keep: "); mpn_dump (&p_after, 1);
+ }
+ if (scratch[-1] != s_before)
+ {
+ printf ("before scratch:"); mpn_dump (scratch-1, 1);
+ printf ("keep: "); mpn_dump (&s_before, 1);
+ }
+ if (scratch[itch] != s_after)
+ {
+ printf ("after scratch:"); mpn_dump (scratch + itch, 1);
+ printf ("keep: "); mpn_dump (&s_after, 1);
+ }
+ mpn_dump (ap, n);
+ mpn_dump (pp, n);
+ mpn_dump (refp, n);
+
+ abort();
+ }
+ }
+ TMP_FREE;
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-sqrmod_bknp1.c b/vendor/gmp-6.3.0/tests/mpn/t-sqrmod_bknp1.c
new file mode 100644
index 0000000..1620925
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-sqrmod_bknp1.c
@@ -0,0 +1,251 @@
+/* Test for mulmod_bknp1 function.
+
+ Contributed to the GNU project by Marco Bodrato.
+
+Copyright 2009, 2020-2022 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+#if MOD_BKNP1_USE11
+#define USE11 11,
+#else
+#define USE11
+#endif
+
+#if GMP_NUMB_BITS % 32 == 0
+#define MAX_K 17
+#define SUPPORTED_K {3, 5, 7, 13, USE11 MAX_K}
+#else
+#if GMP_NUMB_BITS % 16 == 0
+#define MAX_K 13
+#define SUPPORTED_K {3, 5, 7, USE11 MAX_K}
+#else
+#if GMP_NUMB_BITS % 8 == 0
+#define MAX_K 7
+#define SUPPORTED_K {3, USE11 MAX_K}
+#else
+#define SUPPORTED_K {USE11} /* Supported ? */
+#endif /* GMP_NUMB_BITS % 8 == 0 */
+#endif /* GMP_NUMB_BITS % 16 == 0 */
+#endif /* GMP_NUMB_BITS % 32 == 0 */
+
+#if MOD_BKNP1_ONLY3
+#undef SUPPORTED_K
+#undef MAX_K
+#define MAX_K 3
+#define SUPPORTED_K {3}
+#endif
+
+/* Sizes are up to MAX_K * 2^SIZE_LOG limbs */
+#ifndef SIZE_LOG
+#define SIZE_LOG 7
+#endif
+
+#ifndef COUNT
+#define COUNT 5000
+#endif
+
+#define MAX_N (MAX_K << SIZE_LOG)
+#define MIN_N 1
+
+/*
+ Reference function for multiplication modulo B^{k*rn}+1.
+*/
+
+static void
+ref_sqrmod_bnp1 (mp_ptr rp, mp_srcptr ap, mp_size_t rn)
+{
+ mp_limb_t cy;
+
+ mpn_sqr (rp, ap, rn + 1);
+ cy = rp[2 * rn];
+ MPN_INCR_U (rp, 2 * rn + 1, rp[2 * rn]);
+ cy = rp[2 * rn] - cy + mpn_sub_n (rp, rp, rp + rn, rn);
+ rp[rn] = 0;
+ MPN_INCR_U (rp, rn + 1, cy);
+}
+
+/*
+ Compare the result of the mpn_mulmod_bnp1 function in the library
+ with the reference function above.
+*/
+unsigned supported_k[] = SUPPORTED_K;
+
+int
+main (int argc, char **argv)
+{
+ mp_ptr ap, refp, pp, scratch;
+ int count = COUNT;
+ int test;
+ gmp_randstate_ptr rands;
+ TMP_DECL;
+ TMP_MARK;
+
+ TESTS_REPS (count, argv, argc);
+
+ tests_start ();
+ rands = RANDS;
+
+ ap = TMP_ALLOC_LIMBS (MAX_N + 1);
+ refp = TMP_ALLOC_LIMBS (MAX_N * 2 + 2);
+ pp = 1 + TMP_ALLOC_LIMBS (MAX_N + 3);
+ scratch
+ = 1 + TMP_ALLOC_LIMBS (mpn_mulmod_bknp1_itch (MAX_N) + 2);
+
+ for (test = 0; test < count; test++)
+ {
+ unsigned size_min;
+ unsigned size_range;
+ unsigned k;
+ mp_size_t rn, n;
+ mp_size_t itch;
+ mp_limb_t p_before, p_after, s_before, s_after;
+
+ for (size_min = 1; (1L << size_min) < MIN_N; size_min++)
+ ;
+
+ /* We generate rn in the MIN_N <= n <= (1 << size_range). */
+ size_range = size_min
+ + gmp_urandomm_ui (rands, SIZE_LOG + 1 - size_min);
+
+ k = supported_k[test % numberof (supported_k)];
+ if (test < numberof (supported_k))
+ {
+ n = 1;
+ rn = k;
+ ap [rn] = 0;
+ mp_limb_t x = GMP_NUMB_MAX / k + 1;
+ ap [0] = x;
+ for (int i = 1; i < k; i += 2)
+ {
+ ap [i] = - x;
+ ap [i + 1] = x - 1;
+ }
+ }
+ else
+ {
+ n = MIN_N
+ + gmp_urandomm_ui (rands, (1L << size_range) + 1 - MIN_N);
+ rn = k * n;
+ if ((GMP_NUMB_MAX % k != 0) && (rn % 3 == 0))
+ n = rn / (k = 3);
+
+ mpn_random2 (ap, rn + 1);
+
+ ap [rn] &= 1;
+ }
+
+ mpn_random2 (pp-1, rn + 3);
+ p_before = pp[-1];
+ p_after = pp[rn + 1];
+
+ itch = mpn_sqrmod_bknp1_itch (rn);
+ ASSERT_ALWAYS (itch <= mpn_mulmod_bknp1_itch (MAX_N));
+ mpn_random2 (scratch - 1, itch + 2);
+ s_before = scratch[-1];
+ s_after = scratch[itch];
+
+ mpn_sqrmod_bknp1 ( pp, ap, n, k, scratch);
+ ref_sqrmod_bnp1 (refp, ap, rn);
+ if (pp[-1] != p_before || pp[rn + 1] != p_after
+ || scratch[-1] != s_before || scratch[itch] != s_after
+ || mpn_cmp (refp, pp, rn + 1) != 0)
+ {
+ printf ("ERROR in test %d(sqr), rn = %d, n = %d, k = %d\n",
+ test, (int) rn, (int) n, (int) k);
+ if (pp[-1] != p_before)
+ {
+ printf ("before pp:"); mpn_dump (pp - 1, 1);
+ printf ("keep: "); mpn_dump (&p_before, 1);
+ }
+ if (pp[rn + 1] != p_after)
+ {
+ printf ("after pp:"); mpn_dump (pp + rn + 1, 1);
+ printf ("keep: "); mpn_dump (&p_after, 1);
+ }
+ if (scratch[-1] != s_before)
+ {
+ printf ("before scratch:"); mpn_dump (scratch - 1, 1);
+ printf ("keep: "); mpn_dump (&s_before, 1);
+ }
+ if (scratch[itch] != s_after)
+ {
+ printf ("after scratch:"); mpn_dump (scratch + itch, 1);
+ printf ("keep: "); mpn_dump (&s_after, 1);
+ }
+ mpn_dump (ap, rn + 1);
+ mpn_dump (pp, rn + 1);
+ mpn_dump (refp, rn + 1);
+
+ abort();
+ }
+
+ mpn_random2 (pp-1, rn + 3);
+ p_before = pp[-1];
+ p_after = pp[rn + 1];
+
+ itch = mpn_mulmod_bknp1_itch (rn);
+ ASSERT_ALWAYS (itch <= mpn_mulmod_bknp1_itch (MAX_N));
+ mpn_random2 (scratch - 1, itch + 2);
+ s_before = scratch[-1];
+ s_after = scratch[itch];
+
+ mpn_mulmod_bknp1 ( pp, ap, ap, n, k, scratch);
+ if (pp[-1] != p_before || pp[rn + 1] != p_after
+ || scratch[-1] != s_before || scratch[itch] != s_after
+ || mpn_cmp (refp, pp, rn + 1) != 0)
+ {
+ printf ("ERROR in test %d(mul), rn = %d, n = %d, k = %d\n",
+ test, (int) rn, (int) n, (int) k);
+ if (pp[-1] != p_before)
+ {
+ printf ("before pp:"); mpn_dump (pp - 1, 1);
+ printf ("keep: "); mpn_dump (&p_before, 1);
+ }
+ if (pp[rn + 1] != p_after)
+ {
+ printf ("after pp:"); mpn_dump (pp + rn + 1, 1);
+ printf ("keep: "); mpn_dump (&p_after, 1);
+ }
+ if (scratch[-1] != s_before)
+ {
+ printf ("before scratch:"); mpn_dump (scratch - 1, 1);
+ printf ("keep: "); mpn_dump (&s_before, 1);
+ }
+ if (scratch[itch] != s_after)
+ {
+ printf ("after scratch:"); mpn_dump (scratch + itch, 1);
+ printf ("keep: "); mpn_dump (&s_after, 1);
+ }
+ mpn_dump (ap, rn + 1);
+ mpn_dump (pp, rn + 1);
+ mpn_dump (refp, rn + 1);
+
+ abort();
+ }
+ }
+ TMP_FREE;
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-sqrmod_bnm1.c b/vendor/gmp-6.3.0/tests/mpn/t-sqrmod_bnm1.c
new file mode 100644
index 0000000..27e5f38
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-sqrmod_bnm1.c
@@ -0,0 +1,182 @@
+/* Test for sqrmod_bnm1 function.
+
+ Contributed to the GNU project by Marco Bodrato.
+
+Copyright 2009, 2020 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+/* Sizes are up to 2^SIZE_LOG limbs */
+#ifndef SIZE_LOG
+#define SIZE_LOG 12
+#endif
+
+#ifndef COUNT
+#define COUNT 3000
+#endif
+
+#define MAX_N (1L << SIZE_LOG)
+#define MIN_N 1
+
+/*
+ Reference function for squaring modulo B^rn-1.
+
+ The result is expected to be ZERO if and only if one of the operand
+ already is. Otherwise the class [0] Mod(B^rn-1) is represented by
+ B^rn-1. This should not be a problem if sqrmod_bnm1 is used to
+ combine results and obtain a natural number when one knows in
+ advance that the final value is less than (B^rn-1).
+*/
+
+static void
+ref_sqrmod_bnm1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an)
+{
+ mp_limb_t cy;
+
+ ASSERT (0 < an && an <= rn);
+
+ refmpn_mul (rp, ap, an, ap, an);
+ an *= 2;
+ if (an > rn) {
+ cy = mpn_add (rp, rp, rn, rp + rn, an - rn);
+ /* If cy == 1, then the value of rp is at most B^rn - 2, so there can
+ * be no overflow when adding in the carry. */
+ MPN_INCR_U (rp, rn, cy);
+ }
+}
+
+/*
+ Compare the result of the mpn_sqrmod_bnm1 function in the library
+ with the reference function above.
+*/
+
+int
+main (int argc, char **argv)
+{
+ mp_ptr ap, refp, pp, scratch;
+ int count = COUNT;
+ int test;
+ gmp_randstate_ptr rands;
+ TMP_DECL;
+ TMP_MARK;
+
+ TESTS_REPS (count, argv, argc);
+
+ tests_start ();
+ rands = RANDS;
+
+ ASSERT_ALWAYS (mpn_sqrmod_bnm1_next_size (MAX_N) == MAX_N);
+
+ ap = TMP_ALLOC_LIMBS (MAX_N);
+ refp = TMP_ALLOC_LIMBS (MAX_N * 4);
+ pp = 1+TMP_ALLOC_LIMBS (MAX_N + 2);
+ scratch
+ = 1+TMP_ALLOC_LIMBS (mpn_sqrmod_bnm1_itch (MAX_N, MAX_N) + 2);
+
+ for (test = 0; test < count; test++)
+ {
+ unsigned size_min;
+ unsigned size_range;
+ mp_size_t an,rn,n;
+ mp_size_t itch;
+ mp_limb_t p_before, p_after, s_before, s_after;
+
+ for (size_min = 1; (1L << size_min) < MIN_N; size_min++)
+ ;
+
+ /* We generate an in the MIN_N <= n <= (1 << size_range). */
+ size_range = size_min
+ + gmp_urandomm_ui (rands, SIZE_LOG + 1 - size_min);
+
+ n = MIN_N
+ + gmp_urandomm_ui (rands, (1L << size_range) + 1 - MIN_N);
+ n = mpn_sqrmod_bnm1_next_size (n);
+
+ if (n == 1)
+ an = 1;
+ else
+ an = ((n+1) >> 1) + gmp_urandomm_ui (rands, (n+1) >> 1);
+
+ mpn_random2 (ap, an);
+
+ /* Sometime trigger the borderline conditions
+ A = -1,0,+1 Mod(B^{n/2}+1).
+ This only makes sense if there is at least a split, i.e. n is even. */
+ if ((test & 0x1f) == 1 && (n & 1) == 0) {
+ mp_size_t x;
+ MPN_COPY (ap, ap + (n >> 1), an - (n >> 1));
+ MPN_ZERO (ap + an - (n >> 1) , n - an);
+ x = 0;
+ /* x = (n == an) ? 0 : gmp_urandomm_ui (rands, n - an); */
+ ap[x] += gmp_urandomm_ui (rands, 3) - 1;
+ }
+ rn = MIN(n, 2*an);
+ mpn_random2 (pp-1, rn + 2);
+ p_before = pp[-1];
+ p_after = pp[rn];
+
+ itch = mpn_sqrmod_bnm1_itch (n, an);
+ ASSERT_ALWAYS (itch <= mpn_sqrmod_bnm1_itch (MAX_N, MAX_N));
+ mpn_random2 (scratch-1, itch+2);
+ s_before = scratch[-1];
+ s_after = scratch[itch];
+
+ mpn_sqrmod_bnm1 ( pp, n, ap, an, scratch);
+ ref_sqrmod_bnm1 (refp, n, ap, an);
+ if (pp[-1] != p_before || pp[rn] != p_after
+ || scratch[-1] != s_before || scratch[itch] != s_after
+ || mpn_cmp (refp, pp, rn) != 0)
+ {
+ printf ("ERROR in test %d, an = %d, n = %d\n",
+ test, (int) an, (int) n);
+ if (pp[-1] != p_before)
+ {
+ printf ("before pp:"); mpn_dump (pp -1, 1);
+ printf ("keep: "); mpn_dump (&p_before, 1);
+ }
+ if (pp[rn] != p_after)
+ {
+ printf ("after pp:"); mpn_dump (pp + rn, 1);
+ printf ("keep: "); mpn_dump (&p_after, 1);
+ }
+ if (scratch[-1] != s_before)
+ {
+ printf ("before scratch:"); mpn_dump (scratch-1, 1);
+ printf ("keep: "); mpn_dump (&s_before, 1);
+ }
+ if (scratch[itch] != s_after)
+ {
+ printf ("after scratch:"); mpn_dump (scratch + itch, 1);
+ printf ("keep: "); mpn_dump (&s_after, 1);
+ }
+ mpn_dump (ap, an);
+ mpn_dump (pp, rn);
+ mpn_dump (refp, rn);
+
+ abort();
+ }
+ }
+ TMP_FREE;
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-toom2-sqr.c b/vendor/gmp-6.3.0/tests/mpn/t-toom2-sqr.c
new file mode 100644
index 0000000..1b42850
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-toom2-sqr.c
@@ -0,0 +1,86 @@
+#define mpn_toomN_sqr mpn_toom2_sqr
+#define mpn_toomN_sqr_itch mpn_toom2_sqr_itch
+#define MIN_AN MPN_TOOM2_SQR_MINSIZE
+#define MAX_AN SQR_TOOM3_THRESHOLD
+
+#define MORE_SQR_TESTS explore_unlikely_branch
+#include "toom-sqr-shared.h"
+
+void
+explore_unlikely_branch (gmp_randstate_ptr rands)
+{
+ mp_ptr ap, refp, pp, scratch;
+ mp_size_t an;
+ mp_bitcnt_t bit;
+ TMP_DECL;
+ TMP_MARK;
+
+ ap = TMP_ALLOC_LIMBS (MAX_AN);
+ refp = TMP_ALLOC_LIMBS (MAX_AN * 2);
+ pp = 1 + TMP_ALLOC_LIMBS (MAX_AN * 2 + 2);
+ scratch
+ = 1+TMP_ALLOC_LIMBS (mpn_toomN_sqr_itch (MAX_AN) + 2);
+
+ for (an = MIN_AN + (MIN_AN & 1); an < MAX_AN; an+=2)
+ {
+ mp_size_t itch;
+ mp_limb_t p_before, p_after, s_before, s_after;
+
+ bit = an / 2 * GMP_NUMB_BITS
+ + gmp_urandomm_ui (rands, an / 2 * GMP_NUMB_BITS - 1);
+
+ mpn_zero (ap, an);
+ mpn_zero (pp, an * 2);
+ pp [an - 1] |= GMP_NUMB_HIGHBIT;
+ pp [bit / GMP_NUMB_BITS] |= CNST_LIMB (1) << (bit % GMP_NUMB_BITS);
+ mpn_sqrtrem (ap, NULL, pp, an);
+ /* We need {ap, an} such that {ap + an/2, an/2} is zero and
+ the result {pp, 2*an} is such that the sum
+ {pp, an/2} + {pp + an/2, an/2} gives a carry. */
+ mpn_random2 (pp-1, an * 2 + 2);
+ p_before = pp[-1];
+ p_after = pp[an * 2];
+
+ itch = mpn_toomN_sqr_itch (an);
+ ASSERT_ALWAYS (itch <= mpn_toomN_sqr_itch (MAX_AN));
+ mpn_random2 (scratch-1, itch+2);
+ s_before = scratch[-1];
+ s_after = scratch[itch];
+
+ mpn_toomN_sqr (pp, ap, an, scratch);
+ refmpn_mul (refp, ap, an, ap, an);
+ if (pp[-1] != p_before || pp[an * 2] != p_after
+ || scratch[-1] != s_before || scratch[itch] != s_after
+ || mpn_cmp (refp, pp, an * 2) != 0)
+ {
+ printf ("ERROR with bit %lu, an = %d\n",
+ (unsigned long) bit, (int) an);
+ if (pp[-1] != p_before)
+ {
+ printf ("before pp:"); mpn_dump (pp -1, 1);
+ printf ("keep: "); mpn_dump (&p_before, 1);
+ }
+ if (pp[an * 2] != p_after)
+ {
+ printf ("after pp:"); mpn_dump (pp + an * 2, 1);
+ printf ("keep: "); mpn_dump (&p_after, 1);
+ }
+ if (scratch[-1] != s_before)
+ {
+ printf ("before scratch:"); mpn_dump (scratch-1, 1);
+ printf ("keep: "); mpn_dump (&s_before, 1);
+ }
+ if (scratch[itch] != s_after)
+ {
+ printf ("after scratch:"); mpn_dump (scratch + itch, 1);
+ printf ("keep: "); mpn_dump (&s_after, 1);
+ }
+ mpn_dump (ap, an);
+ mpn_dump (pp, an * 2);
+ mpn_dump (refp, an * 2);
+
+ abort();
+ }
+ }
+ TMP_FREE;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-toom22.c b/vendor/gmp-6.3.0/tests/mpn/t-toom22.c
new file mode 100644
index 0000000..c9beed9
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-toom22.c
@@ -0,0 +1,10 @@
+#define mpn_toomMN_mul mpn_toom22_mul
+#define mpn_toomMN_mul_itch mpn_toom22_mul_itch
+#define MIN_AN MIN(MPN_TOOM22_MUL_MINSIZE,4)
+
+#define MIN_BN(an) \
+ ((an) >= 2*MUL_TOOM22_THRESHOLD \
+ ? (an) + 2 - MUL_TOOM22_THRESHOLD \
+ : ((an)+1)/2 + 1 + (an & 1))
+
+#include "toom-shared.h"
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-toom3-sqr.c b/vendor/gmp-6.3.0/tests/mpn/t-toom3-sqr.c
new file mode 100644
index 0000000..ccc3b99
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-toom3-sqr.c
@@ -0,0 +1,6 @@
+#define mpn_toomN_sqr mpn_toom3_sqr
+#define mpn_toomN_sqr_itch mpn_toom3_sqr_itch
+#define MIN_AN MAX(SQR_TOOM3_THRESHOLD,MPN_TOOM3_SQR_MINSIZE)
+#define MAX_AN SQR_TOOM4_THRESHOLD
+
+#include "toom-sqr-shared.h"
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-toom32.c b/vendor/gmp-6.3.0/tests/mpn/t-toom32.c
new file mode 100644
index 0000000..e42745d
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-toom32.c
@@ -0,0 +1,8 @@
+#define mpn_toomMN_mul mpn_toom32_mul
+#define mpn_toomMN_mul_itch mpn_toom32_mul_itch
+
+#define MIN_AN 6
+#define MIN_BN(an) (((an) + 8) / (size_t) 3)
+#define MAX_BN(an) ((an) - 2)
+
+#include "toom-shared.h"
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-toom33.c b/vendor/gmp-6.3.0/tests/mpn/t-toom33.c
new file mode 100644
index 0000000..7de82b2
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-toom33.c
@@ -0,0 +1,11 @@
+#define mpn_toomMN_mul mpn_toom33_mul
+#define mpn_toomMN_mul_itch mpn_toom33_mul_itch
+
+/* Smaller sizes not supported; may lead to recursive calls to
+ toom22_mul with invalid input size. */
+#define MIN_AN MUL_TOOM33_THRESHOLD
+#define MIN_BN(an) (1 + 2*(((an)+2)/(size_t) 3))
+
+#define COUNT 1000
+
+#include "toom-shared.h"
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-toom4-sqr.c b/vendor/gmp-6.3.0/tests/mpn/t-toom4-sqr.c
new file mode 100644
index 0000000..ca14ab1
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-toom4-sqr.c
@@ -0,0 +1,6 @@
+#define mpn_toomN_sqr mpn_toom4_sqr
+#define mpn_toomN_sqr_itch mpn_toom4_sqr_itch
+#define MIN_AN MAX(SQR_TOOM3_THRESHOLD,MAX(SQR_TOOM4_THRESHOLD,MPN_TOOM4_SQR_MINSIZE))
+#define MAX_AN SQR_TOOM6_THRESHOLD
+
+#include "toom-sqr-shared.h"
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-toom42.c b/vendor/gmp-6.3.0/tests/mpn/t-toom42.c
new file mode 100644
index 0000000..09a4a0c
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-toom42.c
@@ -0,0 +1,8 @@
+#define mpn_toomMN_mul mpn_toom42_mul
+#define mpn_toomMN_mul_itch mpn_toom42_mul_itch
+
+#define MIN_AN 10
+#define MIN_BN(an) (((an) + 7) >> 2)
+#define MAX_BN(an) ((2*(an)-5) / (size_t) 3)
+
+#include "toom-shared.h"
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-toom43.c b/vendor/gmp-6.3.0/tests/mpn/t-toom43.c
new file mode 100644
index 0000000..224a45b
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-toom43.c
@@ -0,0 +1,8 @@
+#define mpn_toomMN_mul mpn_toom43_mul
+#define mpn_toomMN_mul_itch mpn_toom43_mul_itch
+
+#define MIN_AN 25
+#define MIN_BN(an) (1 + 2*(((an)+3) >> 2))
+#define MAX_BN(an) ((an)-3)
+
+#include "toom-shared.h"
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-toom44.c b/vendor/gmp-6.3.0/tests/mpn/t-toom44.c
new file mode 100644
index 0000000..6c627e3
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-toom44.c
@@ -0,0 +1,11 @@
+#define mpn_toomMN_mul mpn_toom44_mul
+#define mpn_toomMN_mul_itch mpn_toom44_mul_itch
+
+/* Smaller sizes not supported; may lead to recursive calls to
+ toom22_mul or toom33_mul with invalid input size. */
+#define MIN_AN MUL_TOOM44_THRESHOLD
+#define MIN_BN(an) (1 + 3*(((an)+3)>>2))
+
+#define COUNT 1000
+
+#include "toom-shared.h"
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-toom52.c b/vendor/gmp-6.3.0/tests/mpn/t-toom52.c
new file mode 100644
index 0000000..d3fb134
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-toom52.c
@@ -0,0 +1,8 @@
+#define mpn_toomMN_mul mpn_toom52_mul
+#define mpn_toomMN_mul_itch mpn_toom52_mul_itch
+
+#define MIN_AN 32
+#define MIN_BN(an) (((an) + 9) / (size_t) 5)
+#define MAX_BN(an) (((an) - 3) >> 1)
+
+#include "toom-shared.h"
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-toom53.c b/vendor/gmp-6.3.0/tests/mpn/t-toom53.c
new file mode 100644
index 0000000..ddbf177
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-toom53.c
@@ -0,0 +1,8 @@
+#define mpn_toomMN_mul mpn_toom53_mul
+#define mpn_toomMN_mul_itch mpn_toom53_mul_itch
+
+#define MIN_AN 17
+#define MIN_BN(an) (1 + 2*(((an) + 4) / (size_t) 5))
+#define MAX_BN(an) ((3*(an) - 11) >> 2)
+
+#include "toom-shared.h"
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-toom54.c b/vendor/gmp-6.3.0/tests/mpn/t-toom54.c
new file mode 100644
index 0000000..52a2bee
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-toom54.c
@@ -0,0 +1,8 @@
+#define mpn_toomMN_mul mpn_toom54_mul
+#define mpn_toomMN_mul_itch mpn_toom54_mul_itch
+
+#define MIN_AN 31
+#define MIN_BN(an) ((3*(an) + 32) / (size_t) 5) /* 3/5 */
+#define MAX_BN(an) ((an) - 6) /* 1/1 */
+
+#include "toom-shared.h"
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-toom6-sqr.c b/vendor/gmp-6.3.0/tests/mpn/t-toom6-sqr.c
new file mode 100644
index 0000000..67d7a63
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-toom6-sqr.c
@@ -0,0 +1,8 @@
+#define mpn_toomN_sqr mpn_toom6_sqr
+#define mpn_toomN_sqr_itch mpn_toom6_sqr_itch
+#define MIN_AN MAX(SQR_TOOM3_THRESHOLD,MAX(SQR_TOOM4_THRESHOLD,MAX(SQR_TOOM6_THRESHOLD,MPN_TOOM6_SQR_MINSIZE)))
+#define MAX_AN SQR_TOOM8_THRESHOLD
+
+#define COUNT 250
+
+#include "toom-sqr-shared.h"
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-toom62.c b/vendor/gmp-6.3.0/tests/mpn/t-toom62.c
new file mode 100644
index 0000000..1cb2aab
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-toom62.c
@@ -0,0 +1,8 @@
+#define mpn_toomMN_mul mpn_toom62_mul
+#define mpn_toomMN_mul_itch mpn_toom62_mul_itch
+
+#define MIN_AN 31
+#define MIN_BN(an) (((an) + 11) / (size_t) 6)
+#define MAX_BN(an) ((2*(an) - 7) / (size_t) 5)
+
+#include "toom-shared.h"
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-toom63.c b/vendor/gmp-6.3.0/tests/mpn/t-toom63.c
new file mode 100644
index 0000000..d79165d
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-toom63.c
@@ -0,0 +1,8 @@
+#define mpn_toomMN_mul mpn_toom63_mul
+#define mpn_toomMN_mul_itch mpn_toom63_mul_itch
+
+#define MIN_AN 49
+#define MIN_BN(an) (2*(((an) + 23) / (size_t) 6)) /* 2/6 */
+#define MAX_BN(an) ((3*(an) - 23) / (size_t) 5) /* 3/5 */
+
+#include "toom-shared.h"
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-toom6h.c b/vendor/gmp-6.3.0/tests/mpn/t-toom6h.c
new file mode 100644
index 0000000..5cca9fc
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-toom6h.c
@@ -0,0 +1,13 @@
+#define mpn_toomMN_mul mpn_toom6h_mul
+#define mpn_toomMN_mul_itch mpn_toom6h_mul_itch
+
+#define SIZE_LOG 11
+
+/* Smaller sizes not supported; may lead to recursive calls to
+ toom22_mul, toom33_mul, or toom44_mul with invalid input size. */
+#define MIN_AN MUL_TOOM6H_MIN
+#define MIN_BN(an) (MAX ((an*3)>>3, 46))
+
+#define COUNT 1000
+
+#include "toom-shared.h"
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-toom8-sqr.c b/vendor/gmp-6.3.0/tests/mpn/t-toom8-sqr.c
new file mode 100644
index 0000000..0eee605
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-toom8-sqr.c
@@ -0,0 +1,8 @@
+#define mpn_toomN_sqr mpn_toom8_sqr
+#define mpn_toomN_sqr_itch mpn_toom8_sqr_itch
+#define MIN_AN MAX(SQR_TOOM3_THRESHOLD,MAX(SQR_TOOM4_THRESHOLD,MAX(SQR_TOOM6_THRESHOLD,MAX(SQR_TOOM8_THRESHOLD,MPN_TOOM8_SQR_MINSIZE))))
+#define MAX_AN SQR_FFT_THRESHOLD
+
+#define COUNT 250
+
+#include "toom-sqr-shared.h"
diff --git a/vendor/gmp-6.3.0/tests/mpn/t-toom8h.c b/vendor/gmp-6.3.0/tests/mpn/t-toom8h.c
new file mode 100644
index 0000000..b21344e
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/t-toom8h.c
@@ -0,0 +1,19 @@
+#define mpn_toomMN_mul mpn_toom8h_mul
+#define mpn_toomMN_mul_itch mpn_toom8h_mul_itch
+
+#define SIZE_LOG 11
+
+/* Smaller sizes not supported; may lead to recursive calls to
+ toom{22,33,44,6h}_mul with invalid input size. */
+#define MIN_AN MUL_TOOM8H_MIN
+
+#define MIN_BN(an) \
+(MAX(GMP_NUMB_BITS <= 9*3 ? (an*7)/ 9 : \
+ GMP_NUMB_BITS <= 10*3 ? (an*6)/10 : \
+ GMP_NUMB_BITS <= 11*3 ? (an*5)/11 : \
+ GMP_NUMB_BITS <= 12*3 ? (an*4)/12 : \
+ (an*4)/13, 86) )
+
+#define COUNT 1000
+
+#include "toom-shared.h"
diff --git a/vendor/gmp-6.3.0/tests/mpn/toom-shared.h b/vendor/gmp-6.3.0/tests/mpn/toom-shared.h
new file mode 100644
index 0000000..8188b00
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/toom-shared.h
@@ -0,0 +1,148 @@
+/* Test for various Toom functions.
+
+Copyright 2009 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+/* Main file is expected to define mpn_toomMN_mul,
+ * mpn_toomMN_mul_itch, MIN_AN, MIN_BN(an), MAX_BN(an) and then
+ * include this file. */
+
+/* Sizes are up to 2^SIZE_LOG limbs */
+#ifndef SIZE_LOG
+#define SIZE_LOG 10
+#endif
+
+#ifndef COUNT
+#define COUNT 2000
+#endif
+
+#define MAX_AN (1L << SIZE_LOG)
+
+#ifndef MAX_BN
+#define MAX_BN(an) (an)
+#endif
+
+/* For general toomMN_mul, we need
+ *
+ * MIN_BN(an) = N + floor(((N-1)*an + M - N)/M)
+ *
+ * MAX_BN(an) = floor(N*(an-1)/(M-1)) - N + 1
+ */
+
+int
+main (int argc, char **argv)
+{
+ mp_ptr ap, bp, refp, pp, scratch;
+ int count = COUNT;
+ int test;
+ gmp_randstate_ptr rands;
+ TMP_DECL;
+ TMP_MARK;
+
+ TESTS_REPS (count, argv, argc);
+
+ tests_start ();
+ rands = RANDS;
+
+ ap = TMP_ALLOC_LIMBS (MAX_AN);
+ bp = TMP_ALLOC_LIMBS (MAX_BN(MAX_AN));
+ refp = TMP_ALLOC_LIMBS (MAX_AN + MAX_BN(MAX_AN));
+ pp = 1+TMP_ALLOC_LIMBS (MAX_AN + MAX_BN(MAX_AN)+2);
+ scratch
+ = 1+TMP_ALLOC_LIMBS (mpn_toomMN_mul_itch (MAX_AN, MAX_BN(MAX_AN))
+ + 2);
+
+ for (test = 0; test < count; test++)
+ {
+ unsigned size_min;
+ unsigned size_range;
+ mp_size_t an, bn;
+ mp_size_t itch;
+ mp_limb_t p_before, p_after, s_before, s_after;
+
+ for (size_min = 1; (1L << size_min) < MIN_AN; size_min++)
+ ;
+
+ /* We generate an in the MIN_AN <= an <= (1 << size_range). */
+ size_range = size_min
+ + gmp_urandomm_ui (rands, SIZE_LOG + 1 - size_min);
+
+ an = MIN_AN
+ + gmp_urandomm_ui (rands, (1L << size_range) + 1 - MIN_AN);
+ bn = MIN_BN(an)
+ + gmp_urandomm_ui (rands, MAX_BN(an) + 1 - MIN_BN(an));
+
+ mpn_random2 (ap, an);
+ mpn_random2 (bp, bn);
+ mpn_random2 (pp-1, an + bn + 2);
+ p_before = pp[-1];
+ p_after = pp[an + bn];
+
+ itch = mpn_toomMN_mul_itch (an, bn);
+ ASSERT_ALWAYS (itch <= mpn_toomMN_mul_itch (MAX_AN, MAX_BN(MAX_AN)));
+ mpn_random2 (scratch-1, itch+2);
+ s_before = scratch[-1];
+ s_after = scratch[itch];
+
+ mpn_toomMN_mul (pp, ap, an, bp, bn, scratch);
+ refmpn_mul (refp, ap, an, bp, bn);
+ if (pp[-1] != p_before || pp[an + bn] != p_after
+ || scratch[-1] != s_before || scratch[itch] != s_after
+ || mpn_cmp (refp, pp, an + bn) != 0)
+ {
+ printf ("ERROR in test %d, an = %d, bn = %d\n",
+ test, (int) an, (int) bn);
+ if (pp[-1] != p_before)
+ {
+ printf ("before pp:"); mpn_dump (pp -1, 1);
+ printf ("keep: "); mpn_dump (&p_before, 1);
+ }
+ if (pp[an + bn] != p_after)
+ {
+ printf ("after pp:"); mpn_dump (pp + an + bn, 1);
+ printf ("keep: "); mpn_dump (&p_after, 1);
+ }
+ if (scratch[-1] != s_before)
+ {
+ printf ("before scratch:"); mpn_dump (scratch-1, 1);
+ printf ("keep: "); mpn_dump (&s_before, 1);
+ }
+ if (scratch[itch] != s_after)
+ {
+ printf ("after scratch:"); mpn_dump (scratch + itch, 1);
+ printf ("keep: "); mpn_dump (&s_after, 1);
+ }
+ mpn_dump (ap, an);
+ mpn_dump (bp, bn);
+ mpn_dump (pp, an + bn);
+ mpn_dump (refp, an + bn);
+
+ abort();
+ }
+ }
+ TMP_FREE;
+
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpn/toom-sqr-shared.h b/vendor/gmp-6.3.0/tests/mpn/toom-sqr-shared.h
new file mode 100644
index 0000000..8bab8e1
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpn/toom-sqr-shared.h
@@ -0,0 +1,125 @@
+/* Test for various Toom squaring functions.
+
+Copyright 2009, 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+/* Main file is expected to define mpn_toomN_mul, mpn_toomN_sqr_itch,
+ * MIN_AN, MAX_AN and then include this file. */
+
+#ifndef COUNT
+#define COUNT 2000
+#endif
+
+#ifdef MORE_SQR_TESTS
+void MORE_SQR_TESTS (gmp_randstate_ptr);
+#endif
+
+int
+main (int argc, char **argv)
+{
+ mp_ptr ap, refp, pp, scratch;
+ int count = COUNT;
+ int test;
+ gmp_randstate_ptr rands;
+ TMP_DECL;
+ TMP_MARK;
+
+ TESTS_REPS (count, argv, argc);
+
+ tests_start ();
+
+ if (MAX_AN > MIN_AN) {
+ rands = RANDS;
+
+ ap = TMP_ALLOC_LIMBS (MAX_AN);
+ refp = TMP_ALLOC_LIMBS (MAX_AN * 2);
+ pp = 1 + TMP_ALLOC_LIMBS (MAX_AN * 2 + 2);
+ scratch
+ = 1+TMP_ALLOC_LIMBS (mpn_toomN_sqr_itch (MAX_AN) + 2);
+
+ for (test = 0; test < count; test++)
+ {
+ mp_size_t an;
+ mp_size_t itch;
+ mp_limb_t p_before, p_after, s_before, s_after;
+
+ an = MIN_AN
+ + gmp_urandomm_ui (rands, MAX_AN - MIN_AN);
+
+ mpn_random2 (ap, an);
+ mpn_random2 (pp-1, an * 2 + 2);
+ p_before = pp[-1];
+ p_after = pp[an * 2];
+
+ itch = mpn_toomN_sqr_itch (an);
+ ASSERT_ALWAYS (itch <= mpn_toomN_sqr_itch (MAX_AN));
+ mpn_random2 (scratch-1, itch+2);
+ s_before = scratch[-1];
+ s_after = scratch[itch];
+
+ mpn_toomN_sqr (pp, ap, an, scratch);
+ refmpn_mul (refp, ap, an, ap, an);
+ if (pp[-1] != p_before || pp[an * 2] != p_after
+ || scratch[-1] != s_before || scratch[itch] != s_after
+ || mpn_cmp (refp, pp, an * 2) != 0)
+ {
+ printf ("ERROR in test %d, an = %d\n",
+ test, (int) an);
+ if (pp[-1] != p_before)
+ {
+ printf ("before pp:"); mpn_dump (pp -1, 1);
+ printf ("keep: "); mpn_dump (&p_before, 1);
+ }
+ if (pp[an * 2] != p_after)
+ {
+ printf ("after pp:"); mpn_dump (pp + an * 2, 1);
+ printf ("keep: "); mpn_dump (&p_after, 1);
+ }
+ if (scratch[-1] != s_before)
+ {
+ printf ("before scratch:"); mpn_dump (scratch-1, 1);
+ printf ("keep: "); mpn_dump (&s_before, 1);
+ }
+ if (scratch[itch] != s_after)
+ {
+ printf ("after scratch:"); mpn_dump (scratch + itch, 1);
+ printf ("keep: "); mpn_dump (&s_after, 1);
+ }
+ mpn_dump (ap, an);
+ mpn_dump (pp, an * 2);
+ mpn_dump (refp, an * 2);
+
+ abort();
+ }
+ }
+ TMP_FREE;
+
+#ifdef MORE_SQR_TESTS
+ MORE_SQR_TESTS (rands);
+#endif
+ }
+
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/Makefile.am b/vendor/gmp-6.3.0/tests/mpq/Makefile.am
new file mode 100644
index 0000000..e12e60c
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/Makefile.am
@@ -0,0 +1,35 @@
+## Process this file with automake to generate Makefile.in
+
+# Copyright 1996, 1999-2002, 2012, 2015 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+
+
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
+AM_LDFLAGS = -no-install
+LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
+
+check_PROGRAMS = t-aors t-cmp t-cmp_ui t-cmp_si t-equal t-get_d t-get_str \
+ t-inp_str t-inv t-md_2exp t-set_f t-set_str io reuse t-cmp_z
+TESTS = $(check_PROGRAMS)
+
+# Temporary files used by the tests. Removed automatically if the tests
+# pass, but ensure they're cleaned if they fail.
+#
+CLEANFILES = *.tmp
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
diff --git a/vendor/gmp-6.3.0/tests/mpq/Makefile.in b/vendor/gmp-6.3.0/tests/mpq/Makefile.in
new file mode 100644
index 0000000..d6279ab
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/Makefile.in
@@ -0,0 +1,1241 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 1996, 1999-2002, 2012, 2015 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+check_PROGRAMS = t-aors$(EXEEXT) t-cmp$(EXEEXT) t-cmp_ui$(EXEEXT) \
+ t-cmp_si$(EXEEXT) t-equal$(EXEEXT) t-get_d$(EXEEXT) \
+ t-get_str$(EXEEXT) t-inp_str$(EXEEXT) t-inv$(EXEEXT) \
+ t-md_2exp$(EXEEXT) t-set_f$(EXEEXT) t-set_str$(EXEEXT) \
+ io$(EXEEXT) reuse$(EXEEXT) t-cmp_z$(EXEEXT)
+subdir = tests/mpq
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+io_SOURCES = io.c
+io_OBJECTS = io.$(OBJEXT)
+io_LDADD = $(LDADD)
+io_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+reuse_SOURCES = reuse.c
+reuse_OBJECTS = reuse.$(OBJEXT)
+reuse_LDADD = $(LDADD)
+reuse_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_aors_SOURCES = t-aors.c
+t_aors_OBJECTS = t-aors.$(OBJEXT)
+t_aors_LDADD = $(LDADD)
+t_aors_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_cmp_SOURCES = t-cmp.c
+t_cmp_OBJECTS = t-cmp.$(OBJEXT)
+t_cmp_LDADD = $(LDADD)
+t_cmp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_cmp_si_SOURCES = t-cmp_si.c
+t_cmp_si_OBJECTS = t-cmp_si.$(OBJEXT)
+t_cmp_si_LDADD = $(LDADD)
+t_cmp_si_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_cmp_ui_SOURCES = t-cmp_ui.c
+t_cmp_ui_OBJECTS = t-cmp_ui.$(OBJEXT)
+t_cmp_ui_LDADD = $(LDADD)
+t_cmp_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_cmp_z_SOURCES = t-cmp_z.c
+t_cmp_z_OBJECTS = t-cmp_z.$(OBJEXT)
+t_cmp_z_LDADD = $(LDADD)
+t_cmp_z_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_equal_SOURCES = t-equal.c
+t_equal_OBJECTS = t-equal.$(OBJEXT)
+t_equal_LDADD = $(LDADD)
+t_equal_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_get_d_SOURCES = t-get_d.c
+t_get_d_OBJECTS = t-get_d.$(OBJEXT)
+t_get_d_LDADD = $(LDADD)
+t_get_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_get_str_SOURCES = t-get_str.c
+t_get_str_OBJECTS = t-get_str.$(OBJEXT)
+t_get_str_LDADD = $(LDADD)
+t_get_str_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_inp_str_SOURCES = t-inp_str.c
+t_inp_str_OBJECTS = t-inp_str.$(OBJEXT)
+t_inp_str_LDADD = $(LDADD)
+t_inp_str_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_inv_SOURCES = t-inv.c
+t_inv_OBJECTS = t-inv.$(OBJEXT)
+t_inv_LDADD = $(LDADD)
+t_inv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_md_2exp_SOURCES = t-md_2exp.c
+t_md_2exp_OBJECTS = t-md_2exp.$(OBJEXT)
+t_md_2exp_LDADD = $(LDADD)
+t_md_2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_set_f_SOURCES = t-set_f.c
+t_set_f_OBJECTS = t-set_f.$(OBJEXT)
+t_set_f_LDADD = $(LDADD)
+t_set_f_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_set_str_SOURCES = t-set_str.c
+t_set_str_OBJECTS = t-set_str.$(OBJEXT)
+t_set_str_LDADD = $(LDADD)
+t_set_str_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = io.c reuse.c t-aors.c t-cmp.c t-cmp_si.c t-cmp_ui.c \
+ t-cmp_z.c t-equal.c t-get_d.c t-get_str.c t-inp_str.c t-inv.c \
+ t-md_2exp.c t-set_f.c t-set_str.c
+DIST_SOURCES = io.c reuse.c t-aors.c t-cmp.c t-cmp_si.c t-cmp_ui.c \
+ t-cmp_z.c t-equal.c t-get_d.c t-get_str.c t-inp_str.c t-inv.c \
+ t-md_2exp.c t-set_f.c t-set_str.c
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = { \
+ $(am__tty_colors_dummy); \
+ if test "X$(AM_COLOR_TESTS)" = Xno; then \
+ am__color_tests=no; \
+ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+ am__color_tests=yes; \
+ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+ am__color_tests=yes; \
+ fi; \
+ if test $$am__color_tests = yes; then \
+ red=''; \
+ grn=''; \
+ lgn=''; \
+ blu=''; \
+ mgn=''; \
+ brg=''; \
+ std=''; \
+ fi; \
+}
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__recheck_rx = ^[ ]*:recheck:[ ]*
+am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
+am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+ recheck = 1; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ { \
+ if ((getline line2 < ($$0 ".log")) < 0) \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+ { \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+ { \
+ break; \
+ } \
+ }; \
+ if (recheck) \
+ print $$0; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+ print "fatal: making $@: " msg | "cat >&2"; \
+ exit 1; \
+} \
+function rst_section(header) \
+{ \
+ print header; \
+ len = length(header); \
+ for (i = 1; i <= len; i = i + 1) \
+ printf "="; \
+ printf "\n\n"; \
+} \
+{ \
+ copy_in_global_log = 1; \
+ global_test_result = "RUN"; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".trs"); \
+ if (line ~ /$(am__global_test_result_rx)/) \
+ { \
+ sub("$(am__global_test_result_rx)", "", line); \
+ sub("[ ]*$$", "", line); \
+ global_test_result = line; \
+ } \
+ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+ copy_in_global_log = 0; \
+ }; \
+ if (copy_in_global_log) \
+ { \
+ rst_section(global_test_result ": " $$0); \
+ while ((rc = (getline line < ($$0 ".log"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".log"); \
+ print line; \
+ }; \
+ printf "\n"; \
+ }; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+ --color-tests "$$am__color_tests" \
+ --enable-hard-errors "$$am__enable_hard_errors" \
+ --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test. Creates the
+# directory for the log if needed. Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log. Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT. Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup); \
+$(am__vpath_adj_setup) $(am__vpath_adj) \
+$(am__tty_colors); \
+srcdir=$(srcdir); export srcdir; \
+case "$@" in \
+ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \
+ *) am__odir=.;; \
+esac; \
+test "x$$am__odir" = x"." || test -d "$$am__odir" \
+ || $(MKDIR_P) "$$am__odir" || exit $$?; \
+if test -f "./$$f"; then dir=./; \
+elif test -f "$$f"; then dir=; \
+else dir="$(srcdir)/"; fi; \
+tst=$$dir$$f; log='$@'; \
+if test -n '$(DISABLE_HARD_ERRORS)'; then \
+ am__enable_hard_errors=no; \
+else \
+ am__enable_hard_errors=yes; \
+fi; \
+case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
+ am__expect_failure=yes;; \
+ *) \
+ am__expect_failure=no;; \
+esac; \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed). The result is saved in the shell variable
+# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+ bases='$(TEST_LOGS)'; \
+ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+ bases=`echo $$bases`
+RECHECK_LOGS = $(TEST_LOGS)
+AM_RECURSIVE_TARGETS = check recheck
+TEST_SUITE_LOG = test-suite.log
+TEST_EXTENSIONS = @EXEEXT@ .test
+LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
+am__set_b = \
+ case '$@' in \
+ */*) \
+ case '$*' in \
+ */*) b='$*';; \
+ *) b=`echo '$@' | sed 's/\.log$$//'`; \
+ esac;; \
+ *) \
+ b='$*';; \
+ esac
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+ $(TEST_LOG_FLAGS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/test-driver
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ABI = @ABI@
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+ASMFLAGS = @ASMFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
+CC = @CC@
+CCAS = @CCAS@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPP_FOR_BUILD = @CPP_FOR_BUILD@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
+DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
+FGREP = @FGREP@
+GMP_LDFLAGS = @GMP_LDFLAGS@
+GMP_LIMB_BITS = @GMP_LIMB_BITS@
+GMP_NAIL_BITS = @GMP_NAIL_BITS@
+GREP = @GREP@
+HAVE_CLOCK_01 = @HAVE_CLOCK_01@
+HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@
+HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@
+HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@
+HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@
+HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@
+HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@
+HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
+HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
+HAVE_STACK_T_01 = @HAVE_STACK_T_01@
+HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBCURSES = @LIBCURSES@
+LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@
+LIBGMP_DLL = @LIBGMP_DLL@
+LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@
+LIBM = @LIBM@
+LIBM_FOR_BUILD = @LIBM_FOR_BUILD@
+LIBOBJS = @LIBOBJS@
+LIBREADLINE = @LIBREADLINE@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+M4 = @M4@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
+STRIP = @STRIP@
+TAL_OBJECT = @TAL_OBJECT@
+TUNE_LIBS = @TUNE_LIBS@
+TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U_FOR_BUILD = @U_FOR_BUILD@
+VERSION = @VERSION@
+WITH_READLINE_01 = @WITH_READLINE_01@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gmp_srclinks = @gmp_srclinks@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mpn_objects = @mpn_objects@
+mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
+AM_LDFLAGS = -no-install
+LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
+TESTS = $(check_PROGRAMS)
+
+# Temporary files used by the tests. Removed automatically if the tests
+# pass, but ensure they're cleaned if they fail.
+#
+CLEANFILES = *.tmp
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/mpq/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/mpq/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+io$(EXEEXT): $(io_OBJECTS) $(io_DEPENDENCIES) $(EXTRA_io_DEPENDENCIES)
+ @rm -f io$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(io_OBJECTS) $(io_LDADD) $(LIBS)
+
+reuse$(EXEEXT): $(reuse_OBJECTS) $(reuse_DEPENDENCIES) $(EXTRA_reuse_DEPENDENCIES)
+ @rm -f reuse$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(reuse_OBJECTS) $(reuse_LDADD) $(LIBS)
+
+t-aors$(EXEEXT): $(t_aors_OBJECTS) $(t_aors_DEPENDENCIES) $(EXTRA_t_aors_DEPENDENCIES)
+ @rm -f t-aors$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_aors_OBJECTS) $(t_aors_LDADD) $(LIBS)
+
+t-cmp$(EXEEXT): $(t_cmp_OBJECTS) $(t_cmp_DEPENDENCIES) $(EXTRA_t_cmp_DEPENDENCIES)
+ @rm -f t-cmp$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_cmp_OBJECTS) $(t_cmp_LDADD) $(LIBS)
+
+t-cmp_si$(EXEEXT): $(t_cmp_si_OBJECTS) $(t_cmp_si_DEPENDENCIES) $(EXTRA_t_cmp_si_DEPENDENCIES)
+ @rm -f t-cmp_si$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_cmp_si_OBJECTS) $(t_cmp_si_LDADD) $(LIBS)
+
+t-cmp_ui$(EXEEXT): $(t_cmp_ui_OBJECTS) $(t_cmp_ui_DEPENDENCIES) $(EXTRA_t_cmp_ui_DEPENDENCIES)
+ @rm -f t-cmp_ui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_cmp_ui_OBJECTS) $(t_cmp_ui_LDADD) $(LIBS)
+
+t-cmp_z$(EXEEXT): $(t_cmp_z_OBJECTS) $(t_cmp_z_DEPENDENCIES) $(EXTRA_t_cmp_z_DEPENDENCIES)
+ @rm -f t-cmp_z$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_cmp_z_OBJECTS) $(t_cmp_z_LDADD) $(LIBS)
+
+t-equal$(EXEEXT): $(t_equal_OBJECTS) $(t_equal_DEPENDENCIES) $(EXTRA_t_equal_DEPENDENCIES)
+ @rm -f t-equal$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_equal_OBJECTS) $(t_equal_LDADD) $(LIBS)
+
+t-get_d$(EXEEXT): $(t_get_d_OBJECTS) $(t_get_d_DEPENDENCIES) $(EXTRA_t_get_d_DEPENDENCIES)
+ @rm -f t-get_d$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_get_d_OBJECTS) $(t_get_d_LDADD) $(LIBS)
+
+t-get_str$(EXEEXT): $(t_get_str_OBJECTS) $(t_get_str_DEPENDENCIES) $(EXTRA_t_get_str_DEPENDENCIES)
+ @rm -f t-get_str$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_get_str_OBJECTS) $(t_get_str_LDADD) $(LIBS)
+
+t-inp_str$(EXEEXT): $(t_inp_str_OBJECTS) $(t_inp_str_DEPENDENCIES) $(EXTRA_t_inp_str_DEPENDENCIES)
+ @rm -f t-inp_str$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_inp_str_OBJECTS) $(t_inp_str_LDADD) $(LIBS)
+
+t-inv$(EXEEXT): $(t_inv_OBJECTS) $(t_inv_DEPENDENCIES) $(EXTRA_t_inv_DEPENDENCIES)
+ @rm -f t-inv$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_inv_OBJECTS) $(t_inv_LDADD) $(LIBS)
+
+t-md_2exp$(EXEEXT): $(t_md_2exp_OBJECTS) $(t_md_2exp_DEPENDENCIES) $(EXTRA_t_md_2exp_DEPENDENCIES)
+ @rm -f t-md_2exp$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_md_2exp_OBJECTS) $(t_md_2exp_LDADD) $(LIBS)
+
+t-set_f$(EXEEXT): $(t_set_f_OBJECTS) $(t_set_f_DEPENDENCIES) $(EXTRA_t_set_f_DEPENDENCIES)
+ @rm -f t-set_f$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_set_f_OBJECTS) $(t_set_f_LDADD) $(LIBS)
+
+t-set_str$(EXEEXT): $(t_set_str_OBJECTS) $(t_set_str_DEPENDENCIES) $(EXTRA_t_set_str_DEPENDENCIES)
+ @rm -f t-set_str$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_set_str_OBJECTS) $(t_set_str_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+.c.o:
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+ $(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+ rm -f $< $@
+ $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+ @:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+ @$(am__set_TESTS_bases); \
+ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+ redo_bases=`for i in $$bases; do \
+ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+ done`; \
+ if test -n "$$redo_bases"; then \
+ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+ if $(am__make_dryrun); then :; else \
+ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+ fi; \
+ fi; \
+ if test -n "$$am__remaking_logs"; then \
+ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+ "recursion detected" >&2; \
+ elif test -n "$$redo_logs"; then \
+ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+ fi; \
+ if $(am__make_dryrun); then :; else \
+ st=0; \
+ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+ for i in $$redo_bases; do \
+ test -f $$i.trs && test -r $$i.trs \
+ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+ test -f $$i.log && test -r $$i.log \
+ || { echo "$$errmsg $$i.log" >&2; st=1; }; \
+ done; \
+ test $$st -eq 0 || exit 1; \
+ fi
+ @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+ ws='[ ]'; \
+ results=`for b in $$bases; do echo $$b.trs; done`; \
+ test -n "$$results" || results=/dev/null; \
+ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
+ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \
+ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \
+ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \
+ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+ if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+ success=true; \
+ else \
+ success=false; \
+ fi; \
+ br='==================='; br=$$br$$br$$br$$br; \
+ result_count () \
+ { \
+ if test x"$$1" = x"--maybe-color"; then \
+ maybe_colorize=yes; \
+ elif test x"$$1" = x"--no-color"; then \
+ maybe_colorize=no; \
+ else \
+ echo "$@: invalid 'result_count' usage" >&2; exit 4; \
+ fi; \
+ shift; \
+ desc=$$1 count=$$2; \
+ if test $$maybe_colorize = yes && test $$count -gt 0; then \
+ color_start=$$3 color_end=$$std; \
+ else \
+ color_start= color_end=; \
+ fi; \
+ echo "$${color_start}# $$desc $$count$${color_end}"; \
+ }; \
+ create_testsuite_report () \
+ { \
+ result_count $$1 "TOTAL:" $$all "$$brg"; \
+ result_count $$1 "PASS: " $$pass "$$grn"; \
+ result_count $$1 "SKIP: " $$skip "$$blu"; \
+ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+ result_count $$1 "FAIL: " $$fail "$$red"; \
+ result_count $$1 "XPASS:" $$xpass "$$red"; \
+ result_count $$1 "ERROR:" $$error "$$mgn"; \
+ }; \
+ { \
+ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
+ $(am__rst_title); \
+ create_testsuite_report --no-color; \
+ echo; \
+ echo ".. contents:: :depth: 2"; \
+ echo; \
+ for b in $$bases; do echo $$b; done \
+ | $(am__create_global_log); \
+ } >$(TEST_SUITE_LOG).tmp || exit 1; \
+ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
+ if $$success; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
+ fi; \
+ echo "$${col}$$br$${std}"; \
+ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \
+ echo "$${col}$$br$${std}"; \
+ create_testsuite_report --maybe-color; \
+ echo "$$col$$br$$std"; \
+ if $$success; then :; else \
+ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \
+ if test -n "$(PACKAGE_BUGREPORT)"; then \
+ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+ fi; \
+ echo "$$col$$br$$std"; \
+ fi; \
+ $$success || exit 1
+
+check-TESTS:
+ @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
+ @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+ exit $$?;
+recheck: all $(check_PROGRAMS)
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ bases=`for i in $$bases; do echo $$i; done \
+ | $(am__list_recheck_tests)` || exit 1; \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ log_list=`echo $$log_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+ am__force_recheck=am--force-recheck \
+ TEST_LOGS="$$log_list"; \
+ exit $$?
+t-aors.log: t-aors$(EXEEXT)
+ @p='t-aors$(EXEEXT)'; \
+ b='t-aors'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-cmp.log: t-cmp$(EXEEXT)
+ @p='t-cmp$(EXEEXT)'; \
+ b='t-cmp'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-cmp_ui.log: t-cmp_ui$(EXEEXT)
+ @p='t-cmp_ui$(EXEEXT)'; \
+ b='t-cmp_ui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-cmp_si.log: t-cmp_si$(EXEEXT)
+ @p='t-cmp_si$(EXEEXT)'; \
+ b='t-cmp_si'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-equal.log: t-equal$(EXEEXT)
+ @p='t-equal$(EXEEXT)'; \
+ b='t-equal'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-get_d.log: t-get_d$(EXEEXT)
+ @p='t-get_d$(EXEEXT)'; \
+ b='t-get_d'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-get_str.log: t-get_str$(EXEEXT)
+ @p='t-get_str$(EXEEXT)'; \
+ b='t-get_str'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-inp_str.log: t-inp_str$(EXEEXT)
+ @p='t-inp_str$(EXEEXT)'; \
+ b='t-inp_str'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-inv.log: t-inv$(EXEEXT)
+ @p='t-inv$(EXEEXT)'; \
+ b='t-inv'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-md_2exp.log: t-md_2exp$(EXEEXT)
+ @p='t-md_2exp$(EXEEXT)'; \
+ b='t-md_2exp'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-set_f.log: t-set_f$(EXEEXT)
+ @p='t-set_f$(EXEEXT)'; \
+ b='t-set_f'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-set_str.log: t-set_str$(EXEEXT)
+ @p='t-set_str$(EXEEXT)'; \
+ b='t-set_str'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+io.log: io$(EXEEXT)
+ @p='io$(EXEEXT)'; \
+ b='io'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+reuse.log: reuse$(EXEEXT)
+ @p='reuse$(EXEEXT)'; \
+ b='reuse'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-cmp_z.log: t-cmp_z$(EXEEXT)
+ @p='t-cmp_z$(EXEEXT)'; \
+ b='t-cmp_z'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+.test.log:
+ @p='$<'; \
+ $(am__set_b); \
+ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+@am__EXEEXT_TRUE@.test$(EXEEXT).log:
+@am__EXEEXT_TRUE@ @p='$<'; \
+@am__EXEEXT_TRUE@ $(am__set_b); \
+@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
+@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+ -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+ -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+ -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
+ ctags ctags-am distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ recheck tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/vendor/gmp-6.3.0/tests/mpq/io.c b/vendor/gmp-6.3.0/tests/mpq/io.c
new file mode 100644
index 0000000..3336c6a
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/io.c
@@ -0,0 +1,136 @@
+/* Test conversion and I/O using mpq_out_str and mpq_inp_str.
+
+Copyright 1993, 1994, 1996, 2000, 2001, 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#if HAVE_UNISTD_H
+#include <unistd.h> /* for unlink */
+#endif
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#define FILENAME "io.tmp"
+
+void
+debug_mp (mpq_t x, int base)
+{
+ mpq_out_str (stdout, base, x); fputc ('\n', stdout);
+}
+
+int
+main (int argc, char **argv)
+{
+ mpq_t op1, op2;
+ mp_size_t size;
+ int i;
+ int reps = 10000;
+ FILE *fp;
+ int base;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+ size_t nread;
+
+ tests_start ();
+ rands = RANDS;
+
+ mpz_init (bs);
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpq_init (op1);
+ mpq_init (op2);
+
+ fp = fopen (FILENAME, "w+");
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 10 + 2;
+
+ mpz_urandomb (bs, rands, size_range);
+ size = mpz_get_ui (bs) + 2;
+ mpz_errandomb (mpq_numref(op1), rands, size);
+ mpz_errandomb_nonzero (mpq_denref(op1), rands, size);
+ mpq_canonicalize (op1);
+
+ mpz_urandomb (bs, rands, 1);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 1) != 0)
+ mpq_neg (op1, op1);
+
+ mpz_urandomb (bs, rands, 16);
+ bsi = mpz_get_ui (bs);
+ base = bsi % 36 + 1;
+ if (base == 1)
+ base = 0;
+
+ rewind (fp);
+ if (mpq_out_str (fp, base, op1) == 0
+ || putc (' ', fp) == EOF
+ || fflush (fp) != 0)
+ {
+ printf ("mpq_out_str write error\n");
+ abort ();
+ }
+
+ rewind (fp);
+ nread = mpq_inp_str (op2, fp, base);
+ if (nread == 0)
+ {
+ if (ferror (fp))
+ printf ("mpq_inp_str stream read error\n");
+ else
+ printf ("mpq_inp_str data conversion error\n");
+ abort ();
+ }
+
+ if (nread != ftell(fp))
+ {
+ printf ("mpq_inp_str nread doesn't match ftell\n");
+ printf (" nread %lu\n", (unsigned long) nread);
+ printf (" ftell %ld\n", ftell(fp));
+ abort ();
+ }
+
+ if (mpq_cmp (op1, op2))
+ {
+ printf ("ERROR\n");
+ printf ("op1 = "); debug_mp (op1, -16);
+ printf ("op2 = "); debug_mp (op2, -16);
+ printf ("base = %d\n", base);
+ abort ();
+ }
+ }
+
+ fclose (fp);
+
+ unlink (FILENAME);
+
+ mpz_clear (bs);
+ mpq_clear (op1);
+ mpq_clear (op2);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/reuse.c b/vendor/gmp-6.3.0/tests/mpq/reuse.c
new file mode 100644
index 0000000..b724ffc
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/reuse.c
@@ -0,0 +1,245 @@
+/* Test that routines allow reusing a source variable as destination.
+
+Copyright 1996, 2000-2002, 2012, 2015 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#if __GMP_LIBGMP_DLL
+
+/* FIXME: When linking to a DLL libgmp, mpq_add etc can't be used as
+ initializers for global variables because they're effectively global
+ variables (function pointers) themselves. Perhaps calling a test
+ function successively with mpq_add etc would be better. */
+
+int
+main (void)
+{
+ printf ("Test suppressed for windows DLL\n");
+ exit (0);
+}
+
+
+#else /* ! DLL_EXPORT */
+
+#ifndef SIZE
+#define SIZE 16
+#endif
+
+void dump_abort (const char *, mpq_t, mpq_t);
+
+typedef void (*dss_func) (mpq_ptr, mpq_srcptr, mpq_srcptr);
+
+dss_func dss_funcs[] =
+{
+ mpq_div, mpq_add, mpq_mul, mpq_sub,
+};
+
+const char *dss_func_names[] =
+{
+ "mpq_div", "mpq_add", "mpq_mul", "mpq_sub",
+};
+
+typedef void (*ds_func) (mpq_ptr, mpq_srcptr);
+
+ds_func ds_funcs[] =
+{
+ mpq_abs, mpq_neg,
+};
+
+const char *ds_func_names[] =
+{
+ "mpq_abs", "mpq_neg",
+};
+
+typedef void (*dsi_func) (mpq_ptr, mpq_srcptr, unsigned long int);
+
+dsi_func dsi_funcs[] =
+{
+ mpq_mul_2exp, mpq_div_2exp
+};
+
+const char *dsi_func_names[] =
+{
+ "mpq_mul_2exp", "mpq_div_2exp"
+};
+
+int
+main (int argc, char **argv)
+{
+ int i;
+ int pass, reps = 100;
+ mpq_t in1, in2, out1;
+ unsigned long int randbits, in2i;
+ mpq_t res1, res2;
+ gmp_randstate_ptr rands;
+
+ tests_start ();
+
+ TESTS_REPS (reps, argv, argc);
+
+ rands = RANDS;
+
+ mpq_init (in1);
+ mpq_init (in2);
+ mpq_init (out1);
+ mpq_init (res1);
+ mpq_init (res2);
+
+ for (pass = 1; pass <= reps; pass++)
+ {
+ randbits = urandom ();
+
+ if (randbits & 1)
+ {
+ mpq_clear (in1);
+ mpq_init (in1);
+ }
+ randbits >>= 1;
+ mpz_errandomb (mpq_numref(in1), rands, 512L);
+ mpz_errandomb_nonzero (mpq_denref(in1), rands, 512L);
+ if (randbits & 1)
+ mpz_neg (mpq_numref(in1),mpq_numref(in1));
+ randbits >>= 1;
+ mpq_canonicalize (in1);
+
+ if (randbits & 1)
+ {
+ mpq_clear (in2);
+ mpq_init (in2);
+ }
+ randbits >>= 1;
+ mpz_errandomb (mpq_numref(in2), rands, 512L);
+ mpz_errandomb_nonzero (mpq_denref(in2), rands, 512L);
+ if (randbits & 1)
+ mpz_neg (mpq_numref(in2),mpq_numref(in2));
+ randbits >>= 1;
+ mpq_canonicalize (in2);
+
+ for (i = 0; i < sizeof (dss_funcs) / sizeof (dss_func); i++)
+ {
+ /* Don't divide by 0. */
+ if (i == 0 && mpq_cmp_ui (in2, 0, 1) == 0)
+ continue;
+
+ if (randbits & 1)
+ {
+ mpq_clear (res1);
+ mpq_init (res1);
+ }
+ randbits >>= 1;
+
+ (dss_funcs[i]) (res1, in1, in2);
+ MPQ_CHECK_FORMAT(res1);
+
+ mpq_set (out1, in1);
+ (dss_funcs[i]) (out1, out1, in2);
+ MPQ_CHECK_FORMAT(out1);
+
+ if (mpq_cmp (res1, out1) != 0)
+ dump_abort (dss_func_names[i], res1, out1);
+
+ mpq_set (out1, in2);
+ (dss_funcs[i]) (out1, in1, out1);
+ MPQ_CHECK_FORMAT(out1);
+
+ if (mpq_cmp (res1, out1) != 0)
+ dump_abort (dss_func_names[i], res1, out1);
+
+ mpq_set (out1, in2);
+ (dss_funcs[i]) (res1, out1, in2);
+ MPQ_CHECK_FORMAT(res1);
+
+ (dss_funcs[i]) (res2, in2, in2);
+ MPQ_CHECK_FORMAT(res2);
+
+ (dss_funcs[i]) (out1, out1, out1);
+ MPQ_CHECK_FORMAT(out1);
+
+ if (mpq_cmp (res1, res2) != 0)
+ dump_abort (dss_func_names[i], res1, res2);
+ if (mpq_cmp (res1, out1) != 0)
+ dump_abort (dss_func_names[i], res1, out1);
+ }
+
+ for (i = 0; i < sizeof (ds_funcs) / sizeof (ds_func); i++)
+ {
+ if (randbits & 1)
+ {
+ mpq_clear (res1);
+ mpq_init (res1);
+ }
+ randbits >>= 1;
+ (ds_funcs[i]) (res1, in1);
+ MPQ_CHECK_FORMAT(res1);
+
+ mpq_set (out1, in1);
+ (ds_funcs[i]) (out1, out1);
+ MPQ_CHECK_FORMAT(out1);
+
+ if (mpq_cmp (res1, out1) != 0)
+ dump_abort (ds_func_names[i], res1, out1);
+ }
+
+ in2i = urandom () % 65536;
+ for (i = 0; i < sizeof (dsi_funcs) / sizeof (dsi_func); i++)
+ {
+ if (randbits & 1)
+ {
+ mpq_clear (res1);
+ mpq_init (res1);
+ }
+ randbits >>= 1;
+
+ (dsi_funcs[i]) (res1, in1, in2i);
+ MPQ_CHECK_FORMAT(res1);
+
+ mpq_set (out1, in1);
+ (dsi_funcs[i]) (out1, out1, in2i);
+ MPQ_CHECK_FORMAT(out1);
+
+ if (mpq_cmp (res1, out1) != 0)
+ dump_abort (dsi_func_names[i], res1, out1);
+ }
+
+ }
+
+ mpq_clear (in1);
+ mpq_clear (in2);
+ mpq_clear (out1);
+ mpq_clear (res1);
+ mpq_clear (res2);
+
+ tests_end ();
+ exit (0);
+}
+
+void
+dump_abort (const char *name, mpq_t res1, mpq_t res2)
+{
+ printf ("failure in %s:\n", name);
+ mpq_trace (" res1 ", res1);
+ mpq_trace (" res2 ", res2);
+ abort ();
+}
+
+#endif /* ! DLL_EXPORT */
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-aors.c b/vendor/gmp-6.3.0/tests/mpq/t-aors.c
new file mode 100644
index 0000000..8ee9f93
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-aors.c
@@ -0,0 +1,182 @@
+/* Test mpq_add and mpq_sub.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_all (mpq_ptr x, mpq_ptr y, mpq_ptr want_add, mpq_ptr want_sub)
+{
+ mpq_t got;
+ int neg_x, neg_y, swap;
+
+ mpq_init (got);
+
+ MPQ_CHECK_FORMAT (want_add);
+ MPQ_CHECK_FORMAT (want_sub);
+ MPQ_CHECK_FORMAT (x);
+ MPQ_CHECK_FORMAT (y);
+
+ for (swap = 0; swap <= 1; swap++)
+ {
+ for (neg_x = 0; neg_x <= 1; neg_x++)
+ {
+ for (neg_y = 0; neg_y <= 1; neg_y++)
+ {
+ mpq_add (got, x, y);
+ MPQ_CHECK_FORMAT (got);
+ if (! mpq_equal (got, want_add))
+ {
+ printf ("mpq_add wrong\n");
+ mpq_trace (" x ", x);
+ mpq_trace (" y ", y);
+ mpq_trace (" got ", got);
+ mpq_trace (" want", want_add);
+ abort ();
+ }
+
+ mpq_sub (got, x, y);
+ MPQ_CHECK_FORMAT (got);
+ if (! mpq_equal (got, want_sub))
+ {
+ printf ("mpq_sub wrong\n");
+ mpq_trace (" x ", x);
+ mpq_trace (" y ", y);
+ mpq_trace (" got ", got);
+ mpq_trace (" want", want_sub);
+ abort ();
+ }
+
+
+ mpq_neg (y, y);
+ mpq_swap (want_add, want_sub);
+ }
+
+ mpq_neg (x, x);
+ mpq_swap (want_add, want_sub);
+ mpq_neg (want_add, want_add);
+ mpq_neg (want_sub, want_sub);
+ }
+
+ mpq_swap (x, y);
+ mpq_neg (want_sub, want_sub);
+ }
+
+ mpq_clear (got);
+}
+
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *x;
+ const char *y;
+ const char *want_add;
+ const char *want_sub;
+
+ } data[] = {
+
+ { "0", "0", "0", "0" },
+ { "1", "0", "1", "1" },
+ { "1", "1", "2", "0" },
+
+ { "1/2", "1/2", "1", "0" },
+ { "5/6", "14/15", "53/30", "-1/10" },
+ };
+
+ mpq_t x, y, want_add, want_sub;
+ int i;
+
+ mpq_init (x);
+ mpq_init (y);
+ mpq_init (want_add);
+ mpq_init (want_sub);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpq_set_str_or_abort (x, data[i].x, 0);
+ mpq_set_str_or_abort (y, data[i].y, 0);
+ mpq_set_str_or_abort (want_add, data[i].want_add, 0);
+ mpq_set_str_or_abort (want_sub, data[i].want_sub, 0);
+
+ check_all (x, y, want_add, want_sub);
+ }
+
+ mpq_clear (x);
+ mpq_clear (y);
+ mpq_clear (want_add);
+ mpq_clear (want_sub);
+}
+
+
+void
+check_rand (void)
+{
+ mpq_t x, y, want_add, want_sub;
+ int i;
+ gmp_randstate_ptr rands = RANDS;
+
+ mpq_init (x);
+ mpq_init (y);
+ mpq_init (want_add);
+ mpq_init (want_sub);
+
+ for (i = 0; i < 500; i++)
+ {
+ mpz_errandomb (mpq_numref(x), rands, 512L);
+ mpz_errandomb_nonzero (mpq_denref(x), rands, 512L);
+ mpq_canonicalize (x);
+
+ mpz_errandomb (mpq_numref(y), rands, 512L);
+ mpz_errandomb_nonzero (mpq_denref(y), rands, 512L);
+ mpq_canonicalize (y);
+
+ refmpq_add (want_add, x, y);
+ refmpq_sub (want_sub, x, y);
+
+ check_all (x, y, want_add, want_sub);
+ }
+
+ mpq_clear (x);
+ mpq_clear (y);
+ mpq_clear (want_add);
+ mpq_clear (want_sub);
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_data ();
+ check_rand ();
+
+ tests_end ();
+
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-cmp.c b/vendor/gmp-6.3.0/tests/mpq/t-cmp.c
new file mode 100644
index 0000000..187db7f
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-cmp.c
@@ -0,0 +1,101 @@
+/* Test mpq_cmp.
+
+Copyright 1996, 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#define SGN(x) ((x) < 0 ? -1 : (x) > 0 ? 1 : 0)
+
+int
+ref_mpq_cmp (mpq_t a, mpq_t b)
+{
+ mpz_t ai, bi;
+ int cc;
+
+ mpz_init (ai);
+ mpz_init (bi);
+
+ mpz_mul (ai, NUM (a), DEN (b));
+ mpz_mul (bi, NUM (b), DEN (a));
+ cc = mpz_cmp (ai, bi);
+ mpz_clear (ai);
+ mpz_clear (bi);
+ return cc;
+}
+
+#ifndef SIZE
+#define SIZE 8 /* increasing this lowers the probability of finding an error */
+#endif
+
+int
+main (int argc, char **argv)
+{
+ mpq_t a, b;
+ mp_size_t size;
+ int reps = 10000;
+ int i;
+ int cc, ccref;
+
+ tests_start ();
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpq_init (a);
+ mpq_init (b);
+
+ for (i = 0; i < reps; i++)
+ {
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (NUM (a), size);
+ do
+ {
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (DEN (a), size);
+ }
+ while (mpz_cmp_ui (DEN (a), 0) == 0);
+
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (NUM (b), size);
+ do
+ {
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (DEN (b), size);
+ }
+ while (mpz_cmp_ui (DEN (b), 0) == 0);
+
+ mpq_canonicalize (a);
+ mpq_canonicalize (b);
+
+ ccref = ref_mpq_cmp (a, b);
+ cc = mpq_cmp (a, b);
+
+ if (SGN (ccref) != SGN (cc))
+ abort ();
+ }
+
+ mpq_clear (a);
+ mpq_clear (b);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-cmp_si.c b/vendor/gmp-6.3.0/tests/mpq/t-cmp_si.c
new file mode 100644
index 0000000..5ffa247
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-cmp_si.c
@@ -0,0 +1,117 @@
+/* Test mpq_cmp_si.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+#define SGN(x) ((x)<0 ? -1 : (x) != 0)
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *q;
+ long n;
+ unsigned long d;
+ int want;
+ } data[] = {
+ { "0", 0, 1, 0 },
+ { "0", 0, 123, 0 },
+ { "0", 0, ULONG_MAX, 0 },
+ { "1", 0, 1, 1 },
+ { "1", 0, 123, 1 },
+ { "1", 0, ULONG_MAX, 1 },
+ { "-1", 0, 1, -1 },
+ { "-1", 0, 123, -1 },
+ { "-1", 0, ULONG_MAX, -1 },
+
+ { "123", 123, 1, 0 },
+ { "124", 123, 1, 1 },
+ { "122", 123, 1, -1 },
+
+ { "-123", 123, 1, -1 },
+ { "-124", 123, 1, -1 },
+ { "-122", 123, 1, -1 },
+
+ { "123", -123, 1, 1 },
+ { "124", -123, 1, 1 },
+ { "122", -123, 1, 1 },
+
+ { "-123", -123, 1, 0 },
+ { "-124", -123, 1, -1 },
+ { "-122", -123, 1, 1 },
+
+ { "5/7", 3,4, -1 },
+ { "5/7", -3,4, 1 },
+ { "-5/7", 3,4, -1 },
+ { "-5/7", -3,4, 1 },
+ };
+
+ mpq_t q;
+ int i, got;
+
+ mpq_init (q);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpq_set_str_or_abort (q, data[i].q, 0);
+ MPQ_CHECK_FORMAT (q);
+
+ got = mpq_cmp_si (q, data[i].n, data[i].d);
+ if (SGN(got) != data[i].want)
+ {
+ printf ("mpq_cmp_si wrong\n");
+ error:
+ mpq_trace (" q", q);
+ printf (" n=%ld\n", data[i].n);
+ printf (" d=%lu\n", data[i].d);
+ printf (" got=%d\n", got);
+ printf (" want=%d\n", data[i].want);
+ abort ();
+ }
+
+ if (data[i].n == 0)
+ {
+ got = mpq_cmp_si (q, 0L, data[i].d);
+ if (SGN(got) != data[i].want)
+ {
+ printf ("mpq_cmp_si wrong\n");
+ goto error;
+ }
+ }
+ }
+
+ mpq_clear (q);
+}
+
+int
+main (int argc, char **argv)
+{
+ tests_start ();
+
+ check_data ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-cmp_ui.c b/vendor/gmp-6.3.0/tests/mpq/t-cmp_ui.c
new file mode 100644
index 0000000..51bb2cb
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-cmp_ui.c
@@ -0,0 +1,116 @@
+/* Test mpq_cmp_ui.
+
+Copyright 1996, 1997, 2001, 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#define SGN(x) ((x) < 0 ? -1 : (x) > 0 ? 1 : 0)
+
+int
+ref_mpq_cmp_ui (mpq_t a, unsigned long int bn, unsigned long int bd)
+{
+ mpz_t ai, bi;
+ int cc;
+
+ mpz_init (ai);
+ mpz_init (bi);
+
+ mpz_mul_ui (ai, NUM (a), bd);
+ mpz_mul_ui (bi, DEN (a), bn);
+ cc = mpz_cmp (ai, bi);
+ mpz_clear (ai);
+ mpz_clear (bi);
+ return cc;
+}
+
+#ifndef SIZE
+#define SIZE 8 /* increasing this lowers the probability of finding an error */
+#endif
+
+int
+main (int argc, char **argv)
+{
+ mpq_t a, b;
+ mp_size_t size;
+ int reps = 10000;
+ int i;
+ int cc, ccref;
+ unsigned long int bn, bd;
+
+ tests_start ();
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpq_init (a);
+ mpq_init (b);
+
+ for (i = 0; i < reps; i++)
+ {
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (NUM (a), size);
+ do
+ {
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (DEN (a), size);
+ }
+ while (mpz_cmp_ui (DEN (a), 0) == 0);
+
+ mpz_random2 (NUM (b), (mp_size_t) 1);
+ mpz_mod_ui (NUM (b), NUM (b), ~(unsigned long int) 0);
+ mpz_add_ui (NUM (b), NUM (b), 1);
+
+ mpz_random2 (DEN (b), (mp_size_t) 1);
+ mpz_mod_ui (DEN (b), DEN (b), ~(unsigned long int) 0);
+ mpz_add_ui (DEN (b), DEN (b), 1);
+
+ mpq_canonicalize (a);
+ mpq_canonicalize (b);
+
+ ccref = ref_mpq_cmp_ui (a, 1, 1);
+ cc = mpq_cmp_ui (a, 1, 1);
+
+ if (SGN (ccref) != SGN (cc))
+ abort ();
+
+ ccref = ref_mpq_cmp_ui (a, 0, 1);
+ cc = mpq_cmp_ui (a, 0, 1);
+
+ if (SGN (ccref) != SGN (cc))
+ abort ();
+
+ bn = mpz_get_ui (NUM (b));
+ bd = mpz_get_ui (DEN (b));
+
+ ccref = ref_mpq_cmp_ui (a, bn, bd);
+ cc = mpq_cmp_ui (a, bn, bd);
+
+ if (SGN (ccref) != SGN (cc))
+ abort ();
+ }
+
+ mpq_clear (a);
+ mpq_clear (b);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-cmp_z.c b/vendor/gmp-6.3.0/tests/mpq/t-cmp_z.c
new file mode 100644
index 0000000..3e66a3c
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-cmp_z.c
@@ -0,0 +1,146 @@
+/* Test mpq_cmp_z.
+
+Copyright 1996, 2001, 2015 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#define SGN(x) ((x) < 0 ? -1 : (x) > 0 ? 1 : 0)
+
+int
+ref_mpq_cmp_z (mpq_t a, mpz_t b)
+{
+ mpz_t bi;
+ int cc;
+
+ mpz_init (bi);
+
+ mpz_mul (bi, b, DEN (a));
+ cc = mpz_cmp (NUM (a), bi);
+ mpz_clear (bi);
+ return cc;
+}
+
+#ifndef SIZE
+#define SIZE 8 /* increasing this lowers the probability of finding an error */
+#endif
+
+#ifndef MAXN
+#define MAXN 5 /* increasing this impatcs on total timing */
+#endif
+
+void
+sizes_test (int m)
+{
+ mpq_t a;
+ mpz_t b;
+ int i, j, k, s;
+ int cc, ccref;
+
+ mpq_init (a);
+ mpz_init (b);
+
+ for (i = 0; i <= MAXN ; ++i)
+ {
+ mpz_setbit (DEN (a), i*m); /* \sum_0^i 2^(i*m) */
+ for (j = 0; j <= MAXN; ++j)
+ {
+ mpz_set_ui (NUM (a), 0);
+ mpz_setbit (NUM (a), j*m); /* 2^(j*m) */
+ for (k = 0; k <= MAXN; ++k)
+ {
+ mpz_set_ui (b, 0);
+ mpz_setbit (b, k*m); /* 2^(k*m) */
+ if (i == 0) /* Denominator is 1, compare the two exponents */
+ ccref = (j>k)-(j<k);
+ else
+ ccref = j-i > k ? 1 : -1;
+ for (s = 1; s >= -1; s -= 2)
+ {
+ cc = mpq_cmp_z (a, b);
+
+ if (ccref != SGN (cc))
+ {
+ fprintf (stderr, "i=%i, j=%i, k=%i, m=%i, s=%i\n; ccref= %i, cc= %i\n", i, j, k, m, s, ccref, cc);
+ abort ();
+ }
+
+ mpq_neg (a, a);
+ mpz_neg (b, b);
+ ccref = - ccref;
+ }
+ }
+ }
+ }
+
+ mpq_clear (a);
+ mpz_clear (b);
+}
+
+int
+main (int argc, char **argv)
+{
+ mpq_t a;
+ mpz_t b;
+ mp_size_t size;
+ int reps = 10000;
+ int i;
+ int cc, ccref;
+
+ tests_start ();
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpq_init (a);
+ mpz_init (b);
+
+ for (i = 0; i < reps; i++)
+ {
+ if (i % 8192 == 0)
+ sizes_test (urandom () % (i + 1) + 1);
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (NUM (a), size);
+ do
+ {
+ size = urandom () % (SIZE/2);
+ mpz_random2 (DEN (a), size);
+ }
+ while (mpz_cmp_ui (DEN (a), 0) == 0);
+
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (b, size);
+
+ mpq_canonicalize (a);
+
+ ccref = ref_mpq_cmp_z (a, b);
+ cc = mpq_cmp_z (a, b);
+
+ if (SGN (ccref) != SGN (cc))
+ abort ();
+ }
+
+ mpq_clear (a);
+ mpz_clear (b);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-equal.c b/vendor/gmp-6.3.0/tests/mpq/t-equal.c
new file mode 100644
index 0000000..671c530
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-equal.c
@@ -0,0 +1,146 @@
+/* Test mpq_equal.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_one (mpq_srcptr x, mpq_srcptr y, int want)
+{
+ int got;
+
+ MPQ_CHECK_FORMAT (x);
+ MPQ_CHECK_FORMAT (y);
+
+ got = mpq_equal (x, y);
+ if ((got != 0) != (want != 0))
+ {
+ printf ("mpq_equal got %d want %d\n", got, want);
+ mpq_trace ("x", x);
+ mpq_trace ("y", y);
+ abort ();
+ }
+}
+
+
+void
+check_all (mpq_ptr x, mpq_ptr y, int want)
+{
+ check_one (x, y, want);
+ check_one (y, x, want);
+
+ mpq_neg (x, x);
+ mpq_neg (y, y);
+
+ check_one (x, y, want);
+ check_one (y, x, want);
+}
+
+
+#define SET4Z(z, size,l3,l2,l1,l0) \
+ SIZ(z) = size; PTR(z)[3] = l3; PTR(z)[2] = l2; PTR(z)[1] = l1; PTR(z)[0] = l0
+
+#define SET4(q, nsize,n3,n2,n1,n0, dsize,d3,d2,d1,d0) \
+ SET4Z (mpq_numref(q), nsize,n3,n2,n1,n0); \
+ SET4Z (mpq_denref(q), dsize,d3,d2,d1,d0)
+
+
+/* Exercise various combinations of same and slightly different values. */
+
+void
+check_various (void)
+{
+ mpq_t x, y;
+
+ mpq_init (x);
+ mpq_init (y);
+
+ mpz_realloc (mpq_numref(x), (mp_size_t) 20);
+ mpz_realloc (mpq_denref(x), (mp_size_t) 20);
+ mpz_realloc (mpq_numref(y), (mp_size_t) 20);
+ mpz_realloc (mpq_denref(y), (mp_size_t) 20);
+
+ /* 0 == 0 */
+ SET4 (x, 0,13,12,11,10, 1,23,22,21,1);
+ SET4 (y, 0,33,32,31,30, 1,43,42,41,1);
+ check_all (x, y, 1);
+
+ /* 83/99 == 83/99 */
+ SET4 (x, 1,13,12,11,83, 1,23,22,21,99);
+ SET4 (y, 1,33,32,31,83, 1,43,42,41,99);
+ check_all (x, y, 1);
+
+ /* 1:2:3:4/5:6:7 == 1:2:3:4/5:6:7 */
+ SET4 (x, 4,1,2,3,4, 3,88,5,6,7);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 1);
+
+ /* various individual changes making != */
+ SET4 (x, 4,1,2,3,667, 3,88,5,6,7);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 0);
+ SET4 (x, 4,1,2,666,4, 3,88,5,6,7);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 0);
+ SET4 (x, 4,1,666,3,4, 3,88,5,6,7);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 0);
+#if GMP_NUMB_BITS != 62
+ SET4 (x, 4,667,2,3,4, 3,88,5,6,7);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 0);
+#endif
+ SET4 (x, 4,1,2,3,4, 3,88,5,6,667);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 0);
+ SET4 (x, 4,1,2,3,4, 3,88,5,667,7);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 0);
+ SET4 (x, 4,1,2,3,4, 3,88,666,6,7);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 0);
+ SET4 (x, -4,1,2,3,4, 3,88,5,6,7);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 0);
+ SET4 (x, 1,1,2,3,4, 3,88,5,6,7);
+ SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
+ check_all (x, y, 0);
+ SET4 (x, 4,1,2,3,4, 3,88,5,6,7);
+ SET4 (y, 4,1,2,3,4, 2,99,5,6,7);
+ check_all (x, y, 0);
+
+ mpq_clear (x);
+ mpq_clear (y);
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+ mp_trace_base = -16;
+
+ check_various ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-get_d.c b/vendor/gmp-6.3.0/tests/mpq/t-get_d.c
new file mode 100644
index 0000000..98d6a5f
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-get_d.c
@@ -0,0 +1,294 @@
+/* Test mpq_get_d and mpq_set_d
+
+Copyright 1991, 1993, 1994, 1996, 2000-2003, 2012, 2013 Free Software
+Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#ifndef SIZE
+#define SIZE 8
+#endif
+
+/* VAX D floats only have an 8 bit signed exponent, so anything 2^128 or
+ bigger will overflow, that being 4 limbs. */
+#if defined (__vax) || defined (__vax__) && SIZE > 4
+#undef SIZE
+#define SIZE 4
+#define EPSIZE 3
+#else
+#define EPSIZE SIZE
+#endif
+
+void dump (mpq_t);
+
+void
+check_monotonic (int argc, char **argv)
+{
+ mpq_t a;
+ mp_size_t size;
+ int reps = 100;
+ int i, j;
+ double last_d, new_d;
+ mpq_t qlast_d, qnew_d;
+ mpq_t eps;
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ /* The idea here is to test the monotonousness of mpq_get_d by adding
+ numbers to the numerator and denominator. */
+
+ mpq_init (a);
+ mpq_init (eps);
+ mpq_init (qlast_d);
+ mpq_init (qnew_d);
+
+ for (i = 0; i < reps; i++)
+ {
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (mpq_numref (a), size);
+ do
+ {
+ size = urandom () % SIZE - SIZE/2;
+ mpz_random2 (mpq_denref (a), size);
+ }
+ while (mpz_cmp_ui (mpq_denref (a), 0) == 0);
+
+ mpq_canonicalize (a);
+
+ last_d = mpq_get_d (a);
+ mpq_set_d (qlast_d, last_d);
+ for (j = 0; j < 10; j++)
+ {
+ size = urandom () % EPSIZE + 1;
+ mpz_random2 (mpq_numref (eps), size);
+ size = urandom () % EPSIZE + 1;
+ mpz_random2 (mpq_denref (eps), size);
+ mpq_canonicalize (eps);
+
+ mpq_add (a, a, eps);
+ mpq_canonicalize (a);
+ new_d = mpq_get_d (a);
+ if (last_d > new_d)
+ {
+ printf ("\nERROR (test %d/%d): bad mpq_get_d results\n", i, j);
+ printf ("last: %.16g\n", last_d);
+ printf (" new: %.16g\n", new_d); dump (a);
+ abort ();
+ }
+ mpq_set_d (qnew_d, new_d);
+ MPQ_CHECK_FORMAT (qnew_d);
+ if (mpq_cmp (qlast_d, qnew_d) > 0)
+ {
+ printf ("ERROR (test %d/%d): bad mpq_set_d results\n", i, j);
+ printf ("last: %.16g\n", last_d); dump (qlast_d);
+ printf (" new: %.16g\n", new_d); dump (qnew_d);
+ abort ();
+ }
+ last_d = new_d;
+ mpq_set (qlast_d, qnew_d);
+ }
+ }
+
+ mpq_clear (a);
+ mpq_clear (eps);
+ mpq_clear (qlast_d);
+ mpq_clear (qnew_d);
+}
+
+double
+my_ldexp (double d, int e)
+{
+ for (;;)
+ {
+ if (e > 0)
+ {
+ if (e >= 16)
+ {
+ d *= 65536.0;
+ e -= 16;
+ }
+ else
+ {
+ d *= 2.0;
+ e -= 1;
+ }
+ }
+ else if (e < 0)
+ {
+
+ if (e <= -16)
+ {
+ d /= 65536.0;
+ e += 16;
+ }
+ else
+ {
+ d /= 2.0;
+ e += 1;
+ }
+ }
+ else
+ return d;
+ }
+}
+
+#define MAXEXP 500
+
+#if defined (__vax) || defined (__vax__)
+#undef MAXEXP
+#define MAXEXP 30
+#endif
+
+void
+check_random (int argc, char **argv)
+{
+ gmp_randstate_ptr rands = RANDS;
+
+ double d;
+ mpq_t q;
+ mpz_t a, t;
+ int exp;
+
+ int test, reps = 100000;
+
+ if (argc == 2)
+ reps = 100 * atoi (argv[1]);
+
+ mpq_init (q);
+ mpz_init (a);
+ mpz_init (t);
+
+ for (test = 0; test < reps; test++)
+ {
+ mpz_rrandomb (a, rands, 53);
+ mpz_urandomb (t, rands, 32);
+ exp = mpz_get_ui (t) % (2*MAXEXP) - MAXEXP;
+
+ d = my_ldexp (mpz_get_d (a), exp);
+ mpq_set_d (q, d);
+ /* Check that n/d = a * 2^exp, or
+ d*a 2^{exp} = n */
+ mpz_mul (t, a, mpq_denref (q));
+ if (exp > 0)
+ mpz_mul_2exp (t, t, exp);
+ else
+ {
+ if (!mpz_divisible_2exp_p (t, -exp))
+ goto fail;
+ mpz_div_2exp (t, t, -exp);
+ }
+ if (mpz_cmp (t, mpq_numref (q)) != 0)
+ {
+ fail:
+ printf ("ERROR (check_random test %d): bad mpq_set_d results\n", test);
+ printf ("%.16g\n", d);
+ gmp_printf ("%Qd\n", q);
+ abort ();
+ }
+ }
+ mpq_clear (q);
+ mpz_clear (t);
+ mpz_clear (a);
+}
+
+void
+dump (mpq_t x)
+{
+ mpz_out_str (stdout, 10, mpq_numref (x));
+ printf ("/");
+ mpz_out_str (stdout, 10, mpq_denref (x));
+ printf ("\n");
+}
+
+/* Check various values 2^n and 1/2^n. */
+void
+check_onebit (void)
+{
+ static const long data[] = {
+ -3*GMP_NUMB_BITS-1, -3*GMP_NUMB_BITS, -3*GMP_NUMB_BITS+1,
+ -2*GMP_NUMB_BITS-1, -2*GMP_NUMB_BITS, -2*GMP_NUMB_BITS+1,
+ -GMP_NUMB_BITS-1, -GMP_NUMB_BITS, -GMP_NUMB_BITS+1,
+ -5, -2, -1, 0, 1, 2, 5,
+ GMP_NUMB_BITS-1, GMP_NUMB_BITS, GMP_NUMB_BITS+1,
+ 2*GMP_NUMB_BITS-1, 2*GMP_NUMB_BITS, 2*GMP_NUMB_BITS+1,
+ 3*GMP_NUMB_BITS-1, 3*GMP_NUMB_BITS, 3*GMP_NUMB_BITS+1,
+ };
+
+ int i, neg;
+ long exp, l;
+ mpq_t q;
+ double got, want;
+
+ mpq_init (q);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ exp = data[i];
+
+ mpq_set_ui (q, 1L, 1L);
+ if (exp >= 0)
+ mpq_mul_2exp (q, q, exp);
+ else
+ mpq_div_2exp (q, q, -exp);
+
+ want = 1.0;
+ for (l = 0; l < exp; l++)
+ want *= 2.0;
+ for (l = 0; l > exp; l--)
+ want /= 2.0;
+
+ for (neg = 0; neg <= 1; neg++)
+ {
+ if (neg)
+ {
+ mpq_neg (q, q);
+ want = -want;
+ }
+
+ got = mpq_get_d (q);
+
+ if (got != want)
+ {
+ printf ("mpq_get_d wrong on %s2**%ld\n", neg ? "-" : "", exp);
+ mpq_trace (" q ", q);
+ d_trace (" want ", want);
+ d_trace (" got ", got);
+ abort();
+ }
+ }
+ }
+ mpq_clear (q);
+}
+
+int
+main (int argc, char **argv)
+{
+ tests_start ();
+
+ check_onebit ();
+ check_monotonic (argc, argv);
+ check_random (argc, argv);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-get_str.c b/vendor/gmp-6.3.0/tests/mpq/t-get_str.c
new file mode 100644
index 0000000..e586521
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-get_str.c
@@ -0,0 +1,142 @@
+/* Test mpq_get_str.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_one (mpq_srcptr q, int base, const char *want)
+{
+ char *str, *ret;
+ size_t str_alloc;
+
+ MPQ_CHECK_FORMAT (q);
+ mp_trace_base = base;
+
+ str_alloc =
+ mpz_sizeinbase (mpq_numref(q), ABS(base)) +
+ mpz_sizeinbase (mpq_denref(q), ABS(base)) + 3;
+
+ str = mpq_get_str (NULL, base, q);
+ if (strlen(str)+1 > str_alloc)
+ {
+ printf ("mpq_get_str size bigger than should be (passing NULL)\n");
+ printf (" base %d\n", base);
+ printf (" got size %lu \"%s\"\n", (unsigned long) strlen(str)+1, str);
+ printf (" want size %lu\n", (unsigned long) str_alloc);
+ abort ();
+ }
+ if (strcmp (str, want) != 0)
+ {
+ printf ("mpq_get_str wrong (passing NULL)\n");
+ printf (" base %d\n", base);
+ printf (" got \"%s\"\n", str);
+ printf (" want \"%s\"\n", want);
+ mpq_trace (" q", q);
+ abort ();
+ }
+ (*__gmp_free_func) (str, strlen (str) + 1);
+
+ str = (char *) (*__gmp_allocate_func) (str_alloc);
+
+ ret = mpq_get_str (str, base, q);
+ if (str != ret)
+ {
+ printf ("mpq_get_str wrong return value (passing non-NULL)\n");
+ printf (" base %d\n", base);
+ printf (" got %p\n", (void *) ret);
+ printf (" want %p\n", (void *) str);
+ abort ();
+ }
+ if (strcmp (str, want) != 0)
+ {
+ printf ("mpq_get_str wrong (passing non-NULL)\n");
+ printf (" base %d\n", base);
+ printf (" got \"%s\"\n", str);
+ printf (" want \"%s\"\n", want);
+ abort ();
+ }
+ (*__gmp_free_func) (str, str_alloc);
+}
+
+
+void
+check_all (mpq_srcptr q, int base, const char *want)
+{
+ char *s;
+
+ check_one (q, base, want);
+
+ s = __gmp_allocate_strdup (want);
+ strtoupper (s);
+ check_one (q, -base, s);
+ (*__gmp_free_func) (s, strlen(s)+1);
+}
+
+void
+check_data (void)
+{
+ static const struct {
+ int base;
+ const char *num;
+ const char *den;
+ const char *want;
+ } data[] = {
+ { 10, "0", "1", "0" },
+ { 10, "1", "1", "1" },
+
+ { 16, "ffffffff", "1", "ffffffff" },
+ { 16, "ffffffffffffffff", "1", "ffffffffffffffff" },
+
+ { 16, "1", "ffffffff", "1/ffffffff" },
+ { 16, "1", "ffffffffffffffff", "1/ffffffffffffffff" },
+ { 16, "1", "10000000000000003", "1/10000000000000003" },
+
+ { 10, "12345678901234567890", "9876543210987654323",
+ "12345678901234567890/9876543210987654323" },
+ };
+
+ mpq_t q;
+ int i;
+
+ mpq_init (q);
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_str_or_abort (mpq_numref(q), data[i].num, data[i].base);
+ mpz_set_str_or_abort (mpq_denref(q), data[i].den, data[i].base);
+ check_all (q, data[i].base, data[i].want);
+ }
+ mpq_clear (q);
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_data ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-inp_str.c b/vendor/gmp-6.3.0/tests/mpq/t-inp_str.c
new file mode 100644
index 0000000..b44abd8
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-inp_str.c
@@ -0,0 +1,171 @@
+/* Test mpq_inp_str.
+
+Copyright 2001, 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#if HAVE_UNISTD_H
+#include <unistd.h> /* for unlink */
+#endif
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+#define FILENAME "t-inp_str.tmp"
+
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *inp;
+ int base;
+ const char *want;
+ int want_nread;
+
+ } data[] = {
+
+ { "0", 10, "0", 1 },
+ { "0/1", 10, "0", 3 },
+
+ { "0/", 10, "0", 0 },
+ { "/123", 10, "0", 0 },
+ { "blah", 10, "0", 0 },
+ { "123/blah", 10, "0", 0 },
+ { "5 /8", 10, "5", 1 },
+ { "5/ 8", 10, "0", 0 },
+
+ { "ff", 16, "255", 2 },
+ { "-ff", 16, "-255", 3 },
+ { "FF", 16, "255", 2 },
+ { "-FF", 16, "-255", 3 },
+
+ { "z", 36, "35", 1 },
+ { "Z", 36, "35", 1 },
+
+ { "0x0", 0, "0", 3 },
+ { "0x10", 0, "16", 4 },
+ { "-0x0", 0, "0", 4 },
+ { "-0x10", 0, "-16", 5 },
+ { "-0x10/5", 0, "-16/5", 7 },
+
+ { "00", 0, "0", 2 },
+ { "010", 0, "8", 3 },
+ { "-00", 0, "0", 3 },
+ { "-010", 0, "-8", 4 },
+ };
+
+ mpq_t got, want;
+ long ftell_nread;
+ int i, post, j, got_nread;
+ FILE *fp;
+
+ mpq_init (got);
+ mpq_init (want);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ for (post = 0; post <= 2; post++)
+ {
+ mpq_set_str_or_abort (want, data[i].want, 0);
+ MPQ_CHECK_FORMAT (want);
+
+ fp = fopen (FILENAME, "w+");
+ ASSERT_ALWAYS (fp != NULL);
+ fputs (data[i].inp, fp);
+ for (j = 0; j < post; j++)
+ putc (' ', fp);
+ fflush (fp);
+ ASSERT_ALWAYS (! ferror(fp));
+
+ rewind (fp);
+ got_nread = mpq_inp_str (got, fp, data[i].base);
+
+ if (got_nread != 0)
+ {
+ ftell_nread = ftell (fp);
+ if (got_nread != ftell_nread)
+ {
+ printf ("mpq_inp_str nread wrong\n");
+ printf (" inp \"%s\"\n", data[i].inp);
+ printf (" base %d\n", data[i].base);
+ printf (" got_nread %d\n", got_nread);
+ printf (" ftell_nread %ld\n", ftell_nread);
+ abort ();
+ }
+ }
+
+ if (post == 0 && data[i].want_nread == strlen(data[i].inp))
+ {
+ int c = getc(fp);
+ if (c != EOF)
+ {
+ printf ("mpq_inp_str didn't read to EOF\n");
+ printf (" inp \"%s\"\n", data[i].inp);
+ printf (" base %d\n", data[i].base);
+ printf (" c '%c' %#x\n", c, c);
+ abort ();
+ }
+ }
+
+ if (got_nread != data[i].want_nread)
+ {
+ printf ("mpq_inp_str nread wrong\n");
+ printf (" inp \"%s\"\n", data[i].inp);
+ printf (" base %d\n", data[i].base);
+ printf (" got_nread %d\n", got_nread);
+ printf (" want_nread %d\n", data[i].want_nread);
+ abort ();
+ }
+
+ MPQ_CHECK_FORMAT (got);
+
+ if (! mpq_equal (got, want))
+ {
+ printf ("mpq_inp_str wrong result\n");
+ printf (" inp \"%s\"\n", data[i].inp);
+ printf (" base %d\n", data[i].base);
+ mpq_trace (" got ", got);
+ mpq_trace (" want", want);
+ abort ();
+ }
+
+ ASSERT_ALWAYS (fclose (fp) == 0);
+ }
+ }
+
+ mpq_clear (got);
+ mpq_clear (want);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_data ();
+
+ unlink (FILENAME);
+ tests_end ();
+
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-inv.c b/vendor/gmp-6.3.0/tests/mpq/t-inv.c
new file mode 100644
index 0000000..87ba8d4
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-inv.c
@@ -0,0 +1,60 @@
+/* Test mpq_inv (and set/get_num/den).
+
+Copyright 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+int
+main (int argc, char **argv)
+{
+ mpq_t a, b;
+ mpz_t m, n;
+ const char* s = "-420000000000000000000000";
+
+ tests_start ();
+
+ mpq_inits (a, b, (mpq_ptr)0);
+ mpz_inits (m, n, (mpz_ptr)0);
+
+ mpz_set_ui (m, 13);
+ mpq_set_den (a, m);
+ mpz_set_str (m, s, 0);
+ mpq_set_num (a, m);
+ MPQ_CHECK_FORMAT (a);
+ mpq_inv (b, a);
+ MPQ_CHECK_FORMAT (b);
+ mpq_get_num (n, b);
+ ASSERT_ALWAYS (mpz_cmp_si (n, -13) == 0);
+ mpq_neg (b, b);
+ mpq_inv (a, b);
+ MPQ_CHECK_FORMAT (a);
+ mpq_inv (b, b);
+ MPQ_CHECK_FORMAT (b);
+ mpq_get_den (n, b);
+ ASSERT_ALWAYS (mpz_cmp_ui (n, 13) == 0);
+ mpq_get_num (n, a);
+ mpz_add (n, n, m);
+ ASSERT_ALWAYS (mpz_sgn (n) == 0);
+
+ mpq_clears (a, b, (mpq_ptr)0);
+ mpz_clears (m, n, (mpz_ptr)0);
+
+ tests_end ();
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-md_2exp.c b/vendor/gmp-6.3.0/tests/mpq/t-md_2exp.c
new file mode 100644
index 0000000..2bffce9
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-md_2exp.c
@@ -0,0 +1,244 @@
+/* Test mpq_mul_2exp and mpq_div_2exp.
+
+Copyright 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+struct pair_t {
+ const char *num;
+ const char *den;
+};
+
+void
+check_random ()
+{
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long arg_size, size_range;
+ mpq_t q, r;
+ int i;
+ mp_bitcnt_t shift;
+ int reps = 10000;
+
+ rands = RANDS;
+
+ mpz_init (bs);
+ mpq_init (q);
+ mpq_init (r);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 11 + 2; /* 0..4096 bit operands */
+
+ mpz_urandomb (bs, rands, size_range);
+ arg_size = mpz_get_ui (bs);
+ mpz_rrandomb (mpq_numref (q), rands, arg_size);
+ do
+ {
+ mpz_urandomb (bs, rands, size_range);
+ arg_size = mpz_get_ui (bs);
+ mpz_rrandomb (mpq_denref (q), rands, arg_size);
+ }
+ while (mpz_sgn (mpq_denref (q)) == 0);
+
+ /* We now have a random rational in q, albeit an unnormalised one. The
+ lack of normalisation should not matter here, so let's save the time a
+ gcd would require. */
+
+ mpz_urandomb (bs, rands, 32);
+ shift = mpz_get_ui (bs) % 4096;
+
+ mpq_mul_2exp (r, q, shift);
+
+ if (mpq_cmp (r, q) < 0)
+ {
+ printf ("mpq_mul_2exp wrong on random\n");
+ abort ();
+ }
+
+ mpq_div_2exp (r, r, shift);
+
+ if (mpq_cmp (r, q) != 0)
+ {
+ printf ("mpq_mul_2exp or mpq_div_2exp wrong on random\n");
+ abort ();
+ }
+ }
+ mpq_clear (q);
+ mpq_clear (r);
+ mpz_clear (bs);
+}
+
+int
+main (int argc, char **argv)
+{
+ static const struct {
+ struct pair_t left;
+ unsigned long n;
+ struct pair_t right;
+
+ } data[] = {
+ { {"0","1"}, 0, {"0","1"} },
+ { {"0","1"}, 1, {"0","1"} },
+ { {"0","1"}, 2, {"0","1"} },
+
+ { {"1","1"}, 0, {"1","1"} },
+ { {"1","1"}, 1, {"2","1"} },
+ { {"1","1"}, 2, {"4","1"} },
+ { {"1","1"}, 3, {"8","1"} },
+
+ { {"1","1"}, 31, {"0x80000000","1"} },
+ { {"1","1"}, 32, {"0x100000000","1"} },
+ { {"1","1"}, 33, {"0x200000000","1"} },
+ { {"1","1"}, 63, {"0x8000000000000000","1"} },
+ { {"1","1"}, 64, {"0x10000000000000000","1"} },
+ { {"1","1"}, 65, {"0x20000000000000000","1"} },
+ { {"1","1"}, 95, {"0x800000000000000000000000","1"} },
+ { {"1","1"}, 96, {"0x1000000000000000000000000","1"} },
+ { {"1","1"}, 97, {"0x2000000000000000000000000","1"} },
+ { {"1","1"}, 127, {"0x80000000000000000000000000000000","1"} },
+ { {"1","1"}, 128, {"0x100000000000000000000000000000000","1"} },
+ { {"1","1"}, 129, {"0x200000000000000000000000000000000","1"} },
+
+ { {"1","2"}, 31, {"0x40000000","1"} },
+ { {"1","2"}, 32, {"0x80000000","1"} },
+ { {"1","2"}, 33, {"0x100000000","1"} },
+ { {"1","2"}, 63, {"0x4000000000000000","1"} },
+ { {"1","2"}, 64, {"0x8000000000000000","1"} },
+ { {"1","2"}, 65, {"0x10000000000000000","1"} },
+ { {"1","2"}, 95, {"0x400000000000000000000000","1"} },
+ { {"1","2"}, 96, {"0x800000000000000000000000","1"} },
+ { {"1","2"}, 97, {"0x1000000000000000000000000","1"} },
+ { {"1","2"}, 127, {"0x40000000000000000000000000000000","1"} },
+ { {"1","2"}, 128, {"0x80000000000000000000000000000000","1"} },
+ { {"1","2"}, 129, {"0x100000000000000000000000000000000","1"} },
+
+ { {"1","0x80000000"}, 30, {"1","2"} },
+ { {"1","0x80000000"}, 31, {"1","1"} },
+ { {"1","0x80000000"}, 32, {"2","1"} },
+ { {"1","0x80000000"}, 33, {"4","1"} },
+ { {"1","0x80000000"}, 62, {"0x80000000","1"} },
+ { {"1","0x80000000"}, 63, {"0x100000000","1"} },
+ { {"1","0x80000000"}, 64, {"0x200000000","1"} },
+ { {"1","0x80000000"}, 94, {"0x8000000000000000","1"} },
+ { {"1","0x80000000"}, 95, {"0x10000000000000000","1"} },
+ { {"1","0x80000000"}, 96, {"0x20000000000000000","1"} },
+ { {"1","0x80000000"}, 126, {"0x800000000000000000000000","1"} },
+ { {"1","0x80000000"}, 127, {"0x1000000000000000000000000","1"} },
+ { {"1","0x80000000"}, 128, {"0x2000000000000000000000000","1"} },
+
+ { {"1","0x100000000"}, 1, {"1","0x80000000"} },
+ { {"1","0x100000000"}, 2, {"1","0x40000000"} },
+ { {"1","0x100000000"}, 3, {"1","0x20000000"} },
+
+ { {"1","0x10000000000000000"}, 1, {"1","0x8000000000000000"} },
+ { {"1","0x10000000000000000"}, 2, {"1","0x4000000000000000"} },
+ { {"1","0x10000000000000000"}, 3, {"1","0x2000000000000000"} },
+ };
+
+ void (*fun) (mpq_ptr, mpq_srcptr, unsigned long);
+ const struct pair_t *p_start, *p_want;
+ const char *name;
+ mpq_t sep, got, want;
+ mpq_ptr q;
+ int i, muldiv, sign, overlap;
+
+ tests_start ();
+
+ mpq_init (sep);
+ mpq_init (got);
+ mpq_init (want);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ for (muldiv = 0; muldiv < 2; muldiv++)
+ {
+ if (muldiv == 0)
+ {
+ fun = mpq_mul_2exp;
+ name = "mpq_mul_2exp";
+ p_start = &data[i].left;
+ p_want = &data[i].right;
+ }
+ else
+ {
+ fun = mpq_div_2exp;
+ name = "mpq_div_2exp";
+ p_start = &data[i].right;
+ p_want = &data[i].left;
+ }
+
+ for (sign = 0; sign <= 1; sign++)
+ {
+ mpz_set_str_or_abort (mpq_numref(want), p_want->num, 0);
+ mpz_set_str_or_abort (mpq_denref(want), p_want->den, 0);
+ if (sign)
+ mpq_neg (want, want);
+
+ for (overlap = 0; overlap <= 1; overlap++)
+ {
+ q = overlap ? got : sep;
+
+ /* initial garbage in "got" */
+ mpq_set_ui (got, 123L, 456L);
+
+ mpz_set_str_or_abort (mpq_numref(q), p_start->num, 0);
+ mpz_set_str_or_abort (mpq_denref(q), p_start->den, 0);
+ if (sign)
+ mpq_neg (q, q);
+
+ (*fun) (got, q, data[i].n);
+ MPQ_CHECK_FORMAT (got);
+
+ if (! mpq_equal (got, want))
+ {
+ printf ("%s wrong at data[%d], sign %d, overlap %d\n",
+ name, i, sign, overlap);
+ printf (" num \"%s\"\n", p_start->num);
+ printf (" den \"%s\"\n", p_start->den);
+ printf (" n %lu\n", data[i].n);
+
+ printf (" got ");
+ mpq_out_str (stdout, 16, got);
+ printf (" (hex)\n");
+
+ printf (" want ");
+ mpq_out_str (stdout, 16, want);
+ printf (" (hex)\n");
+
+ abort ();
+ }
+ }
+ }
+ }
+ }
+
+ check_random ();
+
+ mpq_clear (sep);
+ mpq_clear (got);
+ mpq_clear (want);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-set_f.c b/vendor/gmp-6.3.0/tests/mpq/t-set_f.c
new file mode 100644
index 0000000..e92e3aa
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-set_f.c
@@ -0,0 +1,169 @@
+/* Test mpq_set_f.
+
+Copyright 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+int
+main (int argc, char **argv)
+{
+#if GMP_NAIL_BITS == 0
+ static const struct {
+ int f_base;
+ const char *f;
+ int z_base;
+ const char *want_num;
+ const char *want_den;
+
+ } data[] = {
+
+ { -2, "0", 16, "0", "1" },
+ { -2, "1", 16, "1", "1" },
+ { -2, "1@1", 16, "2", "1" },
+ { -2, "1@2", 16, "4", "1" },
+ { -2, "1@3", 16, "8", "1" },
+
+ { -2, "1@30", 16, "40000000", "1" },
+ { -2, "1@31", 16, "80000000", "1" },
+ { -2, "1@32", 16, "100000000", "1" },
+ { -2, "1@33", 16, "200000000", "1" },
+ { -2, "1@34", 16, "400000000", "1" },
+
+ { -2, "1@62", 16, "4000000000000000", "1" },
+ { -2, "1@63", 16, "8000000000000000", "1" },
+ { -2, "1@64", 16, "10000000000000000", "1" },
+ { -2, "1@65", 16, "20000000000000000", "1" },
+ { -2, "1@66", 16, "40000000000000000", "1" },
+
+ { -2, "1@126", 16, "40000000000000000000000000000000", "1" },
+ { -2, "1@127", 16, "80000000000000000000000000000000", "1" },
+ { -2, "1@128", 16, "100000000000000000000000000000000", "1" },
+ { -2, "1@129", 16, "200000000000000000000000000000000", "1" },
+ { -2, "1@130", 16, "400000000000000000000000000000000", "1" },
+
+ { -2, "1@-1", 16, "1", "2" },
+ { -2, "1@-2", 16, "1", "4" },
+ { -2, "1@-3", 16, "1", "8" },
+
+ { -2, "1@-30", 16, "1", "40000000" },
+ { -2, "1@-31", 16, "1", "80000000" },
+ { -2, "1@-32", 16, "1", "100000000" },
+ { -2, "1@-33", 16, "1", "200000000" },
+ { -2, "1@-34", 16, "1", "400000000" },
+
+ { -2, "1@-62", 16, "1", "4000000000000000" },
+ { -2, "1@-63", 16, "1", "8000000000000000" },
+ { -2, "1@-64", 16, "1", "10000000000000000" },
+ { -2, "1@-65", 16, "1", "20000000000000000" },
+ { -2, "1@-66", 16, "1", "40000000000000000" },
+
+ { -2, "1@-126", 16, "1", "40000000000000000000000000000000" },
+ { -2, "1@-127", 16, "1", "80000000000000000000000000000000" },
+ { -2, "1@-128", 16, "1", "100000000000000000000000000000000" },
+ { -2, "1@-129", 16, "1", "200000000000000000000000000000000" },
+ { -2, "1@-130", 16, "1", "400000000000000000000000000000000" },
+
+ { -2, "1@-30", 16, "1", "40000000" },
+ { -2, "1@-31", 16, "1", "80000000" },
+ { -2, "1@-32", 16, "1", "100000000" },
+ { -2, "1@-33", 16, "1", "200000000" },
+ { -2, "1@-34", 16, "1", "400000000" },
+
+ { -2, "11@-62", 16, "3", "4000000000000000" },
+ { -2, "11@-63", 16, "3", "8000000000000000" },
+ { -2, "11@-64", 16, "3", "10000000000000000" },
+ { -2, "11@-65", 16, "3", "20000000000000000" },
+ { -2, "11@-66", 16, "3", "40000000000000000" },
+
+ { 16, "80000000.00000001", 16, "8000000000000001", "100000000" },
+ { 16, "80000000.00000008", 16, "1000000000000001", "20000000" },
+ { 16, "80000000.8", 16, "100000001", "2" },
+
+ };
+
+ mpf_t f;
+ mpq_t got;
+ mpz_t want_num, want_den;
+ int i, neg;
+
+ tests_start ();
+
+ mpf_init2 (f, 1024L);
+ mpq_init (got);
+ mpz_init (want_num);
+ mpz_init (want_den);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ for (neg = 0; neg <= 1; neg++)
+ {
+ mpf_set_str_or_abort (f, data[i].f, data[i].f_base);
+ mpz_set_str_or_abort (want_num, data[i].want_num, data[i].z_base);
+ mpz_set_str_or_abort (want_den, data[i].want_den, data[i].z_base);
+
+ if (neg)
+ {
+ mpf_neg (f, f);
+ mpz_neg (want_num, want_num);
+ }
+
+ mpq_set_f (got, f);
+ MPQ_CHECK_FORMAT (got);
+
+ if (mpz_cmp (mpq_numref(got), want_num) != 0
+ || mpz_cmp (mpq_denref(got), want_den) != 0)
+ {
+ printf ("wrong at data[%d]\n", i);
+ printf (" f_base %d, z_base %d\n",
+ data[i].f_base, data[i].z_base);
+
+ printf (" f \"%s\" hex ", data[i].f);
+ mpf_out_str (stdout, 16, 0, f);
+ printf ("\n");
+
+ printf (" want num 0x");
+ mpz_out_str (stdout, 16, want_num);
+ printf ("\n");
+ printf (" want den 0x");
+ mpz_out_str (stdout, 16, want_den);
+ printf ("\n");
+
+ printf (" got num 0x");
+ mpz_out_str (stdout, 16, mpq_numref(got));
+ printf ("\n");
+ printf (" got den 0x");
+ mpz_out_str (stdout, 16, mpq_denref(got));
+ printf ("\n");
+
+ abort ();
+ }
+ }
+ }
+
+ mpf_clear (f);
+ mpq_clear (got);
+ mpz_clear (want_num);
+ mpz_clear (want_den);
+
+ tests_end ();
+#endif
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpq/t-set_str.c b/vendor/gmp-6.3.0/tests/mpq/t-set_str.c
new file mode 100644
index 0000000..1f5ca8b
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpq/t-set_str.c
@@ -0,0 +1,102 @@
+/* Test mpq_set_str.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_one (mpq_srcptr want, int base, const char *str)
+{
+ mpq_t got;
+
+ MPQ_CHECK_FORMAT (want);
+ mp_trace_base = base;
+
+ mpq_init (got);
+
+ if (mpq_set_str (got, str, base) != 0)
+ {
+ printf ("mpq_set_str unexpectedly failed\n");
+ printf (" base %d\n", base);
+ printf (" str \"%s\"\n", str);
+ abort ();
+ }
+ MPQ_CHECK_FORMAT (got);
+
+ if (! mpq_equal (got, want))
+ {
+ printf ("mpq_set_str wrong\n");
+ printf (" base %d\n", base);
+ printf (" str \"%s\"\n", str);
+ mpq_trace ("got ", got);
+ mpq_trace ("want", want);
+ abort ();
+ }
+
+ mpq_clear (got);
+}
+
+void
+check_samples (void)
+{
+ mpq_t q;
+
+ mpq_init (q);
+
+ mpq_set_ui (q, 0L, 1L);
+ check_one (q, 10, "0");
+ check_one (q, 10, "0/1");
+ check_one (q, 10, "0 / 1");
+ check_one (q, 0, "0x0/ 1");
+ check_one (q, 0, "0x0/ 0x1");
+ check_one (q, 0, "0 / 0x1");
+
+ check_one (q, 10, "-0");
+ check_one (q, 10, "-0/1");
+ check_one (q, 10, "-0 / 1");
+ check_one (q, 0, "-0x0/ 1");
+ check_one (q, 0, "-0x0/ 0x1");
+ check_one (q, 0, "-0 / 0x1");
+
+ mpq_set_ui (q, 255L, 256L);
+ check_one (q, 10, "255/256");
+ check_one (q, 0, "0xFF/0x100");
+ check_one (q, 16, "FF/100");
+
+ mpq_neg (q, q);
+ check_one (q, 10, "-255/256");
+ check_one (q, 0, "-0xFF/0x100");
+ check_one (q, 16, "-FF/100");
+
+ mpq_clear (q);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_samples ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/Makefile.am b/vendor/gmp-6.3.0/tests/mpz/Makefile.am
new file mode 100644
index 0000000..5b5eb6d
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/Makefile.am
@@ -0,0 +1,43 @@
+## Process this file with automake to generate Makefile.in
+
+# Copyright 1996, 1997, 1999-2003, 2009, 2012 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+
+
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
+AM_LDFLAGS = -no-install
+LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
+
+check_PROGRAMS = reuse t-addsub t-cmp t-mul t-mul_i t-tdiv t-tdiv_ui t-fdiv \
+ t-fdiv_ui t-cdiv_ui t-gcd t-gcd_ui t-lcm t-invert dive dive_ui t-sqrtrem \
+ convert io t-inp_str logic t-bit t-powm t-powm_ui t-pow t-div_2exp \
+ t-root t-perfsqr t-perfpow t-jac t-bin t-get_d t-get_d_2exp t-get_si \
+ t-set_d t-set_si t-lucm \
+ t-fac_ui t-mfac_uiui t-primorial_ui t-fib_ui t-lucnum_ui t-scan t-fits \
+ t-divis t-divis_2exp t-cong t-cong_2exp t-sizeinbase t-set_str \
+ t-aorsmul t-cmp_d t-cmp_si t-hamdist t-oddeven t-popcount t-set_f \
+ t-io_raw t-import t-export t-pprime_p t-nextprime t-remove t-limbs
+
+TESTS = $(check_PROGRAMS)
+
+# Temporary files used by the tests. Removed automatically if the tests
+# pass, but ensure they're cleaned if they fail.
+#
+CLEANFILES = *.tmp
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
diff --git a/vendor/gmp-6.3.0/tests/mpz/Makefile.in b/vendor/gmp-6.3.0/tests/mpz/Makefile.in
new file mode 100644
index 0000000..1071296
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/Makefile.in
@@ -0,0 +1,2059 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 1996, 1997, 1999-2003, 2009, 2012 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+check_PROGRAMS = reuse$(EXEEXT) t-addsub$(EXEEXT) t-cmp$(EXEEXT) \
+ t-mul$(EXEEXT) t-mul_i$(EXEEXT) t-tdiv$(EXEEXT) \
+ t-tdiv_ui$(EXEEXT) t-fdiv$(EXEEXT) t-fdiv_ui$(EXEEXT) \
+ t-cdiv_ui$(EXEEXT) t-gcd$(EXEEXT) t-gcd_ui$(EXEEXT) \
+ t-lcm$(EXEEXT) t-invert$(EXEEXT) dive$(EXEEXT) \
+ dive_ui$(EXEEXT) t-sqrtrem$(EXEEXT) convert$(EXEEXT) \
+ io$(EXEEXT) t-inp_str$(EXEEXT) logic$(EXEEXT) t-bit$(EXEEXT) \
+ t-powm$(EXEEXT) t-powm_ui$(EXEEXT) t-pow$(EXEEXT) \
+ t-div_2exp$(EXEEXT) t-root$(EXEEXT) t-perfsqr$(EXEEXT) \
+ t-perfpow$(EXEEXT) t-jac$(EXEEXT) t-bin$(EXEEXT) \
+ t-get_d$(EXEEXT) t-get_d_2exp$(EXEEXT) t-get_si$(EXEEXT) \
+ t-set_d$(EXEEXT) t-set_si$(EXEEXT) t-lucm$(EXEEXT) \
+ t-fac_ui$(EXEEXT) t-mfac_uiui$(EXEEXT) t-primorial_ui$(EXEEXT) \
+ t-fib_ui$(EXEEXT) t-lucnum_ui$(EXEEXT) t-scan$(EXEEXT) \
+ t-fits$(EXEEXT) t-divis$(EXEEXT) t-divis_2exp$(EXEEXT) \
+ t-cong$(EXEEXT) t-cong_2exp$(EXEEXT) t-sizeinbase$(EXEEXT) \
+ t-set_str$(EXEEXT) t-aorsmul$(EXEEXT) t-cmp_d$(EXEEXT) \
+ t-cmp_si$(EXEEXT) t-hamdist$(EXEEXT) t-oddeven$(EXEEXT) \
+ t-popcount$(EXEEXT) t-set_f$(EXEEXT) t-io_raw$(EXEEXT) \
+ t-import$(EXEEXT) t-export$(EXEEXT) t-pprime_p$(EXEEXT) \
+ t-nextprime$(EXEEXT) t-remove$(EXEEXT) t-limbs$(EXEEXT)
+subdir = tests/mpz
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+convert_SOURCES = convert.c
+convert_OBJECTS = convert.$(OBJEXT)
+convert_LDADD = $(LDADD)
+convert_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+dive_SOURCES = dive.c
+dive_OBJECTS = dive.$(OBJEXT)
+dive_LDADD = $(LDADD)
+dive_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+dive_ui_SOURCES = dive_ui.c
+dive_ui_OBJECTS = dive_ui.$(OBJEXT)
+dive_ui_LDADD = $(LDADD)
+dive_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+io_SOURCES = io.c
+io_OBJECTS = io.$(OBJEXT)
+io_LDADD = $(LDADD)
+io_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+logic_SOURCES = logic.c
+logic_OBJECTS = logic.$(OBJEXT)
+logic_LDADD = $(LDADD)
+logic_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+reuse_SOURCES = reuse.c
+reuse_OBJECTS = reuse.$(OBJEXT)
+reuse_LDADD = $(LDADD)
+reuse_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_addsub_SOURCES = t-addsub.c
+t_addsub_OBJECTS = t-addsub.$(OBJEXT)
+t_addsub_LDADD = $(LDADD)
+t_addsub_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_aorsmul_SOURCES = t-aorsmul.c
+t_aorsmul_OBJECTS = t-aorsmul.$(OBJEXT)
+t_aorsmul_LDADD = $(LDADD)
+t_aorsmul_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_bin_SOURCES = t-bin.c
+t_bin_OBJECTS = t-bin.$(OBJEXT)
+t_bin_LDADD = $(LDADD)
+t_bin_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_bit_SOURCES = t-bit.c
+t_bit_OBJECTS = t-bit.$(OBJEXT)
+t_bit_LDADD = $(LDADD)
+t_bit_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_cdiv_ui_SOURCES = t-cdiv_ui.c
+t_cdiv_ui_OBJECTS = t-cdiv_ui.$(OBJEXT)
+t_cdiv_ui_LDADD = $(LDADD)
+t_cdiv_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_cmp_SOURCES = t-cmp.c
+t_cmp_OBJECTS = t-cmp.$(OBJEXT)
+t_cmp_LDADD = $(LDADD)
+t_cmp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_cmp_d_SOURCES = t-cmp_d.c
+t_cmp_d_OBJECTS = t-cmp_d.$(OBJEXT)
+t_cmp_d_LDADD = $(LDADD)
+t_cmp_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_cmp_si_SOURCES = t-cmp_si.c
+t_cmp_si_OBJECTS = t-cmp_si.$(OBJEXT)
+t_cmp_si_LDADD = $(LDADD)
+t_cmp_si_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_cong_SOURCES = t-cong.c
+t_cong_OBJECTS = t-cong.$(OBJEXT)
+t_cong_LDADD = $(LDADD)
+t_cong_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_cong_2exp_SOURCES = t-cong_2exp.c
+t_cong_2exp_OBJECTS = t-cong_2exp.$(OBJEXT)
+t_cong_2exp_LDADD = $(LDADD)
+t_cong_2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_div_2exp_SOURCES = t-div_2exp.c
+t_div_2exp_OBJECTS = t-div_2exp.$(OBJEXT)
+t_div_2exp_LDADD = $(LDADD)
+t_div_2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_divis_SOURCES = t-divis.c
+t_divis_OBJECTS = t-divis.$(OBJEXT)
+t_divis_LDADD = $(LDADD)
+t_divis_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_divis_2exp_SOURCES = t-divis_2exp.c
+t_divis_2exp_OBJECTS = t-divis_2exp.$(OBJEXT)
+t_divis_2exp_LDADD = $(LDADD)
+t_divis_2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_export_SOURCES = t-export.c
+t_export_OBJECTS = t-export.$(OBJEXT)
+t_export_LDADD = $(LDADD)
+t_export_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_fac_ui_SOURCES = t-fac_ui.c
+t_fac_ui_OBJECTS = t-fac_ui.$(OBJEXT)
+t_fac_ui_LDADD = $(LDADD)
+t_fac_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_fdiv_SOURCES = t-fdiv.c
+t_fdiv_OBJECTS = t-fdiv.$(OBJEXT)
+t_fdiv_LDADD = $(LDADD)
+t_fdiv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_fdiv_ui_SOURCES = t-fdiv_ui.c
+t_fdiv_ui_OBJECTS = t-fdiv_ui.$(OBJEXT)
+t_fdiv_ui_LDADD = $(LDADD)
+t_fdiv_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_fib_ui_SOURCES = t-fib_ui.c
+t_fib_ui_OBJECTS = t-fib_ui.$(OBJEXT)
+t_fib_ui_LDADD = $(LDADD)
+t_fib_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_fits_SOURCES = t-fits.c
+t_fits_OBJECTS = t-fits.$(OBJEXT)
+t_fits_LDADD = $(LDADD)
+t_fits_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_gcd_SOURCES = t-gcd.c
+t_gcd_OBJECTS = t-gcd.$(OBJEXT)
+t_gcd_LDADD = $(LDADD)
+t_gcd_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_gcd_ui_SOURCES = t-gcd_ui.c
+t_gcd_ui_OBJECTS = t-gcd_ui.$(OBJEXT)
+t_gcd_ui_LDADD = $(LDADD)
+t_gcd_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_get_d_SOURCES = t-get_d.c
+t_get_d_OBJECTS = t-get_d.$(OBJEXT)
+t_get_d_LDADD = $(LDADD)
+t_get_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_get_d_2exp_SOURCES = t-get_d_2exp.c
+t_get_d_2exp_OBJECTS = t-get_d_2exp.$(OBJEXT)
+t_get_d_2exp_LDADD = $(LDADD)
+t_get_d_2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_get_si_SOURCES = t-get_si.c
+t_get_si_OBJECTS = t-get_si.$(OBJEXT)
+t_get_si_LDADD = $(LDADD)
+t_get_si_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_hamdist_SOURCES = t-hamdist.c
+t_hamdist_OBJECTS = t-hamdist.$(OBJEXT)
+t_hamdist_LDADD = $(LDADD)
+t_hamdist_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_import_SOURCES = t-import.c
+t_import_OBJECTS = t-import.$(OBJEXT)
+t_import_LDADD = $(LDADD)
+t_import_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_inp_str_SOURCES = t-inp_str.c
+t_inp_str_OBJECTS = t-inp_str.$(OBJEXT)
+t_inp_str_LDADD = $(LDADD)
+t_inp_str_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_invert_SOURCES = t-invert.c
+t_invert_OBJECTS = t-invert.$(OBJEXT)
+t_invert_LDADD = $(LDADD)
+t_invert_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_io_raw_SOURCES = t-io_raw.c
+t_io_raw_OBJECTS = t-io_raw.$(OBJEXT)
+t_io_raw_LDADD = $(LDADD)
+t_io_raw_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_jac_SOURCES = t-jac.c
+t_jac_OBJECTS = t-jac.$(OBJEXT)
+t_jac_LDADD = $(LDADD)
+t_jac_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_lcm_SOURCES = t-lcm.c
+t_lcm_OBJECTS = t-lcm.$(OBJEXT)
+t_lcm_LDADD = $(LDADD)
+t_lcm_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_limbs_SOURCES = t-limbs.c
+t_limbs_OBJECTS = t-limbs.$(OBJEXT)
+t_limbs_LDADD = $(LDADD)
+t_limbs_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_lucm_SOURCES = t-lucm.c
+t_lucm_OBJECTS = t-lucm.$(OBJEXT)
+t_lucm_LDADD = $(LDADD)
+t_lucm_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_lucnum_ui_SOURCES = t-lucnum_ui.c
+t_lucnum_ui_OBJECTS = t-lucnum_ui.$(OBJEXT)
+t_lucnum_ui_LDADD = $(LDADD)
+t_lucnum_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_mfac_uiui_SOURCES = t-mfac_uiui.c
+t_mfac_uiui_OBJECTS = t-mfac_uiui.$(OBJEXT)
+t_mfac_uiui_LDADD = $(LDADD)
+t_mfac_uiui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_mul_SOURCES = t-mul.c
+t_mul_OBJECTS = t-mul.$(OBJEXT)
+t_mul_LDADD = $(LDADD)
+t_mul_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_mul_i_SOURCES = t-mul_i.c
+t_mul_i_OBJECTS = t-mul_i.$(OBJEXT)
+t_mul_i_LDADD = $(LDADD)
+t_mul_i_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_nextprime_SOURCES = t-nextprime.c
+t_nextprime_OBJECTS = t-nextprime.$(OBJEXT)
+t_nextprime_LDADD = $(LDADD)
+t_nextprime_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_oddeven_SOURCES = t-oddeven.c
+t_oddeven_OBJECTS = t-oddeven.$(OBJEXT)
+t_oddeven_LDADD = $(LDADD)
+t_oddeven_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_perfpow_SOURCES = t-perfpow.c
+t_perfpow_OBJECTS = t-perfpow.$(OBJEXT)
+t_perfpow_LDADD = $(LDADD)
+t_perfpow_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_perfsqr_SOURCES = t-perfsqr.c
+t_perfsqr_OBJECTS = t-perfsqr.$(OBJEXT)
+t_perfsqr_LDADD = $(LDADD)
+t_perfsqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_popcount_SOURCES = t-popcount.c
+t_popcount_OBJECTS = t-popcount.$(OBJEXT)
+t_popcount_LDADD = $(LDADD)
+t_popcount_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_pow_SOURCES = t-pow.c
+t_pow_OBJECTS = t-pow.$(OBJEXT)
+t_pow_LDADD = $(LDADD)
+t_pow_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_powm_SOURCES = t-powm.c
+t_powm_OBJECTS = t-powm.$(OBJEXT)
+t_powm_LDADD = $(LDADD)
+t_powm_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_powm_ui_SOURCES = t-powm_ui.c
+t_powm_ui_OBJECTS = t-powm_ui.$(OBJEXT)
+t_powm_ui_LDADD = $(LDADD)
+t_powm_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_pprime_p_SOURCES = t-pprime_p.c
+t_pprime_p_OBJECTS = t-pprime_p.$(OBJEXT)
+t_pprime_p_LDADD = $(LDADD)
+t_pprime_p_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_primorial_ui_SOURCES = t-primorial_ui.c
+t_primorial_ui_OBJECTS = t-primorial_ui.$(OBJEXT)
+t_primorial_ui_LDADD = $(LDADD)
+t_primorial_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_remove_SOURCES = t-remove.c
+t_remove_OBJECTS = t-remove.$(OBJEXT)
+t_remove_LDADD = $(LDADD)
+t_remove_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_root_SOURCES = t-root.c
+t_root_OBJECTS = t-root.$(OBJEXT)
+t_root_LDADD = $(LDADD)
+t_root_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_scan_SOURCES = t-scan.c
+t_scan_OBJECTS = t-scan.$(OBJEXT)
+t_scan_LDADD = $(LDADD)
+t_scan_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_set_d_SOURCES = t-set_d.c
+t_set_d_OBJECTS = t-set_d.$(OBJEXT)
+t_set_d_LDADD = $(LDADD)
+t_set_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_set_f_SOURCES = t-set_f.c
+t_set_f_OBJECTS = t-set_f.$(OBJEXT)
+t_set_f_LDADD = $(LDADD)
+t_set_f_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_set_si_SOURCES = t-set_si.c
+t_set_si_OBJECTS = t-set_si.$(OBJEXT)
+t_set_si_LDADD = $(LDADD)
+t_set_si_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_set_str_SOURCES = t-set_str.c
+t_set_str_OBJECTS = t-set_str.$(OBJEXT)
+t_set_str_LDADD = $(LDADD)
+t_set_str_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_sizeinbase_SOURCES = t-sizeinbase.c
+t_sizeinbase_OBJECTS = t-sizeinbase.$(OBJEXT)
+t_sizeinbase_LDADD = $(LDADD)
+t_sizeinbase_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_sqrtrem_SOURCES = t-sqrtrem.c
+t_sqrtrem_OBJECTS = t-sqrtrem.$(OBJEXT)
+t_sqrtrem_LDADD = $(LDADD)
+t_sqrtrem_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_tdiv_SOURCES = t-tdiv.c
+t_tdiv_OBJECTS = t-tdiv.$(OBJEXT)
+t_tdiv_LDADD = $(LDADD)
+t_tdiv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_tdiv_ui_SOURCES = t-tdiv_ui.c
+t_tdiv_ui_OBJECTS = t-tdiv_ui.$(OBJEXT)
+t_tdiv_ui_LDADD = $(LDADD)
+t_tdiv_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = convert.c dive.c dive_ui.c io.c logic.c reuse.c t-addsub.c \
+ t-aorsmul.c t-bin.c t-bit.c t-cdiv_ui.c t-cmp.c t-cmp_d.c \
+ t-cmp_si.c t-cong.c t-cong_2exp.c t-div_2exp.c t-divis.c \
+ t-divis_2exp.c t-export.c t-fac_ui.c t-fdiv.c t-fdiv_ui.c \
+ t-fib_ui.c t-fits.c t-gcd.c t-gcd_ui.c t-get_d.c \
+ t-get_d_2exp.c t-get_si.c t-hamdist.c t-import.c t-inp_str.c \
+ t-invert.c t-io_raw.c t-jac.c t-lcm.c t-limbs.c t-lucm.c \
+ t-lucnum_ui.c t-mfac_uiui.c t-mul.c t-mul_i.c t-nextprime.c \
+ t-oddeven.c t-perfpow.c t-perfsqr.c t-popcount.c t-pow.c \
+ t-powm.c t-powm_ui.c t-pprime_p.c t-primorial_ui.c t-remove.c \
+ t-root.c t-scan.c t-set_d.c t-set_f.c t-set_si.c t-set_str.c \
+ t-sizeinbase.c t-sqrtrem.c t-tdiv.c t-tdiv_ui.c
+DIST_SOURCES = convert.c dive.c dive_ui.c io.c logic.c reuse.c \
+ t-addsub.c t-aorsmul.c t-bin.c t-bit.c t-cdiv_ui.c t-cmp.c \
+ t-cmp_d.c t-cmp_si.c t-cong.c t-cong_2exp.c t-div_2exp.c \
+ t-divis.c t-divis_2exp.c t-export.c t-fac_ui.c t-fdiv.c \
+ t-fdiv_ui.c t-fib_ui.c t-fits.c t-gcd.c t-gcd_ui.c t-get_d.c \
+ t-get_d_2exp.c t-get_si.c t-hamdist.c t-import.c t-inp_str.c \
+ t-invert.c t-io_raw.c t-jac.c t-lcm.c t-limbs.c t-lucm.c \
+ t-lucnum_ui.c t-mfac_uiui.c t-mul.c t-mul_i.c t-nextprime.c \
+ t-oddeven.c t-perfpow.c t-perfsqr.c t-popcount.c t-pow.c \
+ t-powm.c t-powm_ui.c t-pprime_p.c t-primorial_ui.c t-remove.c \
+ t-root.c t-scan.c t-set_d.c t-set_f.c t-set_si.c t-set_str.c \
+ t-sizeinbase.c t-sqrtrem.c t-tdiv.c t-tdiv_ui.c
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = { \
+ $(am__tty_colors_dummy); \
+ if test "X$(AM_COLOR_TESTS)" = Xno; then \
+ am__color_tests=no; \
+ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+ am__color_tests=yes; \
+ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+ am__color_tests=yes; \
+ fi; \
+ if test $$am__color_tests = yes; then \
+ red=''; \
+ grn=''; \
+ lgn=''; \
+ blu=''; \
+ mgn=''; \
+ brg=''; \
+ std=''; \
+ fi; \
+}
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__recheck_rx = ^[ ]*:recheck:[ ]*
+am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
+am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+ recheck = 1; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ { \
+ if ((getline line2 < ($$0 ".log")) < 0) \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+ { \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+ { \
+ break; \
+ } \
+ }; \
+ if (recheck) \
+ print $$0; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+ print "fatal: making $@: " msg | "cat >&2"; \
+ exit 1; \
+} \
+function rst_section(header) \
+{ \
+ print header; \
+ len = length(header); \
+ for (i = 1; i <= len; i = i + 1) \
+ printf "="; \
+ printf "\n\n"; \
+} \
+{ \
+ copy_in_global_log = 1; \
+ global_test_result = "RUN"; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".trs"); \
+ if (line ~ /$(am__global_test_result_rx)/) \
+ { \
+ sub("$(am__global_test_result_rx)", "", line); \
+ sub("[ ]*$$", "", line); \
+ global_test_result = line; \
+ } \
+ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+ copy_in_global_log = 0; \
+ }; \
+ if (copy_in_global_log) \
+ { \
+ rst_section(global_test_result ": " $$0); \
+ while ((rc = (getline line < ($$0 ".log"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".log"); \
+ print line; \
+ }; \
+ printf "\n"; \
+ }; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+ --color-tests "$$am__color_tests" \
+ --enable-hard-errors "$$am__enable_hard_errors" \
+ --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test. Creates the
+# directory for the log if needed. Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log. Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT. Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup); \
+$(am__vpath_adj_setup) $(am__vpath_adj) \
+$(am__tty_colors); \
+srcdir=$(srcdir); export srcdir; \
+case "$@" in \
+ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \
+ *) am__odir=.;; \
+esac; \
+test "x$$am__odir" = x"." || test -d "$$am__odir" \
+ || $(MKDIR_P) "$$am__odir" || exit $$?; \
+if test -f "./$$f"; then dir=./; \
+elif test -f "$$f"; then dir=; \
+else dir="$(srcdir)/"; fi; \
+tst=$$dir$$f; log='$@'; \
+if test -n '$(DISABLE_HARD_ERRORS)'; then \
+ am__enable_hard_errors=no; \
+else \
+ am__enable_hard_errors=yes; \
+fi; \
+case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
+ am__expect_failure=yes;; \
+ *) \
+ am__expect_failure=no;; \
+esac; \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed). The result is saved in the shell variable
+# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+ bases='$(TEST_LOGS)'; \
+ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+ bases=`echo $$bases`
+RECHECK_LOGS = $(TEST_LOGS)
+AM_RECURSIVE_TARGETS = check recheck
+TEST_SUITE_LOG = test-suite.log
+TEST_EXTENSIONS = @EXEEXT@ .test
+LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
+am__set_b = \
+ case '$@' in \
+ */*) \
+ case '$*' in \
+ */*) b='$*';; \
+ *) b=`echo '$@' | sed 's/\.log$$//'`; \
+ esac;; \
+ *) \
+ b='$*';; \
+ esac
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+ $(TEST_LOG_FLAGS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/test-driver
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ABI = @ABI@
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+ASMFLAGS = @ASMFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
+CC = @CC@
+CCAS = @CCAS@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPP_FOR_BUILD = @CPP_FOR_BUILD@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
+DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
+FGREP = @FGREP@
+GMP_LDFLAGS = @GMP_LDFLAGS@
+GMP_LIMB_BITS = @GMP_LIMB_BITS@
+GMP_NAIL_BITS = @GMP_NAIL_BITS@
+GREP = @GREP@
+HAVE_CLOCK_01 = @HAVE_CLOCK_01@
+HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@
+HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@
+HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@
+HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@
+HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@
+HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@
+HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
+HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
+HAVE_STACK_T_01 = @HAVE_STACK_T_01@
+HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBCURSES = @LIBCURSES@
+LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@
+LIBGMP_DLL = @LIBGMP_DLL@
+LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@
+LIBM = @LIBM@
+LIBM_FOR_BUILD = @LIBM_FOR_BUILD@
+LIBOBJS = @LIBOBJS@
+LIBREADLINE = @LIBREADLINE@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+M4 = @M4@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
+STRIP = @STRIP@
+TAL_OBJECT = @TAL_OBJECT@
+TUNE_LIBS = @TUNE_LIBS@
+TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U_FOR_BUILD = @U_FOR_BUILD@
+VERSION = @VERSION@
+WITH_READLINE_01 = @WITH_READLINE_01@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gmp_srclinks = @gmp_srclinks@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mpn_objects = @mpn_objects@
+mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
+AM_LDFLAGS = -no-install
+LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
+TESTS = $(check_PROGRAMS)
+
+# Temporary files used by the tests. Removed automatically if the tests
+# pass, but ensure they're cleaned if they fail.
+#
+CLEANFILES = *.tmp
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/mpz/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/mpz/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+convert$(EXEEXT): $(convert_OBJECTS) $(convert_DEPENDENCIES) $(EXTRA_convert_DEPENDENCIES)
+ @rm -f convert$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(convert_OBJECTS) $(convert_LDADD) $(LIBS)
+
+dive$(EXEEXT): $(dive_OBJECTS) $(dive_DEPENDENCIES) $(EXTRA_dive_DEPENDENCIES)
+ @rm -f dive$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(dive_OBJECTS) $(dive_LDADD) $(LIBS)
+
+dive_ui$(EXEEXT): $(dive_ui_OBJECTS) $(dive_ui_DEPENDENCIES) $(EXTRA_dive_ui_DEPENDENCIES)
+ @rm -f dive_ui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(dive_ui_OBJECTS) $(dive_ui_LDADD) $(LIBS)
+
+io$(EXEEXT): $(io_OBJECTS) $(io_DEPENDENCIES) $(EXTRA_io_DEPENDENCIES)
+ @rm -f io$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(io_OBJECTS) $(io_LDADD) $(LIBS)
+
+logic$(EXEEXT): $(logic_OBJECTS) $(logic_DEPENDENCIES) $(EXTRA_logic_DEPENDENCIES)
+ @rm -f logic$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(logic_OBJECTS) $(logic_LDADD) $(LIBS)
+
+reuse$(EXEEXT): $(reuse_OBJECTS) $(reuse_DEPENDENCIES) $(EXTRA_reuse_DEPENDENCIES)
+ @rm -f reuse$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(reuse_OBJECTS) $(reuse_LDADD) $(LIBS)
+
+t-addsub$(EXEEXT): $(t_addsub_OBJECTS) $(t_addsub_DEPENDENCIES) $(EXTRA_t_addsub_DEPENDENCIES)
+ @rm -f t-addsub$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_addsub_OBJECTS) $(t_addsub_LDADD) $(LIBS)
+
+t-aorsmul$(EXEEXT): $(t_aorsmul_OBJECTS) $(t_aorsmul_DEPENDENCIES) $(EXTRA_t_aorsmul_DEPENDENCIES)
+ @rm -f t-aorsmul$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_aorsmul_OBJECTS) $(t_aorsmul_LDADD) $(LIBS)
+
+t-bin$(EXEEXT): $(t_bin_OBJECTS) $(t_bin_DEPENDENCIES) $(EXTRA_t_bin_DEPENDENCIES)
+ @rm -f t-bin$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_bin_OBJECTS) $(t_bin_LDADD) $(LIBS)
+
+t-bit$(EXEEXT): $(t_bit_OBJECTS) $(t_bit_DEPENDENCIES) $(EXTRA_t_bit_DEPENDENCIES)
+ @rm -f t-bit$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_bit_OBJECTS) $(t_bit_LDADD) $(LIBS)
+
+t-cdiv_ui$(EXEEXT): $(t_cdiv_ui_OBJECTS) $(t_cdiv_ui_DEPENDENCIES) $(EXTRA_t_cdiv_ui_DEPENDENCIES)
+ @rm -f t-cdiv_ui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_cdiv_ui_OBJECTS) $(t_cdiv_ui_LDADD) $(LIBS)
+
+t-cmp$(EXEEXT): $(t_cmp_OBJECTS) $(t_cmp_DEPENDENCIES) $(EXTRA_t_cmp_DEPENDENCIES)
+ @rm -f t-cmp$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_cmp_OBJECTS) $(t_cmp_LDADD) $(LIBS)
+
+t-cmp_d$(EXEEXT): $(t_cmp_d_OBJECTS) $(t_cmp_d_DEPENDENCIES) $(EXTRA_t_cmp_d_DEPENDENCIES)
+ @rm -f t-cmp_d$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_cmp_d_OBJECTS) $(t_cmp_d_LDADD) $(LIBS)
+
+t-cmp_si$(EXEEXT): $(t_cmp_si_OBJECTS) $(t_cmp_si_DEPENDENCIES) $(EXTRA_t_cmp_si_DEPENDENCIES)
+ @rm -f t-cmp_si$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_cmp_si_OBJECTS) $(t_cmp_si_LDADD) $(LIBS)
+
+t-cong$(EXEEXT): $(t_cong_OBJECTS) $(t_cong_DEPENDENCIES) $(EXTRA_t_cong_DEPENDENCIES)
+ @rm -f t-cong$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_cong_OBJECTS) $(t_cong_LDADD) $(LIBS)
+
+t-cong_2exp$(EXEEXT): $(t_cong_2exp_OBJECTS) $(t_cong_2exp_DEPENDENCIES) $(EXTRA_t_cong_2exp_DEPENDENCIES)
+ @rm -f t-cong_2exp$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_cong_2exp_OBJECTS) $(t_cong_2exp_LDADD) $(LIBS)
+
+t-div_2exp$(EXEEXT): $(t_div_2exp_OBJECTS) $(t_div_2exp_DEPENDENCIES) $(EXTRA_t_div_2exp_DEPENDENCIES)
+ @rm -f t-div_2exp$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_div_2exp_OBJECTS) $(t_div_2exp_LDADD) $(LIBS)
+
+t-divis$(EXEEXT): $(t_divis_OBJECTS) $(t_divis_DEPENDENCIES) $(EXTRA_t_divis_DEPENDENCIES)
+ @rm -f t-divis$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_divis_OBJECTS) $(t_divis_LDADD) $(LIBS)
+
+t-divis_2exp$(EXEEXT): $(t_divis_2exp_OBJECTS) $(t_divis_2exp_DEPENDENCIES) $(EXTRA_t_divis_2exp_DEPENDENCIES)
+ @rm -f t-divis_2exp$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_divis_2exp_OBJECTS) $(t_divis_2exp_LDADD) $(LIBS)
+
+t-export$(EXEEXT): $(t_export_OBJECTS) $(t_export_DEPENDENCIES) $(EXTRA_t_export_DEPENDENCIES)
+ @rm -f t-export$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_export_OBJECTS) $(t_export_LDADD) $(LIBS)
+
+t-fac_ui$(EXEEXT): $(t_fac_ui_OBJECTS) $(t_fac_ui_DEPENDENCIES) $(EXTRA_t_fac_ui_DEPENDENCIES)
+ @rm -f t-fac_ui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_fac_ui_OBJECTS) $(t_fac_ui_LDADD) $(LIBS)
+
+t-fdiv$(EXEEXT): $(t_fdiv_OBJECTS) $(t_fdiv_DEPENDENCIES) $(EXTRA_t_fdiv_DEPENDENCIES)
+ @rm -f t-fdiv$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_fdiv_OBJECTS) $(t_fdiv_LDADD) $(LIBS)
+
+t-fdiv_ui$(EXEEXT): $(t_fdiv_ui_OBJECTS) $(t_fdiv_ui_DEPENDENCIES) $(EXTRA_t_fdiv_ui_DEPENDENCIES)
+ @rm -f t-fdiv_ui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_fdiv_ui_OBJECTS) $(t_fdiv_ui_LDADD) $(LIBS)
+
+t-fib_ui$(EXEEXT): $(t_fib_ui_OBJECTS) $(t_fib_ui_DEPENDENCIES) $(EXTRA_t_fib_ui_DEPENDENCIES)
+ @rm -f t-fib_ui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_fib_ui_OBJECTS) $(t_fib_ui_LDADD) $(LIBS)
+
+t-fits$(EXEEXT): $(t_fits_OBJECTS) $(t_fits_DEPENDENCIES) $(EXTRA_t_fits_DEPENDENCIES)
+ @rm -f t-fits$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_fits_OBJECTS) $(t_fits_LDADD) $(LIBS)
+
+t-gcd$(EXEEXT): $(t_gcd_OBJECTS) $(t_gcd_DEPENDENCIES) $(EXTRA_t_gcd_DEPENDENCIES)
+ @rm -f t-gcd$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_gcd_OBJECTS) $(t_gcd_LDADD) $(LIBS)
+
+t-gcd_ui$(EXEEXT): $(t_gcd_ui_OBJECTS) $(t_gcd_ui_DEPENDENCIES) $(EXTRA_t_gcd_ui_DEPENDENCIES)
+ @rm -f t-gcd_ui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_gcd_ui_OBJECTS) $(t_gcd_ui_LDADD) $(LIBS)
+
+t-get_d$(EXEEXT): $(t_get_d_OBJECTS) $(t_get_d_DEPENDENCIES) $(EXTRA_t_get_d_DEPENDENCIES)
+ @rm -f t-get_d$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_get_d_OBJECTS) $(t_get_d_LDADD) $(LIBS)
+
+t-get_d_2exp$(EXEEXT): $(t_get_d_2exp_OBJECTS) $(t_get_d_2exp_DEPENDENCIES) $(EXTRA_t_get_d_2exp_DEPENDENCIES)
+ @rm -f t-get_d_2exp$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_get_d_2exp_OBJECTS) $(t_get_d_2exp_LDADD) $(LIBS)
+
+t-get_si$(EXEEXT): $(t_get_si_OBJECTS) $(t_get_si_DEPENDENCIES) $(EXTRA_t_get_si_DEPENDENCIES)
+ @rm -f t-get_si$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_get_si_OBJECTS) $(t_get_si_LDADD) $(LIBS)
+
+t-hamdist$(EXEEXT): $(t_hamdist_OBJECTS) $(t_hamdist_DEPENDENCIES) $(EXTRA_t_hamdist_DEPENDENCIES)
+ @rm -f t-hamdist$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_hamdist_OBJECTS) $(t_hamdist_LDADD) $(LIBS)
+
+t-import$(EXEEXT): $(t_import_OBJECTS) $(t_import_DEPENDENCIES) $(EXTRA_t_import_DEPENDENCIES)
+ @rm -f t-import$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_import_OBJECTS) $(t_import_LDADD) $(LIBS)
+
+t-inp_str$(EXEEXT): $(t_inp_str_OBJECTS) $(t_inp_str_DEPENDENCIES) $(EXTRA_t_inp_str_DEPENDENCIES)
+ @rm -f t-inp_str$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_inp_str_OBJECTS) $(t_inp_str_LDADD) $(LIBS)
+
+t-invert$(EXEEXT): $(t_invert_OBJECTS) $(t_invert_DEPENDENCIES) $(EXTRA_t_invert_DEPENDENCIES)
+ @rm -f t-invert$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_invert_OBJECTS) $(t_invert_LDADD) $(LIBS)
+
+t-io_raw$(EXEEXT): $(t_io_raw_OBJECTS) $(t_io_raw_DEPENDENCIES) $(EXTRA_t_io_raw_DEPENDENCIES)
+ @rm -f t-io_raw$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_io_raw_OBJECTS) $(t_io_raw_LDADD) $(LIBS)
+
+t-jac$(EXEEXT): $(t_jac_OBJECTS) $(t_jac_DEPENDENCIES) $(EXTRA_t_jac_DEPENDENCIES)
+ @rm -f t-jac$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_jac_OBJECTS) $(t_jac_LDADD) $(LIBS)
+
+t-lcm$(EXEEXT): $(t_lcm_OBJECTS) $(t_lcm_DEPENDENCIES) $(EXTRA_t_lcm_DEPENDENCIES)
+ @rm -f t-lcm$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_lcm_OBJECTS) $(t_lcm_LDADD) $(LIBS)
+
+t-limbs$(EXEEXT): $(t_limbs_OBJECTS) $(t_limbs_DEPENDENCIES) $(EXTRA_t_limbs_DEPENDENCIES)
+ @rm -f t-limbs$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_limbs_OBJECTS) $(t_limbs_LDADD) $(LIBS)
+
+t-lucm$(EXEEXT): $(t_lucm_OBJECTS) $(t_lucm_DEPENDENCIES) $(EXTRA_t_lucm_DEPENDENCIES)
+ @rm -f t-lucm$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_lucm_OBJECTS) $(t_lucm_LDADD) $(LIBS)
+
+t-lucnum_ui$(EXEEXT): $(t_lucnum_ui_OBJECTS) $(t_lucnum_ui_DEPENDENCIES) $(EXTRA_t_lucnum_ui_DEPENDENCIES)
+ @rm -f t-lucnum_ui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_lucnum_ui_OBJECTS) $(t_lucnum_ui_LDADD) $(LIBS)
+
+t-mfac_uiui$(EXEEXT): $(t_mfac_uiui_OBJECTS) $(t_mfac_uiui_DEPENDENCIES) $(EXTRA_t_mfac_uiui_DEPENDENCIES)
+ @rm -f t-mfac_uiui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_mfac_uiui_OBJECTS) $(t_mfac_uiui_LDADD) $(LIBS)
+
+t-mul$(EXEEXT): $(t_mul_OBJECTS) $(t_mul_DEPENDENCIES) $(EXTRA_t_mul_DEPENDENCIES)
+ @rm -f t-mul$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_mul_OBJECTS) $(t_mul_LDADD) $(LIBS)
+
+t-mul_i$(EXEEXT): $(t_mul_i_OBJECTS) $(t_mul_i_DEPENDENCIES) $(EXTRA_t_mul_i_DEPENDENCIES)
+ @rm -f t-mul_i$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_mul_i_OBJECTS) $(t_mul_i_LDADD) $(LIBS)
+
+t-nextprime$(EXEEXT): $(t_nextprime_OBJECTS) $(t_nextprime_DEPENDENCIES) $(EXTRA_t_nextprime_DEPENDENCIES)
+ @rm -f t-nextprime$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_nextprime_OBJECTS) $(t_nextprime_LDADD) $(LIBS)
+
+t-oddeven$(EXEEXT): $(t_oddeven_OBJECTS) $(t_oddeven_DEPENDENCIES) $(EXTRA_t_oddeven_DEPENDENCIES)
+ @rm -f t-oddeven$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_oddeven_OBJECTS) $(t_oddeven_LDADD) $(LIBS)
+
+t-perfpow$(EXEEXT): $(t_perfpow_OBJECTS) $(t_perfpow_DEPENDENCIES) $(EXTRA_t_perfpow_DEPENDENCIES)
+ @rm -f t-perfpow$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_perfpow_OBJECTS) $(t_perfpow_LDADD) $(LIBS)
+
+t-perfsqr$(EXEEXT): $(t_perfsqr_OBJECTS) $(t_perfsqr_DEPENDENCIES) $(EXTRA_t_perfsqr_DEPENDENCIES)
+ @rm -f t-perfsqr$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_perfsqr_OBJECTS) $(t_perfsqr_LDADD) $(LIBS)
+
+t-popcount$(EXEEXT): $(t_popcount_OBJECTS) $(t_popcount_DEPENDENCIES) $(EXTRA_t_popcount_DEPENDENCIES)
+ @rm -f t-popcount$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_popcount_OBJECTS) $(t_popcount_LDADD) $(LIBS)
+
+t-pow$(EXEEXT): $(t_pow_OBJECTS) $(t_pow_DEPENDENCIES) $(EXTRA_t_pow_DEPENDENCIES)
+ @rm -f t-pow$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_pow_OBJECTS) $(t_pow_LDADD) $(LIBS)
+
+t-powm$(EXEEXT): $(t_powm_OBJECTS) $(t_powm_DEPENDENCIES) $(EXTRA_t_powm_DEPENDENCIES)
+ @rm -f t-powm$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_powm_OBJECTS) $(t_powm_LDADD) $(LIBS)
+
+t-powm_ui$(EXEEXT): $(t_powm_ui_OBJECTS) $(t_powm_ui_DEPENDENCIES) $(EXTRA_t_powm_ui_DEPENDENCIES)
+ @rm -f t-powm_ui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_powm_ui_OBJECTS) $(t_powm_ui_LDADD) $(LIBS)
+
+t-pprime_p$(EXEEXT): $(t_pprime_p_OBJECTS) $(t_pprime_p_DEPENDENCIES) $(EXTRA_t_pprime_p_DEPENDENCIES)
+ @rm -f t-pprime_p$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_pprime_p_OBJECTS) $(t_pprime_p_LDADD) $(LIBS)
+
+t-primorial_ui$(EXEEXT): $(t_primorial_ui_OBJECTS) $(t_primorial_ui_DEPENDENCIES) $(EXTRA_t_primorial_ui_DEPENDENCIES)
+ @rm -f t-primorial_ui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_primorial_ui_OBJECTS) $(t_primorial_ui_LDADD) $(LIBS)
+
+t-remove$(EXEEXT): $(t_remove_OBJECTS) $(t_remove_DEPENDENCIES) $(EXTRA_t_remove_DEPENDENCIES)
+ @rm -f t-remove$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_remove_OBJECTS) $(t_remove_LDADD) $(LIBS)
+
+t-root$(EXEEXT): $(t_root_OBJECTS) $(t_root_DEPENDENCIES) $(EXTRA_t_root_DEPENDENCIES)
+ @rm -f t-root$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_root_OBJECTS) $(t_root_LDADD) $(LIBS)
+
+t-scan$(EXEEXT): $(t_scan_OBJECTS) $(t_scan_DEPENDENCIES) $(EXTRA_t_scan_DEPENDENCIES)
+ @rm -f t-scan$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_scan_OBJECTS) $(t_scan_LDADD) $(LIBS)
+
+t-set_d$(EXEEXT): $(t_set_d_OBJECTS) $(t_set_d_DEPENDENCIES) $(EXTRA_t_set_d_DEPENDENCIES)
+ @rm -f t-set_d$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_set_d_OBJECTS) $(t_set_d_LDADD) $(LIBS)
+
+t-set_f$(EXEEXT): $(t_set_f_OBJECTS) $(t_set_f_DEPENDENCIES) $(EXTRA_t_set_f_DEPENDENCIES)
+ @rm -f t-set_f$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_set_f_OBJECTS) $(t_set_f_LDADD) $(LIBS)
+
+t-set_si$(EXEEXT): $(t_set_si_OBJECTS) $(t_set_si_DEPENDENCIES) $(EXTRA_t_set_si_DEPENDENCIES)
+ @rm -f t-set_si$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_set_si_OBJECTS) $(t_set_si_LDADD) $(LIBS)
+
+t-set_str$(EXEEXT): $(t_set_str_OBJECTS) $(t_set_str_DEPENDENCIES) $(EXTRA_t_set_str_DEPENDENCIES)
+ @rm -f t-set_str$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_set_str_OBJECTS) $(t_set_str_LDADD) $(LIBS)
+
+t-sizeinbase$(EXEEXT): $(t_sizeinbase_OBJECTS) $(t_sizeinbase_DEPENDENCIES) $(EXTRA_t_sizeinbase_DEPENDENCIES)
+ @rm -f t-sizeinbase$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_sizeinbase_OBJECTS) $(t_sizeinbase_LDADD) $(LIBS)
+
+t-sqrtrem$(EXEEXT): $(t_sqrtrem_OBJECTS) $(t_sqrtrem_DEPENDENCIES) $(EXTRA_t_sqrtrem_DEPENDENCIES)
+ @rm -f t-sqrtrem$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_sqrtrem_OBJECTS) $(t_sqrtrem_LDADD) $(LIBS)
+
+t-tdiv$(EXEEXT): $(t_tdiv_OBJECTS) $(t_tdiv_DEPENDENCIES) $(EXTRA_t_tdiv_DEPENDENCIES)
+ @rm -f t-tdiv$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_tdiv_OBJECTS) $(t_tdiv_LDADD) $(LIBS)
+
+t-tdiv_ui$(EXEEXT): $(t_tdiv_ui_OBJECTS) $(t_tdiv_ui_DEPENDENCIES) $(EXTRA_t_tdiv_ui_DEPENDENCIES)
+ @rm -f t-tdiv_ui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_tdiv_ui_OBJECTS) $(t_tdiv_ui_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+.c.o:
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+ $(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+ rm -f $< $@
+ $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+ @:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+ @$(am__set_TESTS_bases); \
+ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+ redo_bases=`for i in $$bases; do \
+ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+ done`; \
+ if test -n "$$redo_bases"; then \
+ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+ if $(am__make_dryrun); then :; else \
+ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+ fi; \
+ fi; \
+ if test -n "$$am__remaking_logs"; then \
+ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+ "recursion detected" >&2; \
+ elif test -n "$$redo_logs"; then \
+ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+ fi; \
+ if $(am__make_dryrun); then :; else \
+ st=0; \
+ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+ for i in $$redo_bases; do \
+ test -f $$i.trs && test -r $$i.trs \
+ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+ test -f $$i.log && test -r $$i.log \
+ || { echo "$$errmsg $$i.log" >&2; st=1; }; \
+ done; \
+ test $$st -eq 0 || exit 1; \
+ fi
+ @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+ ws='[ ]'; \
+ results=`for b in $$bases; do echo $$b.trs; done`; \
+ test -n "$$results" || results=/dev/null; \
+ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
+ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \
+ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \
+ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \
+ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+ if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+ success=true; \
+ else \
+ success=false; \
+ fi; \
+ br='==================='; br=$$br$$br$$br$$br; \
+ result_count () \
+ { \
+ if test x"$$1" = x"--maybe-color"; then \
+ maybe_colorize=yes; \
+ elif test x"$$1" = x"--no-color"; then \
+ maybe_colorize=no; \
+ else \
+ echo "$@: invalid 'result_count' usage" >&2; exit 4; \
+ fi; \
+ shift; \
+ desc=$$1 count=$$2; \
+ if test $$maybe_colorize = yes && test $$count -gt 0; then \
+ color_start=$$3 color_end=$$std; \
+ else \
+ color_start= color_end=; \
+ fi; \
+ echo "$${color_start}# $$desc $$count$${color_end}"; \
+ }; \
+ create_testsuite_report () \
+ { \
+ result_count $$1 "TOTAL:" $$all "$$brg"; \
+ result_count $$1 "PASS: " $$pass "$$grn"; \
+ result_count $$1 "SKIP: " $$skip "$$blu"; \
+ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+ result_count $$1 "FAIL: " $$fail "$$red"; \
+ result_count $$1 "XPASS:" $$xpass "$$red"; \
+ result_count $$1 "ERROR:" $$error "$$mgn"; \
+ }; \
+ { \
+ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
+ $(am__rst_title); \
+ create_testsuite_report --no-color; \
+ echo; \
+ echo ".. contents:: :depth: 2"; \
+ echo; \
+ for b in $$bases; do echo $$b; done \
+ | $(am__create_global_log); \
+ } >$(TEST_SUITE_LOG).tmp || exit 1; \
+ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
+ if $$success; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
+ fi; \
+ echo "$${col}$$br$${std}"; \
+ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \
+ echo "$${col}$$br$${std}"; \
+ create_testsuite_report --maybe-color; \
+ echo "$$col$$br$$std"; \
+ if $$success; then :; else \
+ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \
+ if test -n "$(PACKAGE_BUGREPORT)"; then \
+ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+ fi; \
+ echo "$$col$$br$$std"; \
+ fi; \
+ $$success || exit 1
+
+check-TESTS:
+ @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
+ @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+ exit $$?;
+recheck: all $(check_PROGRAMS)
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ bases=`for i in $$bases; do echo $$i; done \
+ | $(am__list_recheck_tests)` || exit 1; \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ log_list=`echo $$log_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+ am__force_recheck=am--force-recheck \
+ TEST_LOGS="$$log_list"; \
+ exit $$?
+reuse.log: reuse$(EXEEXT)
+ @p='reuse$(EXEEXT)'; \
+ b='reuse'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-addsub.log: t-addsub$(EXEEXT)
+ @p='t-addsub$(EXEEXT)'; \
+ b='t-addsub'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-cmp.log: t-cmp$(EXEEXT)
+ @p='t-cmp$(EXEEXT)'; \
+ b='t-cmp'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-mul.log: t-mul$(EXEEXT)
+ @p='t-mul$(EXEEXT)'; \
+ b='t-mul'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-mul_i.log: t-mul_i$(EXEEXT)
+ @p='t-mul_i$(EXEEXT)'; \
+ b='t-mul_i'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-tdiv.log: t-tdiv$(EXEEXT)
+ @p='t-tdiv$(EXEEXT)'; \
+ b='t-tdiv'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-tdiv_ui.log: t-tdiv_ui$(EXEEXT)
+ @p='t-tdiv_ui$(EXEEXT)'; \
+ b='t-tdiv_ui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-fdiv.log: t-fdiv$(EXEEXT)
+ @p='t-fdiv$(EXEEXT)'; \
+ b='t-fdiv'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-fdiv_ui.log: t-fdiv_ui$(EXEEXT)
+ @p='t-fdiv_ui$(EXEEXT)'; \
+ b='t-fdiv_ui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-cdiv_ui.log: t-cdiv_ui$(EXEEXT)
+ @p='t-cdiv_ui$(EXEEXT)'; \
+ b='t-cdiv_ui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-gcd.log: t-gcd$(EXEEXT)
+ @p='t-gcd$(EXEEXT)'; \
+ b='t-gcd'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-gcd_ui.log: t-gcd_ui$(EXEEXT)
+ @p='t-gcd_ui$(EXEEXT)'; \
+ b='t-gcd_ui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-lcm.log: t-lcm$(EXEEXT)
+ @p='t-lcm$(EXEEXT)'; \
+ b='t-lcm'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-invert.log: t-invert$(EXEEXT)
+ @p='t-invert$(EXEEXT)'; \
+ b='t-invert'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+dive.log: dive$(EXEEXT)
+ @p='dive$(EXEEXT)'; \
+ b='dive'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+dive_ui.log: dive_ui$(EXEEXT)
+ @p='dive_ui$(EXEEXT)'; \
+ b='dive_ui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-sqrtrem.log: t-sqrtrem$(EXEEXT)
+ @p='t-sqrtrem$(EXEEXT)'; \
+ b='t-sqrtrem'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+convert.log: convert$(EXEEXT)
+ @p='convert$(EXEEXT)'; \
+ b='convert'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+io.log: io$(EXEEXT)
+ @p='io$(EXEEXT)'; \
+ b='io'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-inp_str.log: t-inp_str$(EXEEXT)
+ @p='t-inp_str$(EXEEXT)'; \
+ b='t-inp_str'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+logic.log: logic$(EXEEXT)
+ @p='logic$(EXEEXT)'; \
+ b='logic'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-bit.log: t-bit$(EXEEXT)
+ @p='t-bit$(EXEEXT)'; \
+ b='t-bit'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-powm.log: t-powm$(EXEEXT)
+ @p='t-powm$(EXEEXT)'; \
+ b='t-powm'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-powm_ui.log: t-powm_ui$(EXEEXT)
+ @p='t-powm_ui$(EXEEXT)'; \
+ b='t-powm_ui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-pow.log: t-pow$(EXEEXT)
+ @p='t-pow$(EXEEXT)'; \
+ b='t-pow'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-div_2exp.log: t-div_2exp$(EXEEXT)
+ @p='t-div_2exp$(EXEEXT)'; \
+ b='t-div_2exp'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-root.log: t-root$(EXEEXT)
+ @p='t-root$(EXEEXT)'; \
+ b='t-root'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-perfsqr.log: t-perfsqr$(EXEEXT)
+ @p='t-perfsqr$(EXEEXT)'; \
+ b='t-perfsqr'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-perfpow.log: t-perfpow$(EXEEXT)
+ @p='t-perfpow$(EXEEXT)'; \
+ b='t-perfpow'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-jac.log: t-jac$(EXEEXT)
+ @p='t-jac$(EXEEXT)'; \
+ b='t-jac'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-bin.log: t-bin$(EXEEXT)
+ @p='t-bin$(EXEEXT)'; \
+ b='t-bin'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-get_d.log: t-get_d$(EXEEXT)
+ @p='t-get_d$(EXEEXT)'; \
+ b='t-get_d'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-get_d_2exp.log: t-get_d_2exp$(EXEEXT)
+ @p='t-get_d_2exp$(EXEEXT)'; \
+ b='t-get_d_2exp'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-get_si.log: t-get_si$(EXEEXT)
+ @p='t-get_si$(EXEEXT)'; \
+ b='t-get_si'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-set_d.log: t-set_d$(EXEEXT)
+ @p='t-set_d$(EXEEXT)'; \
+ b='t-set_d'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-set_si.log: t-set_si$(EXEEXT)
+ @p='t-set_si$(EXEEXT)'; \
+ b='t-set_si'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-lucm.log: t-lucm$(EXEEXT)
+ @p='t-lucm$(EXEEXT)'; \
+ b='t-lucm'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-fac_ui.log: t-fac_ui$(EXEEXT)
+ @p='t-fac_ui$(EXEEXT)'; \
+ b='t-fac_ui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-mfac_uiui.log: t-mfac_uiui$(EXEEXT)
+ @p='t-mfac_uiui$(EXEEXT)'; \
+ b='t-mfac_uiui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-primorial_ui.log: t-primorial_ui$(EXEEXT)
+ @p='t-primorial_ui$(EXEEXT)'; \
+ b='t-primorial_ui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-fib_ui.log: t-fib_ui$(EXEEXT)
+ @p='t-fib_ui$(EXEEXT)'; \
+ b='t-fib_ui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-lucnum_ui.log: t-lucnum_ui$(EXEEXT)
+ @p='t-lucnum_ui$(EXEEXT)'; \
+ b='t-lucnum_ui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-scan.log: t-scan$(EXEEXT)
+ @p='t-scan$(EXEEXT)'; \
+ b='t-scan'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-fits.log: t-fits$(EXEEXT)
+ @p='t-fits$(EXEEXT)'; \
+ b='t-fits'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-divis.log: t-divis$(EXEEXT)
+ @p='t-divis$(EXEEXT)'; \
+ b='t-divis'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-divis_2exp.log: t-divis_2exp$(EXEEXT)
+ @p='t-divis_2exp$(EXEEXT)'; \
+ b='t-divis_2exp'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-cong.log: t-cong$(EXEEXT)
+ @p='t-cong$(EXEEXT)'; \
+ b='t-cong'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-cong_2exp.log: t-cong_2exp$(EXEEXT)
+ @p='t-cong_2exp$(EXEEXT)'; \
+ b='t-cong_2exp'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-sizeinbase.log: t-sizeinbase$(EXEEXT)
+ @p='t-sizeinbase$(EXEEXT)'; \
+ b='t-sizeinbase'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-set_str.log: t-set_str$(EXEEXT)
+ @p='t-set_str$(EXEEXT)'; \
+ b='t-set_str'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-aorsmul.log: t-aorsmul$(EXEEXT)
+ @p='t-aorsmul$(EXEEXT)'; \
+ b='t-aorsmul'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-cmp_d.log: t-cmp_d$(EXEEXT)
+ @p='t-cmp_d$(EXEEXT)'; \
+ b='t-cmp_d'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-cmp_si.log: t-cmp_si$(EXEEXT)
+ @p='t-cmp_si$(EXEEXT)'; \
+ b='t-cmp_si'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-hamdist.log: t-hamdist$(EXEEXT)
+ @p='t-hamdist$(EXEEXT)'; \
+ b='t-hamdist'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-oddeven.log: t-oddeven$(EXEEXT)
+ @p='t-oddeven$(EXEEXT)'; \
+ b='t-oddeven'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-popcount.log: t-popcount$(EXEEXT)
+ @p='t-popcount$(EXEEXT)'; \
+ b='t-popcount'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-set_f.log: t-set_f$(EXEEXT)
+ @p='t-set_f$(EXEEXT)'; \
+ b='t-set_f'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-io_raw.log: t-io_raw$(EXEEXT)
+ @p='t-io_raw$(EXEEXT)'; \
+ b='t-io_raw'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-import.log: t-import$(EXEEXT)
+ @p='t-import$(EXEEXT)'; \
+ b='t-import'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-export.log: t-export$(EXEEXT)
+ @p='t-export$(EXEEXT)'; \
+ b='t-export'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-pprime_p.log: t-pprime_p$(EXEEXT)
+ @p='t-pprime_p$(EXEEXT)'; \
+ b='t-pprime_p'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-nextprime.log: t-nextprime$(EXEEXT)
+ @p='t-nextprime$(EXEEXT)'; \
+ b='t-nextprime'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-remove.log: t-remove$(EXEEXT)
+ @p='t-remove$(EXEEXT)'; \
+ b='t-remove'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-limbs.log: t-limbs$(EXEEXT)
+ @p='t-limbs$(EXEEXT)'; \
+ b='t-limbs'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+.test.log:
+ @p='$<'; \
+ $(am__set_b); \
+ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+@am__EXEEXT_TRUE@.test$(EXEEXT).log:
+@am__EXEEXT_TRUE@ @p='$<'; \
+@am__EXEEXT_TRUE@ $(am__set_b); \
+@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
+@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+ -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+ -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+ -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
+ ctags ctags-am distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ recheck tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/vendor/gmp-6.3.0/tests/mpz/convert.c b/vendor/gmp-6.3.0/tests/mpz/convert.c
new file mode 100644
index 0000000..c449c66
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/convert.c
@@ -0,0 +1,186 @@
+/* Test conversion using mpz_get_str and mpz_set_str.
+
+Copyright 1993, 1994, 1996, 1999-2002, 2006, 2007, 2020 Free Software
+Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h> /* for strlen */
+#include <ctype.h> /* for tolower */
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+void debug_mp (mpz_t, int);
+
+static int str_casecmp (const char *, const char *);
+
+void
+string_urandomb (char *bp, size_t len, int base, gmp_randstate_ptr rands)
+{
+ mpz_t bs;
+ unsigned long bsi;
+ int d, l;
+ const char *collseq = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+
+ mpz_init (bs);
+
+ mpz_urandomb (bs, rands, 32);
+ bsi = mpz_get_ui (bs);
+ d = bsi % base;
+ while (len != 0)
+ {
+ l = (bsi >> 16) % 20;
+ l = MIN (l, len);
+
+ memset (bp, collseq[d], l);
+
+ len -= l;
+ bp += l;
+
+ mpz_urandomb (bs, rands, 32);
+ bsi = mpz_get_ui (bs);
+ d = bsi & 0xfff;
+ if (d >= base)
+ d = 0;
+ }
+
+ bp[0] = '\0';
+ mpz_clear (bs);
+}
+
+int
+main (int argc, char **argv)
+{
+ mpz_t op1, op2;
+ mp_size_t size;
+ int i;
+ int reps = 2000;
+ char *str, *buf, *bp;
+ int base;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+ size_t len;
+
+ tests_start ();
+ TESTS_REPS (reps, argv, argc);
+
+ rands = RANDS;
+
+ mpz_init (bs);
+
+ mpz_init (op1);
+ mpz_init (op2);
+
+ for (i = 0; i < reps; i++)
+ {
+ /* 1. Generate random mpz_t and convert to a string and back to mpz_t
+ again. */
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 17 + 2; /* 2..18 */
+ mpz_urandomb (bs, rands, size_range); /* 3..262144 bits */
+ size = mpz_get_ui (bs);
+ mpz_rrandomb (op1, rands, size);
+
+ mpz_urandomb (bs, rands, 1);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 1) != 0)
+ mpz_neg (op1, op1);
+
+ mpz_urandomb (bs, rands, 32);
+ bsi = mpz_get_ui (bs);
+ base = bsi % 62 + 1;
+ if (base == 1)
+ base = 0;
+
+ str = mpz_get_str ((char *) 0, base, op1);
+ mpz_set_str_or_abort (op2, str, base);
+
+ if (mpz_cmp (op1, op2))
+ {
+ fprintf (stderr, "ERROR, op1 and op2 different in test %d\n", i);
+ fprintf (stderr, "str = %s\n", str);
+ fprintf (stderr, "base = %d\n", base);
+ fprintf (stderr, "op1 = "); debug_mp (op1, -16);
+ fprintf (stderr, "op2 = "); debug_mp (op2, -16);
+ abort ();
+ }
+
+ (*__gmp_free_func) (str, strlen (str) + 1);
+
+ /* 2. Generate random string and convert to mpz_t and back to a string
+ again. */
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 16 + 1; /* 1..16 */
+ mpz_urandomb (bs, rands, size_range); /* 1..65536 digits */
+ len = mpz_get_ui (bs) + 1;
+ buf = (char *) (*__gmp_allocate_func) (len + 1);
+ if (base == 0)
+ base = 10;
+ string_urandomb (buf, len, base, rands);
+
+ mpz_set_str_or_abort (op1, buf, base);
+ str = mpz_get_str ((char *) 0, base, op1);
+
+ /* Skip over leading zeros, but don't leave the string at zero length. */
+ for (bp = buf; bp[0] == '0' && bp[1] != '\0'; bp++)
+ ;
+
+ if (str_casecmp (str, bp) != 0)
+ {
+ fprintf (stderr, "ERROR, str and buf different in test %d\n", i);
+ fprintf (stderr, "str = %s\n", str);
+ fprintf (stderr, "buf = %s\n", buf);
+ fprintf (stderr, "base = %d\n", base);
+ fprintf (stderr, "op1 = "); debug_mp (op1, -16);
+ abort ();
+ }
+
+ (*__gmp_free_func) (buf, len + 1);
+ (*__gmp_free_func) (str, strlen (str) + 1);
+ }
+
+ mpz_clear (bs);
+ mpz_clear (op1);
+ mpz_clear (op2);
+
+ tests_end ();
+ exit (0);
+}
+
+/* This is similar to POSIX strcasecmp except that we don't do the comparison
+ with unsigned char. We avoid strcasecmp for C standard conformance. */
+static int
+str_casecmp (const char *s1, const char *s2)
+{
+ size_t i;
+ for (i = 0;; i++)
+ {
+ int c1 = s1[i];
+ int c2 = s2[i];
+ if (c1 == 0 || tolower (c1) != tolower (c2))
+ return c1 - c2;
+ }
+}
+
+void
+debug_mp (mpz_t x, int base)
+{
+ mpz_out_str (stderr, base, x); fputc ('\n', stderr);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/dive.c b/vendor/gmp-6.3.0/tests/mpz/dive.c
new file mode 100644
index 0000000..99e8caf
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/dive.c
@@ -0,0 +1,100 @@
+/* Test mpz_mul, mpz_divexact.
+
+Copyright 1996, 2001, 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+int
+main (int argc, char **argv)
+{
+ mpz_t op1, op2;
+ mpz_t prod, quot;
+ mp_size_t size;
+ int i;
+ int reps = 5000;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+
+ tests_start ();
+ TESTS_REPS (reps, argv, argc);
+
+ rands = RANDS;
+
+ mp_trace_base = -16;
+
+ mpz_init (bs);
+
+ mpz_init (op1);
+ mpz_init (op2);
+ mpz_init (prod);
+ mpz_init (quot);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 17 + 2; /* 0..2047 bit operands */
+
+ mpz_urandomb (bs, rands, size_range);
+ size = mpz_get_ui (bs);
+ mpz_rrandomb (op1, rands, size);
+
+ do
+ {
+ mpz_urandomb (bs, rands, size_range);
+ size = mpz_get_ui (bs);
+ mpz_rrandomb (op2, rands, size);
+ }
+ while (mpz_sgn (op2) == 0);
+
+ mpz_urandomb (bs, rands, 2);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 1) != 0)
+ mpz_neg (op1, op1);
+ if ((bsi & 2) != 0)
+ mpz_neg (op2, op2);
+
+ mpz_mul (prod, op1, op2);
+
+ mpz_divexact (quot, prod, op2);
+ MPZ_CHECK_FORMAT (quot);
+
+ if (mpz_cmp (quot, op1) != 0)
+ {
+ printf ("Wrong results:\n");
+ mpz_trace (" got ", quot);
+ mpz_trace (" want ", op1);
+ mpz_trace (" dividend", prod);
+ mpz_trace (" divisor ", op2);
+ abort ();
+ }
+ }
+
+ mpz_clear (bs);
+ mpz_clear (op1);
+ mpz_clear (op2);
+ mpz_clear (prod);
+ mpz_clear (quot);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/dive_ui.c b/vendor/gmp-6.3.0/tests/mpz/dive_ui.c
new file mode 100644
index 0000000..8f74bce
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/dive_ui.c
@@ -0,0 +1,86 @@
+/* Test mpz_divexact_ui.
+
+Copyright 1996, 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_random (int argc, char *argv[])
+{
+ gmp_randstate_ptr rands = RANDS;
+ int reps = 500000;
+ mpz_t a, q, got;
+ int i, qneg;
+ unsigned long d;
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpz_init (a);
+ mpz_init (q);
+ mpz_init (got);
+
+ for (i = 0; i < reps; i++)
+ {
+ do
+ d = (unsigned long) urandom();
+ while (d == 0);
+ mpz_erandomb (q, rands, 512);
+ mpz_mul_ui (a, q, d);
+
+ for (qneg = 0; qneg <= 1; qneg++)
+ {
+ mpz_divexact_ui (got, a, d);
+ MPZ_CHECK_FORMAT (got);
+ if (mpz_cmp (got, q) != 0)
+ {
+ printf ("mpz_divexact_ui wrong\n");
+ mpz_trace (" a", a);
+ printf (" d=%lu\n", d);
+ mpz_trace (" q", q);
+ mpz_trace (" got", got);
+ abort ();
+ }
+
+ mpz_neg (q, q);
+ mpz_neg (a, a);
+ }
+
+ }
+
+ mpz_clear (a);
+ mpz_clear (q);
+ mpz_clear (got);
+}
+
+
+int
+main (int argc, char **argv)
+{
+ tests_start ();
+
+ check_random (argc, argv);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/io.c b/vendor/gmp-6.3.0/tests/mpz/io.c
new file mode 100644
index 0000000..3522e9d
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/io.c
@@ -0,0 +1,151 @@
+/* Test conversion and I/O using mpz_out_str and mpz_inp_str.
+
+Copyright 1993, 1994, 1996, 2000, 2001, 2012, 2020 Free Software
+Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#if HAVE_UNISTD_H
+#include <unistd.h> /* for unlink */
+#endif
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#define FILENAME "io.tmp"
+
+void
+debug_mp (mpz_t x, int base)
+{
+ mpz_out_str (stdout, base, x); fputc ('\n', stdout);
+}
+
+int
+main (int argc, char **argv)
+{
+ mpz_t op1, op2;
+ mp_size_t size;
+ int i;
+ int reps = 10000;
+ FILE *fp;
+ int base, base_out;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+ size_t nread;
+
+ tests_start ();
+ rands = RANDS;
+
+ mpz_init (bs);
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpz_init (op1);
+ mpz_init (op2);
+
+ fp = fopen (FILENAME, "w+");
+
+ if (mpz_out_str (fp, 63, op1) != 0)
+ {
+ printf ("mpz_out_str did not return 0 (error) with base > 62\n");
+ abort ();
+ }
+
+ if (mpz_out_str (fp, -37, op1) != 0)
+ {
+ printf ("mpz_out_str did not return 0 (error) with base < -37\n");
+ abort ();
+ }
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 10 + 2;
+
+ mpz_urandomb (bs, rands, size_range);
+ size = mpz_get_ui (bs);
+ mpz_rrandomb (op1, rands, size);
+ mpz_urandomb (bs, rands, 1);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 1) != 0)
+ mpz_neg (op1, op1);
+
+ mpz_urandomb (bs, rands, 16);
+ bsi = mpz_get_ui (bs);
+ base = bsi % 62 + 1;
+ if (base == 1)
+ base = 0;
+
+ if (i % 2 == 0 && base <= 36)
+ base_out = -base;
+ else
+ base_out = base;
+
+ rewind (fp);
+ if (mpz_out_str (fp, base_out, op1) == 0
+ || putc (' ', fp) == EOF
+ || fflush (fp) != 0)
+ {
+ printf ("mpz_out_str write error\n");
+ abort ();
+ }
+
+ rewind (fp);
+ nread = mpz_inp_str (op2, fp, base);
+ if (nread == 0)
+ {
+ if (ferror (fp))
+ printf ("mpz_inp_str stream read error\n");
+ else
+ printf ("mpz_inp_str data conversion error\n");
+ abort ();
+ }
+
+ if (nread != ftell(fp))
+ {
+ printf ("mpz_inp_str nread doesn't match ftell\n");
+ printf (" nread %lu\n", (unsigned long) nread);
+ printf (" ftell %ld\n", ftell(fp));
+ abort ();
+ }
+
+ if (mpz_cmp (op1, op2))
+ {
+ printf ("ERROR\n");
+ printf ("op1 = "); debug_mp (op1, -16);
+ printf ("op2 = "); debug_mp (op2, -16);
+ printf ("base = %d\n", base);
+ abort ();
+ }
+ }
+
+ fclose (fp);
+
+ unlink (FILENAME);
+
+ mpz_clear (bs);
+ mpz_clear (op1);
+ mpz_clear (op2);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/logic.c b/vendor/gmp-6.3.0/tests/mpz/logic.c
new file mode 100644
index 0000000..f3b38b1
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/logic.c
@@ -0,0 +1,194 @@
+/* Test mpz_com, mpz_and, mpz_ior, and mpz_xor.
+
+Copyright 1993, 1994, 1996, 1997, 2001, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+void dump_abort (void);
+void debug_mp (mpz_t, int);
+
+int
+main (int argc, char **argv)
+{
+ mpz_t x, y, r1, r2;
+ mpz_t t1, t2, t3;
+ mp_size_t xsize, ysize;
+ int i;
+ int reps = 100000;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+
+ tests_start ();
+ rands = RANDS;
+
+ mpz_init (bs);
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpz_init (x);
+ mpz_init (y);
+ mpz_init (r1);
+ mpz_init (r2);
+ mpz_init (t1);
+ mpz_init (t2);
+ mpz_init (t3);
+
+ mpz_set_si (x, -1);
+ mpz_set_ui (y, 0);
+ for (i = 0; i < 300; i++)
+ {
+ mpz_mul_2exp (x, x, 1);
+
+ mpz_and (r1, x, x);
+ MPZ_CHECK_FORMAT (r1);
+ if (mpz_cmp (r1, x) != 0)
+ dump_abort ();
+
+ mpz_ior (r2, x, x);
+ MPZ_CHECK_FORMAT (r2);
+ if (mpz_cmp (r2, x) != 0)
+ dump_abort ();
+
+ mpz_xor (t1, x, x);
+ MPZ_CHECK_FORMAT (t1);
+ if (mpz_cmp_si (t1, 0) != 0)
+ dump_abort ();
+
+ mpz_ior (t1, x, y);
+ MPZ_CHECK_FORMAT (t1);
+ if (mpz_cmp (t1, x) != 0)
+ dump_abort ();
+
+ mpz_xor (t2, x, y);
+ MPZ_CHECK_FORMAT (t2);
+ if (mpz_cmp (t2, x) != 0)
+ dump_abort ();
+
+ mpz_com (t2, x);
+ MPZ_CHECK_FORMAT (t2);
+ mpz_xor (t3, t2, x);
+ MPZ_CHECK_FORMAT (t3);
+ if (mpz_cmp_si (t3, -1) != 0)
+ dump_abort ();
+ }
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 8 + 2;
+
+ mpz_urandomb (bs, rands, size_range);
+ xsize = mpz_get_ui (bs);
+ mpz_rrandomb (x, rands, xsize);
+ mpz_urandomb (bs, rands, 1);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 1) != 0)
+ mpz_neg (x, x);
+
+ mpz_urandomb (bs, rands, size_range);
+ ysize = mpz_get_ui (bs);
+ mpz_rrandomb (y, rands, ysize);
+ mpz_urandomb (bs, rands, 1);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 1) != 0)
+ mpz_neg (y, y);
+
+ mpz_com (r1, x);
+ MPZ_CHECK_FORMAT (r1);
+ mpz_com (r1, r1);
+ MPZ_CHECK_FORMAT (r1);
+ if (mpz_cmp (r1, x) != 0)
+ dump_abort ();
+
+ mpz_com (r1, y);
+ MPZ_CHECK_FORMAT (r1);
+ mpz_com (r2, r1);
+ MPZ_CHECK_FORMAT (r2);
+ if (mpz_cmp (r2, y) != 0)
+ dump_abort ();
+
+ mpz_com (t1, x);
+ MPZ_CHECK_FORMAT (t1);
+ mpz_com (t2, y);
+ MPZ_CHECK_FORMAT (t2);
+ mpz_and (t3, t1, t2);
+ MPZ_CHECK_FORMAT (t3);
+ mpz_com (r1, t3);
+ MPZ_CHECK_FORMAT (r1);
+ mpz_ior (r2, x, y);
+ MPZ_CHECK_FORMAT (r2);
+ if (mpz_cmp (r1, r2) != 0)
+ dump_abort ();
+
+ mpz_com (t1, x);
+ MPZ_CHECK_FORMAT (t1);
+ mpz_com (t2, y);
+ MPZ_CHECK_FORMAT (t2);
+ mpz_ior (t3, t1, t2);
+ MPZ_CHECK_FORMAT (t3);
+ mpz_com (r1, t3);
+ MPZ_CHECK_FORMAT (r1);
+ mpz_and (r2, x, y);
+ MPZ_CHECK_FORMAT (r2);
+ if (mpz_cmp (r1, r2) != 0)
+ dump_abort ();
+
+ mpz_ior (t1, x, y);
+ MPZ_CHECK_FORMAT (t1);
+ mpz_and (t2, x, y);
+ MPZ_CHECK_FORMAT (t2);
+ mpz_com (t3, t2);
+ MPZ_CHECK_FORMAT (t3);
+ mpz_and (r1, t1, t3);
+ MPZ_CHECK_FORMAT (r1);
+ mpz_xor (r2, x, y);
+ MPZ_CHECK_FORMAT (r2);
+ if (mpz_cmp (r1, r2) != 0)
+ dump_abort ();
+ }
+
+ mpz_clear (bs);
+ mpz_clear (x);
+ mpz_clear (y);
+ mpz_clear (r1);
+ mpz_clear (r2);
+ mpz_clear (t1);
+ mpz_clear (t2);
+ mpz_clear (t3);
+
+ tests_end ();
+ exit (0);
+}
+
+void
+dump_abort ()
+{
+ abort();
+}
+
+void
+debug_mp (mpz_t x, int base)
+{
+ mpz_out_str (stderr, base, x); fputc ('\n', stderr);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/reuse.c b/vendor/gmp-6.3.0/tests/mpz/reuse.c
new file mode 100644
index 0000000..a8f2201
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/reuse.c
@@ -0,0 +1,786 @@
+/* Test that routines allow reusing a source variable as destination.
+
+ Test all relevant functions except:
+ mpz_bin_ui
+ mpz_nextprime
+ mpz_mul_si
+ mpz_addmul_ui (should this really allow a+=a*c?)
+
+Copyright 1996, 1999-2002, 2009, 2012, 2013, 2016, 2020 Free Software
+Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#if __GMP_LIBGMP_DLL
+
+/* FIXME: When linking to a DLL libgmp, mpz_add etc can't be used as
+ initializers for global variables because they're effectively global
+ variables (function pointers) themselves. Perhaps calling a test
+ function successively with mpz_add etc would be better. */
+
+int
+main (void)
+{
+ printf ("Test suppressed for windows DLL\n");
+ exit (0);
+}
+
+
+#else /* ! DLL_EXPORT */
+
+void dump (const char *, mpz_t, mpz_t, mpz_t);
+
+typedef void (*dss_func) (mpz_ptr, mpz_srcptr, mpz_srcptr);
+typedef void (*dsi_func) (mpz_ptr, mpz_srcptr, unsigned long int);
+typedef unsigned long int (*dsi_div_func) (mpz_ptr, mpz_srcptr, unsigned long int);
+typedef unsigned long int (*ddsi_div_func) (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
+typedef void (*ddss_div_func) (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
+typedef void (*ds_func) (mpz_ptr, mpz_srcptr);
+
+
+void
+mpz_xinvert (mpz_ptr r, mpz_srcptr a, mpz_srcptr b)
+{
+ int res;
+ res = mpz_invert (r, a, b);
+ if (res == 0)
+ mpz_set_ui (r, 0);
+}
+
+struct {
+ dss_func fptr;
+ const char *fname;
+ int isdivision;
+ int isslow;
+} static dss[] =
+ { { mpz_add, "mpz_add", 0, 0 },
+ { mpz_sub, "mpz_sub", 0, 0 },
+ { mpz_mul, "mpz_mul", 0, 0 },
+ { mpz_cdiv_q, "mpz_cdiv_q", 1, 0 },
+ { mpz_cdiv_r, "mpz_cdiv_r", 1, 0 },
+ { mpz_fdiv_q, "mpz_fdiv_q", 1, 0 },
+ { mpz_fdiv_r, "mpz_fdiv_r", 1, 0 },
+ { mpz_tdiv_q, "mpz_tdiv_q", 1, 0 },
+ { mpz_tdiv_r, "mpz_tdiv_r", 1, 0 },
+ { mpz_mod, "mpz_mod", 1, 0 },
+ { mpz_xinvert, "mpz_xinvert", 1, 1 },
+ { mpz_gcd, "mpz_gcd", 0, 1 },
+ { mpz_lcm, "mpz_lcm", 0, 1 },
+ { mpz_and, "mpz_and", 0, 0 },
+ { mpz_ior, "mpz_ior", 0, 0 },
+ { mpz_xor, "mpz_xor", 0, 0 }
+ };
+
+
+struct {
+ dsi_func fptr;
+ const char *fname;
+ int mod;
+} static dsi[] =
+{
+ /* Don't change order here without changing the code in main(). */
+ { mpz_add_ui, "mpz_add_ui", 0 },
+ { mpz_mul_ui, "mpz_mul_ui", 0 },
+ { mpz_sub_ui, "mpz_sub_ui", 0 },
+ { mpz_fdiv_q_2exp, "mpz_fdiv_q_2exp", 0x1000 },
+ { mpz_fdiv_r_2exp, "mpz_fdiv_r_2exp", 0x1000 },
+ { mpz_cdiv_q_2exp, "mpz_cdiv_q_2exp", 0x1000 },
+ { mpz_cdiv_r_2exp, "mpz_cdiv_r_2exp", 0x1000 },
+ { mpz_tdiv_q_2exp, "mpz_tdiv_q_2exp", 0x1000 },
+ { mpz_tdiv_r_2exp, "mpz_tdiv_r_2exp", 0x1000 },
+ { mpz_mul_2exp, "mpz_mul_2exp", 0x100 },
+ { mpz_pow_ui, "mpz_pow_ui", 0x10 }
+};
+
+struct {
+ dsi_div_func fptr;
+ const char *fname;
+} static dsi_div[] =
+{
+ { mpz_cdiv_q_ui, "mpz_cdiv_q_ui" },
+ { mpz_cdiv_r_ui, "mpz_cdiv_r_ui" },
+ { mpz_fdiv_q_ui, "mpz_fdiv_q_ui" },
+ { mpz_fdiv_r_ui, "mpz_fdiv_r_ui" },
+ { mpz_tdiv_q_ui, "mpz_tdiv_q_ui" },
+ { mpz_tdiv_r_ui, "mpz_tdiv_r_ui" }
+};
+
+struct {
+ ddsi_div_func fptr;
+ const char *fname;
+ int isslow;
+} static ddsi_div[] =
+{
+ { mpz_cdiv_qr_ui, "mpz_cdiv_qr_ui", 0 },
+ { mpz_fdiv_qr_ui, "mpz_fdiv_qr_ui", 0 },
+ { mpz_tdiv_qr_ui, "mpz_tdiv_qr_ui", 0 },
+};
+
+
+struct {
+ ddss_div_func fptr;
+ const char *fname;
+ int isslow;
+} static ddss_div[] =
+{
+ { mpz_cdiv_qr, "mpz_cdiv_qr", 0 },
+ { mpz_fdiv_qr, "mpz_fdiv_qr", 0 },
+ { mpz_tdiv_qr, "mpz_tdiv_qr", 0 },
+};
+
+struct {
+ ds_func fptr;
+ const char *fname;
+ int nonneg;
+} static ds[] =
+{
+ { mpz_abs, "mpz_abs", 0 },
+ { mpz_com, "mpz_com", 0 },
+ { mpz_neg, "mpz_neg", 0 },
+ { mpz_sqrt, "mpz_sqrt", 1 },
+};
+
+#define FAIL(class,indx,op1,op2,op3) \
+ do { \
+ dump (class[indx].fname, op1, op2, op3); \
+ exit (1); \
+ } while (0)
+
+#define FAIL2(fname,op1,op2,op3) \
+ do { \
+ dump (#fname, op1, op2, op3); \
+ exit (1); \
+ } while (0)
+
+
+void
+realloc_if_reducing (mpz_ptr r)
+{
+ if (ABSIZ(r) < ALLOC(r))
+ _mpz_realloc (r, ABSIZ(r));
+}
+
+#define INVOKE_RRS(desc,r1,r2,i1) \
+ do { \
+ if (pass & 1) realloc_if_reducing (r1); \
+ if (pass & 2) realloc_if_reducing (r2); \
+ (desc).fptr (r1, r2, i1); \
+ } while (0)
+#define INVOKE_RS(desc,r1,i1) \
+ do { \
+ if (pass & 1) realloc_if_reducing (r1); \
+ (desc).fptr (r1, i1); \
+ } while (0)
+#define INVOKE_RRSS(desc,r1,r2,i1,i2) \
+ do { \
+ if (pass & 1) realloc_if_reducing (r1); \
+ if (pass & 2) realloc_if_reducing (r2); \
+ (desc).fptr (r1, r2, i1, i2); \
+ } while (0)
+#define INVOKE_RSS(desc,r1,i1,i2) \
+ do { \
+ if (pass & 1) realloc_if_reducing (r1); \
+ (desc).fptr (r1, i1, i2); \
+ } while (0)
+
+int
+main (int argc, char **argv)
+{
+ int i;
+ unsigned int pass, reps = 400;
+ mpz_t in1, in2, in3;
+ unsigned long int in2i;
+ mpz_t res1, res2, res3;
+ mpz_t ref1, ref2, ref3;
+ mpz_t t;
+ unsigned long int r1, r2;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+
+ tests_start ();
+ TESTS_REPS (reps, argv, argc);
+
+ rands = RANDS;
+
+ mpz_init (bs);
+
+ mpz_init (in1);
+ mpz_init (in2);
+ mpz_init (in3);
+ mpz_init (ref1);
+ mpz_init (ref2);
+ mpz_init (ref3);
+ mpz_init (res1);
+ mpz_init (res2);
+ mpz_init (res3);
+ mpz_init (t);
+
+ mpz_set_ui (res1, 1); /* force allocation */
+ mpz_set_ui (res2, 1); /* force allocation */
+ mpz_set_ui (res3, 1); /* force allocation */
+
+ for (pass = 1; pass <= reps; pass++)
+ {
+#ifndef VERBOSE
+ if (isatty (STDOUT_FILENO))
+ {
+ printf ("\r%d/%d passes", pass, reps);
+ fflush (stdout);
+ }
+#endif
+
+ mpz_urandomb (bs, rands, 32);
+ /* Make size_range gradually bigger with each pass. */
+ size_range = mpz_get_ui (bs) % (pass * 15 / reps + 1) + 8;
+
+#define MAKE_RANDOM_OP(in, size_range, s) \
+ do { \
+ mpz_urandomb (bs, rands, size_range); \
+ if (((pass >> s) & 3) == 3) /* conditional exponential dist */ \
+ mpz_urandomb (bs, rands, mpz_get_ui (bs) % (size_range - 7) + 7); \
+ mpz_rrandomb (in, rands, mpz_get_ui (bs)); \
+ } while (0)
+
+ MAKE_RANDOM_OP (in1, size_range, 0);
+ MAKE_RANDOM_OP (in2, size_range, 2);
+ MAKE_RANDOM_OP (in3, size_range, 4);
+#undef MAKE_RANDOM_OP
+
+#ifdef VERBOSE
+ printf("%9d%9d%8d\n",
+ mpz_sizeinbase(in1,2),
+ mpz_sizeinbase(in2,2),
+ mpz_sizeinbase(in3,2));
+#endif
+
+ mpz_urandomb (bs, rands, 3);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 1) != 0)
+ mpz_neg (in1, in1);
+ if ((bsi & 2) != 0)
+ mpz_neg (in2, in2);
+ if ((bsi & 4) != 0)
+ mpz_neg (in3, in3);
+
+ for (i = 0; i < numberof (dss); i++)
+ {
+ if (dss[i].isdivision && mpz_sgn (in2) == 0)
+ continue;
+ if (dss[i].isslow && size_range > 19)
+ continue;
+
+ (dss[i].fptr) (ref1, in1, in2);
+ MPZ_CHECK_FORMAT (ref1);
+
+ mpz_set (res1, in1);
+ INVOKE_RSS (dss[i], res1, res1, in2);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0)
+ FAIL (dss, i, in1, in2, NULL);
+
+ mpz_set (res1, in2);
+ INVOKE_RSS (dss[i], res1, in1, res1);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0)
+ FAIL (dss, i, in1, in2, NULL);
+ }
+
+ for (i = 0; i < numberof (ddss_div); i++)
+ {
+ if (mpz_sgn (in2) == 0)
+ continue;
+
+ (ddss_div[i].fptr) (ref1, ref2, in1, in2);
+ MPZ_CHECK_FORMAT (ref1);
+ MPZ_CHECK_FORMAT (ref2);
+
+ mpz_set (res1, in1);
+ mpz_clobber (res2);
+ INVOKE_RRSS (ddss_div[i], res1, res2, res1, in2);
+ MPZ_CHECK_FORMAT (res1);
+ MPZ_CHECK_FORMAT (res2);
+ if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
+ FAIL (ddss_div, i, in1, in2, NULL);
+
+ mpz_clobber (res1);
+ mpz_set (res2, in1);
+ INVOKE_RRSS (ddss_div[i], res1, res2, res2, in2);
+ MPZ_CHECK_FORMAT (res1);
+ MPZ_CHECK_FORMAT (res2);
+ if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
+ FAIL (ddss_div, i, in1, in2, NULL);
+
+ mpz_set (res1, in2);
+ mpz_clobber (res2);
+ INVOKE_RRSS (ddss_div[i], res1, res2, in1, res1);
+ MPZ_CHECK_FORMAT (res1);
+ MPZ_CHECK_FORMAT (res2);
+ if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
+ FAIL (ddss_div, i, in1, in2, NULL);
+
+ mpz_clobber (res1);
+ mpz_set (res2, in2);
+ INVOKE_RRSS (ddss_div[i], res1, res2, in1, res2);
+ MPZ_CHECK_FORMAT (res1);
+ MPZ_CHECK_FORMAT (res2);
+ if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
+ FAIL (ddss_div, i, in1, in2, NULL);
+ }
+
+ for (i = 0; i < numberof (ds); i++)
+ {
+ if (ds[i].nonneg && mpz_sgn (in1) < 0)
+ continue;
+
+ (ds[i].fptr) (ref1, in1);
+ MPZ_CHECK_FORMAT (ref1);
+
+ mpz_set (res1, in1);
+ INVOKE_RS (ds[i], res1, res1);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0)
+ FAIL (ds, i, in1, in2, NULL);
+ }
+
+ in2i = mpz_get_ui (in2);
+
+ for (i = 0; i < numberof (dsi); i++)
+ {
+ if (dsi[i].mod != 0)
+ in2i = mpz_get_ui (in2) % dsi[i].mod;
+
+ (dsi[i].fptr) (ref1, in1, in2i);
+ MPZ_CHECK_FORMAT (ref1);
+
+ mpz_set (res1, in1);
+ INVOKE_RRS (dsi[i], res1, res1, in2i);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0)
+ FAIL (dsi, i, in1, in2, NULL);
+ }
+
+ if (in2i != 0) /* Don't divide by 0. */
+ {
+ for (i = 0; i < numberof (dsi_div); i++)
+ {
+ r1 = (dsi_div[i].fptr) (ref1, in1, in2i);
+ MPZ_CHECK_FORMAT (ref1);
+
+ mpz_set (res1, in1);
+ r2 = (dsi_div[i].fptr) (res1, res1, in2i);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0 || r1 != r2)
+ FAIL (dsi_div, i, in1, in2, NULL);
+ }
+
+ for (i = 0; i < numberof (ddsi_div); i++)
+ {
+ r1 = (ddsi_div[i].fptr) (ref1, ref2, in1, in2i);
+ MPZ_CHECK_FORMAT (ref1);
+
+ mpz_set (res1, in1);
+ mpz_clobber (res2);
+ r2 = (ddsi_div[i].fptr) (res1, res2, res1, in2i);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0 || r1 != r2)
+ FAIL (ddsi_div, i, in1, in2, NULL);
+
+ mpz_clobber (res1);
+ mpz_set (res2, in1);
+ (ddsi_div[i].fptr) (res1, res2, res2, in2i);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0 || r1 != r2)
+ FAIL (ddsi_div, i, in1, in2, NULL);
+ }
+ }
+
+ if (mpz_sgn (in1) >= 0)
+ {
+ mpz_sqrtrem (ref1, ref2, in1);
+ MPZ_CHECK_FORMAT (ref1);
+ MPZ_CHECK_FORMAT (ref2);
+
+ mpz_set (res1, in1);
+ mpz_sqrtrem (res1, res2, res1);
+ MPZ_CHECK_FORMAT (res1);
+ MPZ_CHECK_FORMAT (res2);
+ if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
+ FAIL2 (mpz_sqrtrem, in1, NULL, NULL);
+
+ mpz_set (res2, in1);
+ mpz_sqrtrem (res1, res2, res2);
+ MPZ_CHECK_FORMAT (res1);
+ MPZ_CHECK_FORMAT (res2);
+ if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
+ FAIL2 (mpz_sqrtrem, in1, NULL, NULL);
+
+ mpz_set (res1, in1);
+ mpz_sqrtrem (res1, res1, res1);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref2, res1) != 0)
+ FAIL2 (mpz_sqrtrem, in1, NULL, NULL);
+ }
+
+ if (mpz_sgn (in1) >= 0)
+ {
+ mpz_root (ref1, in1, in2i % 0x100 + 1);
+ MPZ_CHECK_FORMAT (ref1);
+
+ mpz_set (res1, in1);
+ mpz_root (res1, res1, in2i % 0x100 + 1);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0)
+ FAIL2 (mpz_root, in1, in2, NULL);
+ }
+
+ if (mpz_sgn (in1) >= 0)
+ {
+ mpz_rootrem (ref1, ref2, in1, in2i % 0x100 + 1);
+ MPZ_CHECK_FORMAT (ref1);
+ MPZ_CHECK_FORMAT (ref2);
+
+ mpz_set (res1, in1);
+ mpz_rootrem (res1, res2, res1, in2i % 0x100 + 1);
+ MPZ_CHECK_FORMAT (res1);
+ MPZ_CHECK_FORMAT (res2);
+ if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
+ FAIL2 (mpz_rootrem, in1, in2, NULL);
+
+ mpz_set (res2, in1);
+ mpz_rootrem (res1, res2, res2, in2i % 0x100 + 1);
+ MPZ_CHECK_FORMAT (res1);
+ MPZ_CHECK_FORMAT (res2);
+ if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
+ FAIL2 (mpz_rootrem, in1, in2, NULL);
+ }
+
+ if (size_range < 18) /* run fewer tests since gcdext is slow */
+ {
+ mpz_gcdext (ref1, ref2, ref3, in1, in2);
+ MPZ_CHECK_FORMAT (ref1);
+ MPZ_CHECK_FORMAT (ref2);
+ MPZ_CHECK_FORMAT (ref3);
+
+#define GCDEXT_CHECK3(i1, i2) do { \
+ mpz_gcdext (res1, res2, res3, i1, i2); \
+ MPZ_CHECK_FORMAT (res1); \
+ MPZ_CHECK_FORMAT (res2); \
+ MPZ_CHECK_FORMAT (res3); \
+ if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0 \
+ || mpz_cmp (ref3, res3) != 0) \
+ FAIL2 (mpz_gcdext, i1, i2, NULL); \
+ } while (0)
+#define GCDEXT_CHECK2(i1, i2) do { \
+ mpz_gcdext (res1, res2, NULL, i1, i2); \
+ MPZ_CHECK_FORMAT (res1); \
+ MPZ_CHECK_FORMAT (res2); \
+ if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0) \
+ FAIL2 (mpz_gcdext, i1, i2, NULL); \
+ } while (0)
+
+ mpz_set (res1, in1);
+ mpz_clobber (res2);
+ mpz_clobber (res3);
+ GCDEXT_CHECK3 (res1, in2);
+
+ mpz_clobber (res1);
+ mpz_set (res2, in1);
+ mpz_clobber (res3);
+ GCDEXT_CHECK3 (res2, in2);
+
+ mpz_clobber (res1);
+ mpz_clobber (res2);
+ mpz_set (res3, in1);
+ GCDEXT_CHECK3 (res3, in2);
+
+ mpz_set (res1, in2);
+ mpz_clobber (res2);
+ mpz_clobber (res3);
+ GCDEXT_CHECK3 (in1, res1);
+
+ mpz_clobber (res1);
+ mpz_set (res2, in2);
+ mpz_clobber (res3);
+ GCDEXT_CHECK3 (in1, res2);
+
+ mpz_clobber (res1);
+ mpz_clobber (res2);
+ mpz_set (res3, in2);
+ GCDEXT_CHECK3 (in1, res3);
+
+ mpz_set (res1, in1);
+ mpz_set (res2, in2);
+ mpz_clobber (res3);
+ GCDEXT_CHECK3 (res1, res2);
+
+ mpz_set (res1, in1);
+ mpz_clobber (res2);
+ mpz_set (res3, in2);
+ GCDEXT_CHECK3 (res1, res3);
+
+ mpz_clobber (res1);
+ mpz_set (res2, in1);
+ mpz_set (res3, in2);
+ GCDEXT_CHECK3 (res2, res3);
+
+ mpz_set (res1, in2);
+ mpz_set (res2, in1);
+ mpz_clobber (res3);
+ GCDEXT_CHECK3 (res2, res1);
+
+ mpz_set (res1, in2);
+ mpz_clobber (res2);
+ mpz_set (res3, in1);
+ GCDEXT_CHECK3 (res3, res1);
+
+ mpz_clobber (res1);
+ mpz_set (res2, in2);
+ mpz_set (res3, in1);
+ GCDEXT_CHECK3(res3, res2);
+
+ mpz_set (res1, in1);
+ mpz_clobber (res2);
+ GCDEXT_CHECK2 (res1, in2);
+
+ mpz_clobber (res1);
+ mpz_set (res2, in1);
+ GCDEXT_CHECK2 (res2, in2);
+
+ mpz_set (res1, in2);
+ mpz_clobber (res2);
+ GCDEXT_CHECK2 (in1, res1);
+
+ mpz_clobber (res1);
+ mpz_set (res2, in2);
+ GCDEXT_CHECK2 (in1, res2);
+#undef GCDEXT_CHECK
+ /* Identical inputs, gcd(in1, in1). Then the result should be
+ gcd = abs(in1), s = 0, t = sgn(in1). */
+ mpz_abs (ref1, in1);
+ mpz_set_ui (ref2, 0);
+ mpz_set_si (ref3, mpz_sgn (in1));
+
+#define GCDEXT_CHECK_SAME3(in) do { \
+ mpz_gcdext (res1, res2, res3, in, in); \
+ MPZ_CHECK_FORMAT (res1); \
+ MPZ_CHECK_FORMAT (res2); \
+ MPZ_CHECK_FORMAT (res3); \
+ if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0 \
+ || mpz_cmp (ref3, res3) != 0) \
+ FAIL2 (mpz_gcdext, in, in, NULL); \
+ } while (0)
+#define GCDEXT_CHECK_SAME2(in) do { \
+ mpz_gcdext (res1, res2, NULL, in, in); \
+ MPZ_CHECK_FORMAT (res1); \
+ MPZ_CHECK_FORMAT (res2); \
+ if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0) \
+ FAIL2 (mpz_gcdext, in, in, NULL); \
+ } while (0)
+
+ mpz_set (res1, in1);
+ mpz_clobber (res2);
+ mpz_clobber (res3);
+ GCDEXT_CHECK_SAME3 (res1);
+
+ mpz_clobber (res1);
+ mpz_set (res2, in1);
+ mpz_clobber (res3);
+ GCDEXT_CHECK_SAME3 (res2);
+
+ mpz_clobber (res1);
+ mpz_clobber (res2);
+ mpz_set (res3, in1);
+ GCDEXT_CHECK_SAME3 (res3);
+
+ mpz_set (res1, in1);
+ mpz_clobber (res2);
+ mpz_clobber (res3);
+ GCDEXT_CHECK_SAME2 (res1);
+
+ mpz_clobber (res1);
+ mpz_set (res2, in1);
+ mpz_clobber (res3);
+ GCDEXT_CHECK_SAME2 (res2);
+#undef GCDEXT_CHECK_SAME
+ }
+
+ /* Don't run mpz_powm for huge exponents or when undefined. */
+ if (size_range < 17 && mpz_sizeinbase (in2, 2) < 250 && mpz_sgn (in3) != 0
+ && (mpz_sgn (in2) >= 0 || mpz_invert (t, in1, in3)))
+ {
+ mpz_powm (ref1, in1, in2, in3);
+ MPZ_CHECK_FORMAT (ref1);
+
+ mpz_set (res1, in1);
+ mpz_powm (res1, res1, in2, in3);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0)
+ FAIL2 (mpz_powm, in1, in2, in3);
+
+ mpz_set (res1, in2);
+ mpz_powm (res1, in1, res1, in3);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0)
+ FAIL2 (mpz_powm, in1, in2, in3);
+
+ mpz_set (res1, in3);
+ mpz_powm (res1, in1, in2, res1);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0)
+ FAIL2 (mpz_powm, in1, in2, in3);
+ }
+
+ /* Don't run mpz_powm_ui when undefined. */
+ if (size_range < 17 && mpz_sgn (in3) != 0)
+ {
+ mpz_powm_ui (ref1, in1, in2i, in3);
+ MPZ_CHECK_FORMAT (ref1);
+
+ mpz_set (res1, in1);
+ mpz_powm_ui (res1, res1, in2i, in3);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0)
+ FAIL2 (mpz_powm_ui, in1, in2, in3);
+
+ mpz_set (res1, in3);
+ mpz_powm_ui (res1, in1, in2i, res1);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0)
+ FAIL2 (mpz_powm_ui, in1, in2, in3);
+ }
+
+ {
+ r1 = mpz_gcd_ui (ref1, in1, in2i);
+ MPZ_CHECK_FORMAT (ref1);
+
+ mpz_set (res1, in1);
+ r2 = mpz_gcd_ui (res1, res1, in2i);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0)
+ FAIL2 (mpz_gcd_ui, in1, in2, NULL);
+ }
+
+ if (mpz_sgn (in2) != 0)
+ {
+ /* Test mpz_remove */
+ mp_bitcnt_t refretval, retval;
+ refretval = mpz_remove (ref1, in1, in2);
+ MPZ_CHECK_FORMAT (ref1);
+
+ mpz_set (res1, in1);
+ retval = mpz_remove (res1, res1, in2);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0 || refretval != retval)
+ FAIL2 (mpz_remove, in1, in2, NULL);
+
+ mpz_set (res1, in2);
+ retval = mpz_remove (res1, in1, res1);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0 || refretval != retval)
+ FAIL2 (mpz_remove, in1, in2, NULL);
+ }
+
+ if (mpz_sgn (in2) != 0)
+ {
+ /* Test mpz_divexact */
+ mpz_mul (t, in1, in2);
+ mpz_divexact (ref1, t, in2);
+ MPZ_CHECK_FORMAT (ref1);
+
+ mpz_set (res1, t);
+ mpz_divexact (res1, res1, in2);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0)
+ FAIL2 (mpz_divexact, t, in2, NULL);
+
+ mpz_set (res1, in2);
+ mpz_divexact (res1, t, res1);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0)
+ FAIL2 (mpz_divexact, t, in2, NULL);
+ }
+
+ if (mpz_sgn (in2) > 0)
+ {
+ /* Test mpz_divexact_gcd, same as mpz_divexact */
+ mpz_mul (t, in1, in2);
+ mpz_divexact_gcd (ref1, t, in2);
+ MPZ_CHECK_FORMAT (ref1);
+
+ mpz_set (res1, t);
+ mpz_divexact_gcd (res1, res1, in2);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0)
+ FAIL2 (mpz_divexact_gcd, t, in2, NULL);
+
+ mpz_set (res1, in2);
+ mpz_divexact_gcd (res1, t, res1);
+ MPZ_CHECK_FORMAT (res1);
+ if (mpz_cmp (ref1, res1) != 0)
+ FAIL2 (mpz_divexact_gcd, t, in2, NULL);
+ }
+ }
+
+ if (isatty (STDOUT_FILENO))
+ printf ("\r%20s", "");
+
+ mpz_clear (bs);
+ mpz_clear (in1);
+ mpz_clear (in2);
+ mpz_clear (in3);
+ mpz_clear (ref1);
+ mpz_clear (ref2);
+ mpz_clear (ref3);
+ mpz_clear (res1);
+ mpz_clear (res2);
+ mpz_clear (res3);
+ mpz_clear (t);
+
+ if (isatty (STDOUT_FILENO))
+ printf ("\r");
+
+ tests_end ();
+ exit (0);
+}
+
+void
+dump (const char *name, mpz_t in1, mpz_t in2, mpz_t in3)
+{
+ printf ("failure in %s (", name);
+ mpz_out_str (stdout, -16, in1);
+ if (in2 != NULL)
+ {
+ printf (" ");
+ mpz_out_str (stdout, -16, in2);
+ }
+ if (in3 != NULL)
+ {
+ printf (" ");
+ mpz_out_str (stdout, -16, in3);
+ }
+ printf (")\n");
+}
+
+#endif /* ! DLL_EXPORT */
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-addsub.c b/vendor/gmp-6.3.0/tests/mpz/t-addsub.c
new file mode 100644
index 0000000..aaa3188
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-addsub.c
@@ -0,0 +1,121 @@
+/* Test mpz_add, mpz_sub, mpz_add_ui, mpz_sub_ui, and mpz_ui_sub.
+
+Copyright 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "longlong.h"
+#include "tests.h"
+
+void debug_mp (mpz_t, int);
+void dump_abort (int, const char *, mpz_t, mpz_t);
+
+int
+main (int argc, char **argv)
+{
+ mpz_t op1, op2, r1, r2;
+ mp_size_t op1n, op2n;
+ unsigned long int op2long;
+ int i;
+ int reps = 100000;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+
+ tests_start ();
+ rands = RANDS;
+
+ mpz_init (bs);
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpz_init (op1);
+ mpz_init (op2);
+ mpz_init (r1);
+ mpz_init (r2);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 10 + 2;
+
+ mpz_urandomb (bs, rands, size_range);
+ op1n = mpz_get_ui (bs);
+ mpz_rrandomb (op1, rands, op1n);
+
+ mpz_urandomb (bs, rands, size_range);
+ op2n = mpz_get_ui (bs);
+ mpz_rrandomb (op2, rands, op2n);
+
+ mpz_urandomb (bs, rands, 2);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 1) != 0)
+ mpz_neg (op1, op1);
+ if ((bsi & 2) != 0)
+ mpz_neg (op2, op2);
+
+ /* printf ("%ld %ld\n", SIZ (multiplier), SIZ (multiplicand)); */
+
+ mpz_add (r1, op1, op2);
+ mpz_sub (r2, r1, op2);
+ if (mpz_cmp (r2, op1) != 0)
+ dump_abort (i, "mpz_add or mpz_sub incorrect", op1, op2);
+
+ if (mpz_fits_ulong_p (op2))
+ {
+ op2long = mpz_get_ui (op2);
+ mpz_add_ui (r1, op1, op2long);
+ mpz_sub_ui (r2, r1, op2long);
+ if (mpz_cmp (r2, op1) != 0)
+ dump_abort (i, "mpz_add_ui or mpz_sub_ui incorrect", op1, op2);
+
+ mpz_ui_sub (r1, op2long, op1);
+ mpz_sub_ui (r2, op1, op2long);
+ mpz_neg (r2, r2);
+ if (mpz_cmp (r1, r2) != 0)
+ dump_abort (i, "mpz_add_ui or mpz_ui_sub incorrect", op1, op2);
+ }
+ }
+
+ mpz_clear (bs);
+ mpz_clear (op1);
+ mpz_clear (op2);
+ mpz_clear (r1);
+ mpz_clear (r2);
+
+ tests_end ();
+ exit (0);
+}
+
+void
+dump_abort (int i, const char *s, mpz_t op1, mpz_t op2)
+{
+ fprintf (stderr, "ERROR: %s in test %d\n", s, i);
+ fprintf (stderr, "op1 = "); debug_mp (op1, -16);
+ fprintf (stderr, "op2 = "); debug_mp (op2, -16);
+ abort();
+}
+
+void
+debug_mp (mpz_t x, int base)
+{
+ mpz_out_str (stderr, base, x); fputc ('\n', stderr);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-aorsmul.c b/vendor/gmp-6.3.0/tests/mpz/t-aorsmul.c
new file mode 100644
index 0000000..4bd435d
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-aorsmul.c
@@ -0,0 +1,464 @@
+/* Test mpz_addmul, mpz_addmul_ui, mpz_submul, mpz_submul_ui.
+
+Copyright 2001, 2002, 2022 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+#define M GMP_NUMB_MAX
+
+
+void
+check_one_inplace (mpz_srcptr w, mpz_srcptr y)
+{
+ mpz_t want, got;
+
+ mpz_init (want);
+ mpz_init (got);
+
+ mpz_mul (want, w, y);
+ mpz_add (want, w, want);
+ mpz_set (got, w);
+ mpz_addmul (got, got, y);
+ MPZ_CHECK_FORMAT (got);
+ if (mpz_cmp (want, got) != 0)
+ {
+ printf ("mpz_addmul inplace fail\n");
+ fail:
+ mpz_trace ("w", w);
+ mpz_trace ("y", y);
+ mpz_trace ("want", want);
+ mpz_trace ("got ", got);
+ abort ();
+ }
+
+ mpz_mul (want, w, y);
+ mpz_sub (want, w, want);
+ mpz_set (got, w);
+ mpz_submul (got, got, y);
+ MPZ_CHECK_FORMAT (got);
+ if (mpz_cmp (want, got) != 0)
+ {
+ printf ("mpz_submul inplace fail\n");
+ goto fail;
+ }
+
+ mpz_clear (want);
+ mpz_clear (got);
+}
+
+void
+check_one_ui_inplace (mpz_ptr w, unsigned long y)
+{
+ mpz_t want, got;
+
+ mpz_init (want);
+ mpz_init (got);
+
+ mpz_mul_ui (want, w, (unsigned long) y);
+ mpz_add (want, w, want);
+ mpz_set (got, w);
+ mpz_addmul_ui (got, got, (unsigned long) y);
+ MPZ_CHECK_FORMAT (got);
+ if (mpz_cmp (want, got) != 0)
+ {
+ printf ("mpz_addmul_ui fail\n");
+ fail:
+ mpz_trace ("w", w);
+ printf ("y=0x%lX %lu\n", y, y);
+ mpz_trace ("want", want);
+ mpz_trace ("got ", got);
+ abort ();
+ }
+
+ mpz_mul_ui (want, w, y);
+ mpz_sub (want, w, want);
+ mpz_set (got, w);
+ mpz_submul_ui (got, got, y);
+ MPZ_CHECK_FORMAT (got);
+ if (mpz_cmp (want, got) != 0)
+ {
+ printf ("mpz_submul_ui fail\n");
+ goto fail;
+ }
+
+ mpz_clear (want);
+ mpz_clear (got);
+}
+
+void
+check_all_inplace (mpz_ptr w, mpz_ptr y)
+{
+ int wneg, yneg;
+
+ MPZ_CHECK_FORMAT (w);
+ MPZ_CHECK_FORMAT (y);
+
+ for (wneg = 0; wneg < 2; wneg++)
+ {
+ for (yneg = 0; yneg < 2; yneg++)
+ {
+ check_one_inplace (w, y);
+
+ if (mpz_fits_ulong_p (y))
+ check_one_ui_inplace (w, mpz_get_ui (y));
+
+ mpz_neg (y, y);
+ }
+ mpz_neg (w, w);
+ }
+}
+
+void
+check_one (mpz_srcptr w, mpz_srcptr x, mpz_srcptr y)
+{
+ mpz_t want, got;
+
+ mpz_init (want);
+ mpz_init (got);
+
+ mpz_mul (want, x, y);
+ mpz_add (want, w, want);
+ mpz_set (got, w);
+ mpz_addmul (got, x, y);
+ MPZ_CHECK_FORMAT (got);
+ if (mpz_cmp (want, got) != 0)
+ {
+ printf ("mpz_addmul fail\n");
+ fail:
+ mpz_trace ("w", w);
+ mpz_trace ("x", x);
+ mpz_trace ("y", y);
+ mpz_trace ("want", want);
+ mpz_trace ("got ", got);
+ abort ();
+ }
+
+
+ mpz_sub (want, want, w);
+ mpz_sub (want, w, want);
+ mpz_set (got, w);
+ mpz_submul (got, x, y);
+ MPZ_CHECK_FORMAT (got);
+ if (mpz_cmp (want, got) != 0)
+ {
+ printf ("mpz_submul fail\n");
+ goto fail;
+ }
+
+ mpz_clear (want);
+ mpz_clear (got);
+}
+
+void
+check_sqr (mpz_srcptr w, mpz_srcptr x)
+{
+ mpz_t want, got;
+
+ mpz_init (want);
+ mpz_init (got);
+
+ mpz_mul (want, x, x);
+ mpz_add (want, w, want);
+ mpz_set (got, w);
+ mpz_addmul (got, x, x);
+ MPZ_CHECK_FORMAT (got);
+ if (mpz_cmp (want, got) != 0)
+ {
+ printf ("mpz_addmul xx fail\n");
+ sqrfail:
+ mpz_trace ("w", w);
+ mpz_trace ("x", x);
+ mpz_trace ("want", want);
+ mpz_trace ("got ", got);
+ abort ();
+ }
+
+ mpz_sub (want, want, w);
+ mpz_sub (want, w, want);
+ mpz_set (got, w);
+ mpz_submul (got, x, x);
+ MPZ_CHECK_FORMAT (got);
+ if (mpz_cmp (want, got) != 0)
+ {
+ printf ("mpz_submul xx fail\n");
+ goto sqrfail;
+ }
+
+ mpz_clear (want);
+ mpz_clear (got);
+}
+
+void
+check_one_ui (mpz_ptr w, mpz_ptr x, unsigned long y)
+{
+ mpz_t want, got;
+
+ mpz_init (want);
+ mpz_init (got);
+
+ mpz_mul_ui (want, x, (unsigned long) y);
+ mpz_add (want, w, want);
+ mpz_set (got, w);
+ mpz_addmul_ui (got, x, (unsigned long) y);
+ MPZ_CHECK_FORMAT (got);
+ if (mpz_cmp (want, got) != 0)
+ {
+ printf ("mpz_addmul_ui fail\n");
+ fail:
+ mpz_trace ("w", w);
+ mpz_trace ("x", x);
+ printf ("y=0x%lX %lu\n", y, y);
+ mpz_trace ("want", want);
+ mpz_trace ("got ", got);
+ abort ();
+ }
+
+ mpz_mul_ui (want, x, y);
+ mpz_sub (want, w, want);
+ mpz_set (got, w);
+ mpz_submul_ui (got, x, y);
+ MPZ_CHECK_FORMAT (got);
+ if (mpz_cmp (want, got) != 0)
+ {
+ printf ("mpz_submul_ui fail\n");
+ goto fail;
+ }
+
+ mpz_clear (want);
+ mpz_clear (got);
+}
+
+
+void
+check_all (mpz_ptr w, mpz_ptr x, mpz_ptr y)
+{
+ int swap, wneg, xneg, yneg;
+
+ MPZ_CHECK_FORMAT (w);
+ MPZ_CHECK_FORMAT (x);
+ MPZ_CHECK_FORMAT (y);
+
+ for (swap = 0; swap < 2; swap++)
+ {
+ for (wneg = 0; wneg < 2; wneg++)
+ {
+ for (xneg = 0; xneg < 2; xneg++)
+ {
+ for (yneg = 0; yneg < 2; yneg++)
+ {
+ check_one (w, x, y);
+
+ if (mpz_fits_ulong_p (y))
+ check_one_ui (w, x, mpz_get_ui (y));
+
+ mpz_neg (y, y);
+ }
+
+ check_sqr (w, x);
+
+ mpz_neg (x, x);
+ }
+ mpz_neg (w, w);
+ }
+ mpz_swap (x, y);
+ }
+}
+
+void
+check_data_inplace_ui (void)
+{
+ static const struct {
+ mp_limb_t w[6];
+ unsigned long y;
+
+ } data[] = {
+
+ { { 0 }, 0 },
+ { { 0 }, 1 },
+ { { 1 }, 1 },
+ { { 2 }, 1 },
+
+ { { 123 }, 1 },
+ { { 123 }, ULONG_MAX },
+ { { M }, 1 },
+ { { M }, ULONG_MAX },
+
+ { { 123, 456 }, 1 },
+ { { M, M }, 1 },
+ { { 123, 456 }, ULONG_MAX },
+ { { M, M }, ULONG_MAX },
+
+ { { 123, 456, 789 }, 1 },
+ { { M, M, M }, 1 },
+ { { 123, 456, 789 }, ULONG_MAX },
+ { { M, M, M }, ULONG_MAX },
+ };
+
+ mpz_t w, y;
+ int i;
+
+ mpz_init (w);
+ mpz_init (y);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_n (w, data[i].w, (mp_size_t) numberof(data[i].w));
+ mpz_set_ui (y, data[i].y);
+ check_all_inplace (w, y);
+ }
+
+ mpz_clear (w);
+ mpz_clear (y);
+}
+
+void
+check_data (void)
+{
+ static const struct {
+ mp_limb_t w[6];
+ mp_limb_t x[6];
+ mp_limb_t y[6];
+
+ } data[] = {
+
+ /* reducing to zero */
+ { { 1 }, { 1 }, { 1 } },
+ { { 2 }, { 1 }, { 2 } },
+ { { 0,1 }, { 0,1 }, { 1 } },
+
+ /* reducing to 1 */
+ { { 0,1 }, { M }, { 1 } },
+ { { 0,0,1 }, { M,M }, { 1 } },
+ { { 0,0,0,1 }, { M,M,M }, { 1 } },
+ { { 0,0,0,0,1 }, { M,M,M,M }, { 1 } },
+
+ /* reducing to -1 */
+ { { M }, { 0,1 }, { 1 } },
+ { { M,M }, { 0,0,1 }, { 1 } },
+ { { M,M,M }, { 0,0,0,1 }, { 1 } },
+ { { M,M,M,M }, { 0,0,0,0,1 }, { 1 } },
+
+ /* carry out of addmul */
+ { { M }, { 1 }, { 1 } },
+ { { M,M }, { 1 }, { 1 } },
+ { { M,M,M }, { 1 }, { 1 } },
+
+ /* borrow from submul */
+ { { 0,1 }, { 1 }, { 1 } },
+ { { 0,0,1 }, { 1 }, { 1 } },
+ { { 0,0,0,1 }, { 1 }, { 1 } },
+
+ /* borrow from submul */
+ { { 0,0,1 }, { 0,1 }, { 1 } },
+ { { 0,0,0,1 }, { 0,1 }, { 1 } },
+ { { 0,0,0,0,1 }, { 0,1 }, { 1 } },
+
+ /* more borrow from submul */
+ { { M }, { 0,1 }, { 1 } },
+ { { M }, { 0,0,1 }, { 1 } },
+ { { M }, { 0,0,0,1 }, { 1 } },
+ { { M }, { 0,0,0,0,1 }, { 1 } },
+
+ /* big borrow from submul */
+ { { 0,0,1 }, { M,M }, { M } },
+ { { 0,0,0,1 }, { M,M }, { M } },
+ { { 0,0,0,0,1 }, { M,M }, { M } },
+
+ /* small w */
+ { { 0,1 }, { M,M }, { M } },
+ { { 0,1 }, { M,M,M }, { M } },
+ { { 0,1 }, { M,M,M,M }, { M } },
+ { { 0,1 }, { M,M,M,M,M }, { M } },
+ };
+
+ mpz_t w, x, y;
+ int i;
+
+ mpz_init (w);
+ mpz_init (x);
+ mpz_init (y);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_n (w, data[i].w, (mp_size_t) numberof(data[i].w));
+ mpz_set_n (x, data[i].x, (mp_size_t) numberof(data[i].x));
+ mpz_set_n (y, data[i].y, (mp_size_t) numberof(data[i].y));
+ check_all (w, x, y);
+ }
+
+ mpz_clear (w);
+ mpz_clear (x);
+ mpz_clear (y);
+}
+
+
+void
+check_random (int argc, char *argv[])
+{
+ gmp_randstate_ptr rands = RANDS;
+ mpz_t w, x, y;
+ int i, reps = 2000;
+
+ mpz_init (w);
+ mpz_init (x);
+ mpz_init (y);
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_errandomb (w, rands, 5*GMP_LIMB_BITS);
+ mpz_errandomb (x, rands, 5*GMP_LIMB_BITS);
+ mpz_errandomb (y, rands, 5*GMP_LIMB_BITS);
+ check_all (w, x, y);
+ check_all_inplace (w, y);
+
+ mpz_errandomb (w, rands, 5*GMP_LIMB_BITS);
+ mpz_errandomb (x, rands, 5*GMP_LIMB_BITS);
+ mpz_errandomb (y, rands, BITS_PER_ULONG);
+ check_all (w, x, y);
+ check_all_inplace (w, y);
+ }
+
+ mpz_clear (w);
+ mpz_clear (x);
+ mpz_clear (y);
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+ mp_trace_base = -16;
+
+ check_data ();
+ check_data_inplace_ui ();
+ check_random (argc, argv);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-bin.c b/vendor/gmp-6.3.0/tests/mpz/t-bin.c
new file mode 100644
index 0000000..b647be4
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-bin.c
@@ -0,0 +1,328 @@
+/* Exercise mpz_bin_ui and mpz_bin_uiui.
+
+Copyright 2000, 2001, 2010, 2012, 2018, 2020 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+/* Default number of generated tests. */
+#define COUNT 700
+
+void
+try_mpz_bin_ui (mpz_srcptr want, mpz_srcptr n, unsigned long k)
+{
+ mpz_t got;
+
+ mpz_init (got);
+ mpz_bin_ui (got, n, k);
+ MPZ_CHECK_FORMAT (got);
+ if (mpz_cmp (got, want) != 0)
+ {
+ printf ("mpz_bin_ui wrong\n");
+ printf (" n="); mpz_out_str (stdout, 10, n); printf ("\n");
+ printf (" k=%lu\n", k);
+ printf (" got="); mpz_out_str (stdout, 10, got); printf ("\n");
+ printf (" want="); mpz_out_str (stdout, 10, want); printf ("\n");
+ abort();
+ }
+ mpz_clear (got);
+}
+
+
+void
+try_mpz_bin_uiui (mpz_srcptr want, unsigned long n, unsigned long k)
+{
+ mpz_t got;
+
+ mpz_init (got);
+ mpz_bin_uiui (got, n, k);
+ MPZ_CHECK_FORMAT (got);
+ if (mpz_cmp (got, want) != 0)
+ {
+ printf ("mpz_bin_uiui wrong\n");
+ printf (" n=%lu\n", n);
+ printf (" k=%lu\n", k);
+ printf (" got="); mpz_out_str (stdout, 10, got); printf ("\n");
+ printf (" want="); mpz_out_str (stdout, 10, want); printf ("\n");
+ abort();
+ }
+ mpz_clear (got);
+}
+
+
+void
+samples (void)
+{
+ static const struct {
+ const char *n;
+ unsigned long k;
+ const char *want;
+ } data[] = {
+
+ { "0", 123456, "0" },
+ { "1", 543210, "0" },
+ { "2", 123321, "0" },
+ { "3", 234567, "0" },
+ { "10", 23456, "0" },
+
+ /* negatives, using bin(-n,k)=bin(n+k-1,k) */
+ { "-1", 0, "1" },
+ { "-1", 1, "-1" },
+ { "-1", 2, "1" },
+ { "-1", 3, "-1" },
+ { "-1", 4, "1" },
+
+ { "-2", 0, "1" },
+ { "-2", 1, "-2" },
+ { "-2", 2, "3" },
+ { "-2", 3, "-4" },
+ { "-2", 4, "5" },
+ { "-2", 5, "-6" },
+ { "-2", 6, "7" },
+
+ { "-3", 0, "1" },
+ { "-3", 1, "-3" },
+ { "-3", 2, "6" },
+ { "-3", 3, "-10" },
+ { "-3", 4, "15" },
+ { "-3", 5, "-21" },
+ { "-3", 6, "28" },
+
+ /* A few random values */
+ { "41", 20, "269128937220" },
+ { "62", 37, "147405545359541742" },
+ { "50", 18, "18053528883775" },
+ { "149", 21, "19332950844468483467894649" },
+ };
+
+ mpz_t n, want;
+ int i;
+
+ mpz_init (n);
+ mpz_init (want);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_str_or_abort (n, data[i].n, 0);
+ mpz_set_str_or_abort (want, data[i].want, 0);
+
+ try_mpz_bin_ui (want, n, data[i].k);
+
+ if (mpz_fits_ulong_p (n))
+ try_mpz_bin_uiui (want, mpz_get_ui (n), data[i].k);
+ }
+
+ mpz_clear (n);
+ mpz_clear (want);
+}
+
+
+/* Test some bin(2k,k) cases. This produces some biggish numbers to
+ exercise the limb accumulating code. */
+void
+twos (int count)
+{
+ mpz_t n, want;
+ unsigned long k;
+
+ mpz_init (n);
+
+ mpz_init_set_ui (want, (unsigned long) 2);
+ for (k = 1; k < count; k++)
+ {
+ mpz_set_ui (n, 2*k);
+ try_mpz_bin_ui (want, n, k);
+
+ try_mpz_bin_uiui (want, 2*k, k);
+
+ mpz_mul_ui (want, want, 2*(2*k+1));
+ mpz_fdiv_q_ui (want, want, k+1);
+ }
+
+ mpz_clear (n);
+ mpz_clear (want);
+}
+
+/* Test some random bin(n,k) cases. This produces some biggish
+ numbers to exercise the limb accumulating code. */
+void
+randomwalk (int count)
+{
+ mpz_t n_z, want, tmp;
+ unsigned long n, k, i, r;
+ int tests;
+ gmp_randstate_ptr rands;
+
+ rands = RANDS;
+ mpz_init (n_z);
+
+ k = 3;
+ n = 12;
+ mpz_init_set_ui (want, (unsigned long) 220); /* binomial(12,3) = 220 */
+
+ for (tests = 1; tests < count; tests++)
+ {
+ r = gmp_urandomm_ui (rands, 62) + 1;
+ for (i = r & 7; i > 0; i--)
+ {
+ n++; k++;
+ mpz_mul_ui (want, want, n);
+ mpz_divexact_ui (want, want, k);
+ }
+ for (i = r >> 3; i > 0; i--)
+ {
+ n++;
+ mpz_mul_ui (want, want, n);
+ mpz_divexact_ui (want, want, n - k);
+ }
+
+ mpz_set_ui (n_z, n);
+ try_mpz_bin_ui (want, n_z, k);
+
+ try_mpz_bin_uiui (want, n, k);
+ }
+
+ k = 2;
+ mpz_urandomb (n_z, rands, 200);
+ mpz_mul (want, n_z, n_z); /* want = n_z ^ 2 */
+ mpz_sub (want, want, n_z); /* want = n_z ^ 2 - n_z = n_z (n_z- 1) */
+ mpz_tdiv_q_2exp (want, want, 1); /* want = n_z (n_z- 1) / 2 = binomial (n_z, 2) */
+ mpz_init (tmp);
+ for (tests = 1; tests < count; tests++)
+ {
+ r = gmp_urandomm_ui (rands, 62) + 1;
+ for (i = r & 7; i > 0; i--)
+ {
+ k++;
+ mpz_add_ui (n_z, n_z, 1);
+ mpz_mul (want, want, n_z);
+ mpz_divexact_ui (want, want, k);
+ }
+ for (i = r >> 3; i > 0; i--)
+ {
+ mpz_add_ui (n_z, n_z, 1);
+ mpz_mul (want, want, n_z);
+ mpz_sub_ui (tmp, n_z, k);
+ mpz_divexact (want, want, tmp);
+ }
+
+ try_mpz_bin_ui (want, n_z, k);
+ }
+
+ mpz_clear (tmp);
+ mpz_clear (n_z);
+ mpz_clear (want);
+}
+
+/* Test some random bin(n,k) cases. This produces some biggish
+ numbers to exercise the limb accumulating code. */
+void
+randomwalk_down (int count)
+{
+ mpz_t n_z, want, tmp;
+ unsigned long n, k, i, r;
+ int tests;
+ gmp_randstate_ptr rands;
+
+ rands = RANDS;
+ mpz_init (n_z);
+ mpz_init (tmp);
+
+ k = 2;
+ n = ULONG_MAX;
+ mpz_init_set_ui (want, n);
+ mpz_mul_ui (want, want, n >> 1);
+
+ for (tests = 1; tests < count; tests++)
+ {
+ r = gmp_urandomm_ui (rands, 62) + 1;
+ for (i = r & 7; i > 0; i--)
+ {
+ mpz_mul_ui (want, want, n - k);
+ ++k;
+ mpz_divexact_ui (want, want, k);
+ }
+ for (i = r >> 3; i > 0; i--)
+ {
+ mpz_mul_ui (want, want, n - k);
+ mpz_divexact_ui (want, want, n);
+ --n;
+ }
+
+ mpz_set_ui (n_z, n);
+ try_mpz_bin_ui (want, n_z, n - k);
+
+ try_mpz_bin_uiui (want, n, n - k);
+ }
+
+ mpz_clear (tmp);
+ mpz_clear (n_z);
+ mpz_clear (want);
+}
+
+
+/* Test all bin(n,k) cases, with 0 <= k <= n + 1 <= count. */
+void
+smallexaustive (unsigned int count)
+{
+ mpz_t n_z, want;
+ unsigned long n, k;
+
+ mpz_init (n_z);
+ mpz_init (want);
+
+ for (n = 0; n < count; n++)
+ {
+ mpz_set_ui (want, (unsigned long) 1);
+ mpz_set_ui (n_z, n);
+ for (k = 0; k <= n; k++)
+ {
+ try_mpz_bin_ui (want, n_z, k);
+ try_mpz_bin_uiui (want, n, k);
+ mpz_mul_ui (want, want, n - k);
+ mpz_fdiv_q_ui (want, want, k + 1);
+ }
+ try_mpz_bin_ui (want, n_z, k);
+ try_mpz_bin_uiui (want, n, k);
+ }
+
+ mpz_clear (n_z);
+ mpz_clear (want);
+}
+
+int
+main (int argc, char **argv)
+{
+ int count;
+
+ count = COUNT;
+ TESTS_REPS (count, argv, argc);
+
+ tests_start ();
+
+ samples ();
+ smallexaustive (count >> 4);
+ twos (count >> 1);
+ randomwalk (count - (count >> 1));
+ randomwalk_down (count >> 1);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-bit.c b/vendor/gmp-6.3.0/tests/mpz/t-bit.c
new file mode 100644
index 0000000..cfcdeea
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-bit.c
@@ -0,0 +1,405 @@
+/* Test mpz_setbit, mpz_clrbit, mpz_tstbit.
+
+Copyright 1997, 2000-2003, 2012, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#ifndef SIZE
+#define SIZE 4
+#endif
+
+
+void
+debug_mp (mpz_srcptr x, int base)
+{
+ mpz_out_str (stdout, base, x); fputc ('\n', stdout);
+}
+
+
+/* exercise the case where mpz_clrbit or mpz_combit ends up extending a
+ value like -2^(k*GMP_NUMB_BITS-1) when clearing bit k*GMP_NUMB_BITS-1. */
+/* And vice-versa. */
+void
+check_clr_extend (void)
+{
+ mpz_t got, want;
+ unsigned long i;
+ int f;
+
+ mpz_init (got);
+ mpz_init (want);
+
+ for (i = 1; i < 5; i++)
+ {
+ for (f = 0; f <= 1; f++)
+ {
+ /* lots of 1 bits in _mp_d */
+ mpz_set_si (got, 1L);
+ mpz_mul_2exp (got, got, 10*GMP_NUMB_BITS);
+ mpz_sub_ui (got, got, 1L);
+
+ /* value -2^(n-1) representing ..11100..00 */
+ mpz_set_si (got, -1L);
+ mpz_mul_2exp (got, got, i*GMP_NUMB_BITS-1);
+
+ /* complement bit n, giving ..11000..00 which is -2^n */
+ if (f == 0)
+ mpz_clrbit (got, i*GMP_NUMB_BITS-1);
+ else
+ mpz_combit (got, i*GMP_NUMB_BITS-1);
+ MPZ_CHECK_FORMAT (got);
+
+ mpz_set_si (want, -1L);
+ mpz_mul_2exp (want, want, i*GMP_NUMB_BITS);
+
+ if (mpz_cmp (got, want) != 0)
+ {
+ if (f == 0)
+ printf ("mpz_clrbit: ");
+ else
+ printf ("mpz_combit: ");
+ printf ("wrong after extension\n");
+ mpz_trace ("got ", got);
+ mpz_trace ("want", want);
+ abort ();
+ }
+
+ /* complement bit n, going back to ..11100..00 which is -2^(n-1) */
+ if (f == 0)
+ mpz_setbit (got, i*GMP_NUMB_BITS-1);
+ else
+ mpz_combit (got, i*GMP_NUMB_BITS-1);
+ MPZ_CHECK_FORMAT (got);
+
+ mpz_set_si (want, -1L);
+ mpz_mul_2exp (want, want, i*GMP_NUMB_BITS - 1);
+
+ if (mpz_cmp (got, want) != 0)
+ {
+ if (f == 0)
+ printf ("mpz_setbit: ");
+ else
+ printf ("mpz_combit: ");
+ printf ("wrong after shrinking\n");
+ mpz_trace ("got ", got);
+ mpz_trace ("want", want);
+ abort ();
+ }
+ }
+ }
+
+ mpz_clear (got);
+ mpz_clear (want);
+}
+
+void
+check_com_negs (void)
+{
+ static const struct {
+ unsigned long bit;
+ mp_size_t inp_size;
+ mp_limb_t inp_n[5];
+ mp_size_t want_size;
+ mp_limb_t want_n[5];
+ } data[] = {
+ { GMP_NUMB_BITS, 2, { 1, 1 }, 1, { 1 } },
+ { GMP_NUMB_BITS+1, 2, { 1, 1 }, 2, { 1, 3 } },
+
+ { GMP_NUMB_BITS, 2, { 0, 1 }, 2, { 0, 2 } },
+ { GMP_NUMB_BITS+1, 2, { 0, 1 }, 2, { 0, 3 } },
+ };
+ mpz_t inp, got, want;
+ int i;
+
+ mpz_init (got);
+ mpz_init (want);
+ mpz_init (inp);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_n (inp, data[i].inp_n, data[i].inp_size);
+ mpz_neg (inp, inp);
+
+ mpz_set_n (want, data[i].want_n, data[i].want_size);
+ mpz_neg (want, want);
+
+ mpz_set (got, inp);
+ mpz_combit (got, data[i].bit);
+
+ if (mpz_cmp (got, want) != 0)
+ {
+ printf ("mpz_combit: wrong on neg data[%d]\n", i);
+ mpz_trace ("inp ", inp);
+ printf ("bit %lu\n", data[i].bit);
+ mpz_trace ("got ", got);
+ mpz_trace ("want", want);
+ abort ();
+ }
+ }
+
+ mpz_clear (inp);
+ mpz_clear (got);
+ mpz_clear (want);
+}
+
+/* See that mpz_tstbit matches a twos complement calculated explicitly, for
+ various low zeros. */
+void
+check_tstbit (void)
+{
+#define MAX_ZEROS 3
+#define NUM_LIMBS 3
+
+ mp_limb_t pos[1+NUM_LIMBS+MAX_ZEROS];
+ mp_limb_t neg[1+NUM_LIMBS+MAX_ZEROS];
+ mpz_t z;
+ unsigned long i;
+ int zeros, low1;
+ int got, want;
+
+ mpz_init (z);
+ for (zeros = 0; zeros <= MAX_ZEROS; zeros++)
+ {
+ MPN_ZERO (pos, numberof(pos));
+ mpn_random2 (pos+zeros, (mp_size_t) NUM_LIMBS);
+
+ for (low1 = 0; low1 <= 1; low1++)
+ {
+ if (low1)
+ pos[0] |= 1;
+
+ refmpn_neg (neg, pos, (mp_size_t) numberof(neg));
+ mpz_set_n (z, neg, (mp_size_t) numberof(neg));
+ mpz_neg (z, z);
+
+ for (i = 0; i < numberof(pos)*GMP_NUMB_BITS; i++)
+ {
+ got = mpz_tstbit (z, i);
+ want = refmpn_tstbit (pos, i);
+ if (got != want)
+ {
+ printf ("wrong at bit %lu, with %d zeros\n", i, zeros);
+ printf ("z neg "); debug_mp (z, -16);
+ mpz_set_n (z, pos, (mp_size_t) numberof(pos));
+ printf ("pos "); debug_mp (z, -16);
+ mpz_set_n (z, neg, (mp_size_t) numberof(neg));
+ printf ("neg "); debug_mp (z, -16);
+ exit (1);
+ }
+ }
+ }
+ }
+ mpz_clear (z);
+}
+
+
+void
+check_single (void)
+{
+ mpz_t x;
+ int limb, offset, initial;
+ unsigned long bit;
+
+ mpz_init (x);
+
+ for (limb = 0; limb < 4; limb++)
+ {
+ for (offset = (limb==0 ? 0 : -2); offset <= 2; offset++)
+ {
+ for (initial = 1; initial >= -1; initial--)
+ {
+ mpz_set_si (x, (long) initial);
+
+ bit = (unsigned long) limb*GMP_LIMB_BITS + offset;
+
+ mpz_clrbit (x, bit);
+ MPZ_CHECK_FORMAT (x);
+ if (mpz_tstbit (x, bit) != 0)
+ {
+ printf ("check_single(): expected 0\n");
+ abort ();
+ }
+
+ mpz_setbit (x, bit);
+ MPZ_CHECK_FORMAT (x);
+ if (mpz_tstbit (x, bit) != 1)
+ {
+ printf ("check_single(): expected 1\n");
+ abort ();
+ }
+
+ mpz_clrbit (x, bit);
+ MPZ_CHECK_FORMAT (x);
+ if (mpz_tstbit (x, bit) != 0)
+ {
+ printf ("check_single(): expected 0\n");
+ abort ();
+ }
+
+ mpz_combit (x, bit);
+ MPZ_CHECK_FORMAT (x);
+ if (mpz_tstbit (x, bit) != 1)
+ {
+ printf ("check_single(): expected 1\n");
+ abort ();
+ }
+
+ mpz_combit (x, bit);
+ MPZ_CHECK_FORMAT (x);
+ if (mpz_tstbit (x, bit) != 0)
+ {
+ printf ("check_single(): expected 0\n");
+ abort ();
+ }
+ }
+ }
+ }
+
+ mpz_clear (x);
+}
+
+
+void
+check_random (int argc, char *argv[])
+{
+ mpz_t x, s0, s1, s2, s3, m;
+ mp_size_t xsize;
+ int i;
+ int reps = 100000;
+ int bit0, bit1, bit2, bit3;
+ unsigned long int bitindex;
+ const char *s = "";
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpz_init (x);
+ mpz_init (s0);
+ mpz_init (s1);
+ mpz_init (s2);
+ mpz_init (s3);
+ mpz_init (m);
+
+ for (i = 0; i < reps; i++)
+ {
+ xsize = urandom () % (2 * SIZE) - SIZE;
+ mpz_random2 (x, xsize);
+ bitindex = urandom () % SIZE;
+
+ mpz_set (s0, x);
+ bit0 = mpz_tstbit (x, bitindex);
+ mpz_setbit (x, bitindex);
+ MPZ_CHECK_FORMAT (x);
+
+ mpz_set (s1, x);
+ bit1 = mpz_tstbit (x, bitindex);
+ mpz_clrbit (x, bitindex);
+ MPZ_CHECK_FORMAT (x);
+
+ mpz_set (s2, x);
+ bit2 = mpz_tstbit (x, bitindex);
+ mpz_combit (x, bitindex);
+ MPZ_CHECK_FORMAT (x);
+
+ mpz_set (s3, x);
+ bit3 = mpz_tstbit (x, bitindex);
+
+#define FAIL(str) do { s = str; goto fail; } while (0)
+
+ if (bit1 != 1) FAIL ("bit1 != 1");
+ if (bit2 != 0) FAIL ("bit2 != 0");
+ if (bit3 != 1) FAIL ("bit3 != 1");
+
+ if (bit0 == 0)
+ {
+ if (mpz_cmp (s0, s1) == 0 || mpz_cmp (s0, s2) != 0 || mpz_cmp (s0, s3) == 0)
+ abort ();
+ }
+ else
+ {
+ if (mpz_cmp (s0, s1) != 0 || mpz_cmp (s0, s2) == 0 || mpz_cmp (s0, s3) != 0)
+ abort ();
+ }
+
+ if (mpz_cmp (s1, s2) == 0 || mpz_cmp (s1, s3) != 0)
+ abort ();
+ if (mpz_cmp (s2, s3) == 0)
+ abort ();
+
+ mpz_combit (x, bitindex);
+ MPZ_CHECK_FORMAT (x);
+ if (mpz_cmp (s2, x) != 0)
+ abort ();
+
+ mpz_clrbit (x, bitindex);
+ MPZ_CHECK_FORMAT (x);
+ if (mpz_cmp (s2, x) != 0)
+ abort ();
+
+ mpz_ui_pow_ui (m, 2L, bitindex);
+ MPZ_CHECK_FORMAT (m);
+ mpz_ior (x, s0, m);
+ MPZ_CHECK_FORMAT (x);
+ if (mpz_cmp (x, s3) != 0)
+ abort ();
+
+ mpz_com (m, m);
+ MPZ_CHECK_FORMAT (m);
+ mpz_and (x, s0, m);
+ MPZ_CHECK_FORMAT (x);
+ if (mpz_cmp (x, s2) != 0)
+ abort ();
+ }
+
+ mpz_clear (x);
+ mpz_clear (s0);
+ mpz_clear (s1);
+ mpz_clear (s2);
+ mpz_clear (s3);
+ mpz_clear (m);
+ return;
+
+
+ fail:
+ printf ("%s\n", s);
+ printf ("bitindex = %lu\n", bitindex);
+ printf ("x = "); mpz_out_str (stdout, -16, x); printf (" hex\n");
+ exit (1);
+}
+
+
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+ mp_trace_base = -16;
+
+ check_clr_extend ();
+ check_com_negs ();
+ check_tstbit ();
+ check_random (argc, argv);
+ check_single ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-cdiv_ui.c b/vendor/gmp-6.3.0/tests/mpz/t-cdiv_ui.c
new file mode 100644
index 0000000..91559ea
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-cdiv_ui.c
@@ -0,0 +1,158 @@
+/* Test mpz_abs, mpz_add, mpz_cmp, mpz_cmp_ui, mpz_cdiv_qr_ui, mpz_cdiv_q_ui,
+ mpz_cdiv_r_ui, , mpz_cdiv_ui, mpz_mul_ui.
+
+Copyright 1993, 1994, 1996, 2000-2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+void dump_abort (const char *, mpz_t, unsigned long);
+void debug_mp (mpz_t, int);
+
+int
+main (int argc, char **argv)
+{
+ mpz_t dividend;
+ mpz_t quotient, remainder;
+ mpz_t quotient2, remainder2;
+ mpz_t temp;
+ mp_size_t dividend_size;
+ unsigned long divisor;
+ int i;
+ int reps = 10000;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+ unsigned long r_rq, r_q, r_r, r;
+
+ tests_start ();
+ rands = RANDS;
+
+ mpz_init (bs);
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpz_init (dividend);
+ mpz_init (quotient);
+ mpz_init (remainder);
+ mpz_init (quotient2);
+ mpz_init (remainder2);
+ mpz_init (temp);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 10 + 2; /* 0..2047 bit operands */
+
+ do
+ {
+ mpz_rrandomb (bs, rands, 64);
+ divisor = mpz_get_ui (bs);
+ }
+ while (divisor == 0);
+
+ mpz_urandomb (bs, rands, size_range);
+ dividend_size = mpz_get_ui (bs);
+ mpz_rrandomb (dividend, rands, dividend_size);
+
+ mpz_urandomb (bs, rands, 2);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 1) != 0)
+ mpz_neg (dividend, dividend);
+
+ /* printf ("%ld\n", SIZ (dividend)); */
+
+ r_rq = mpz_cdiv_qr_ui (quotient, remainder, dividend, divisor);
+ r_q = mpz_cdiv_q_ui (quotient2, dividend, divisor);
+ r_r = mpz_cdiv_r_ui (remainder2, dividend, divisor);
+ r = mpz_cdiv_ui (dividend, divisor);
+
+ /* First determine that the quotients and remainders computed
+ with different functions are equal. */
+ if (mpz_cmp (quotient, quotient2) != 0)
+ dump_abort ("quotients from mpz_cdiv_qr_ui and mpz_cdiv_q_ui differ",
+ dividend, divisor);
+ if (mpz_cmp (remainder, remainder2) != 0)
+ dump_abort ("remainders from mpz_cdiv_qr_ui and mpz_cdiv_r_ui differ",
+ dividend, divisor);
+
+ /* Check if the sign of the quotient is correct. */
+ if (mpz_cmp_ui (quotient, 0) != 0)
+ if ((mpz_cmp_ui (quotient, 0) < 0)
+ != (mpz_cmp_ui (dividend, 0) < 0))
+ dump_abort ("quotient sign wrong", dividend, divisor);
+
+ /* Check if the remainder has the opposite sign as the (positive) divisor
+ (quotient rounded towards minus infinity). */
+ if (mpz_cmp_ui (remainder, 0) != 0)
+ if (mpz_cmp_ui (remainder, 0) > 0)
+ dump_abort ("remainder sign wrong", dividend, divisor);
+
+ mpz_mul_ui (temp, quotient, divisor);
+ mpz_add (temp, temp, remainder);
+ if (mpz_cmp (temp, dividend) != 0)
+ dump_abort ("n mod d != n - [n/d]*d", dividend, divisor);
+
+ mpz_abs (remainder, remainder);
+ if (mpz_cmp_ui (remainder, divisor) >= 0)
+ dump_abort ("remainder greater than divisor", dividend, divisor);
+
+ if (mpz_cmp_ui (remainder, r_rq) != 0)
+ dump_abort ("remainder returned from mpz_cdiv_qr_ui is wrong",
+ dividend, divisor);
+ if (mpz_cmp_ui (remainder, r_q) != 0)
+ dump_abort ("remainder returned from mpz_cdiv_q_ui is wrong",
+ dividend, divisor);
+ if (mpz_cmp_ui (remainder, r_r) != 0)
+ dump_abort ("remainder returned from mpz_cdiv_r_ui is wrong",
+ dividend, divisor);
+ if (mpz_cmp_ui (remainder, r) != 0)
+ dump_abort ("remainder returned from mpz_cdiv_ui is wrong",
+ dividend, divisor);
+ }
+
+ mpz_clear (bs);
+ mpz_clear (dividend);
+ mpz_clear (quotient);
+ mpz_clear (remainder);
+ mpz_clear (quotient2);
+ mpz_clear (remainder2);
+ mpz_clear (temp);
+
+ tests_end ();
+ exit (0);
+}
+
+void
+dump_abort (const char *str, mpz_t dividend, unsigned long divisor)
+{
+ fprintf (stderr, "ERROR: %s\n", str);
+ fprintf (stderr, "dividend = "); debug_mp (dividend, -16);
+ fprintf (stderr, "divisor = %lX\n", divisor);
+ abort();
+}
+
+void
+debug_mp (mpz_t x, int base)
+{
+ mpz_out_str (stderr, base, x); fputc ('\n', stderr);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-cmp.c b/vendor/gmp-6.3.0/tests/mpz/t-cmp.c
new file mode 100644
index 0000000..1ae2517
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-cmp.c
@@ -0,0 +1,181 @@
+/* Test mpz_cmp and mpz_cmpabs.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+/* Nothing sophisticated here, just exercise some combinations of sizes and
+ signs. */
+
+
+void
+check_one (mpz_ptr x, mpz_ptr y, int want_cmp, int want_cmpabs)
+{
+ int got;
+
+ got = mpz_cmp (x, y);
+ if (( got < 0) != (want_cmp < 0)
+ || (got == 0) != (want_cmp == 0)
+ || (got > 0) != (want_cmp > 0))
+ {
+ printf ("mpz_cmp got %d want %d\n", got, want_cmp);
+ mpz_trace ("x", x);
+ mpz_trace ("y", y);
+ abort ();
+ }
+
+ got = mpz_cmpabs (x, y);
+ if (( got < 0) != (want_cmpabs < 0)
+ || (got == 0) != (want_cmpabs == 0)
+ || (got > 0) != (want_cmpabs > 0))
+ {
+ printf ("mpz_cmpabs got %d want %d\n", got, want_cmpabs);
+ mpz_trace ("x", x);
+ mpz_trace ("y", y);
+ abort ();
+ }
+}
+
+
+void
+check_all (mpz_ptr x, mpz_ptr y, int want_cmp, int want_cmpabs)
+{
+ check_one (x, y, want_cmp, want_cmpabs);
+ check_one (y, x, -want_cmp, -want_cmpabs);
+
+ mpz_neg (x, x);
+ mpz_neg (y, y);
+ want_cmp = -want_cmp;
+
+ check_one (x, y, want_cmp, want_cmpabs);
+ check_one (y, x, -want_cmp, -want_cmpabs);
+}
+
+
+#define SET1(z,size, n) \
+ SIZ(z) = size; PTR(z)[0] = n
+
+#define SET2(z,size, n1,n0) \
+ SIZ(z) = size; PTR(z)[1] = n1; PTR(z)[0] = n0
+
+#define SET4(z,size, n3,n2,n1,n0) \
+ SIZ(z) = size; PTR(z)[3] = n3; PTR(z)[2] = n2; PTR(z)[1] = n1; PTR(z)[0] = n0
+
+void
+check_various (void)
+{
+ mpz_t x, y;
+
+ mpz_init (x);
+ mpz_init (y);
+
+ mpz_realloc (x, (mp_size_t) 20);
+ mpz_realloc (y, (mp_size_t) 20);
+
+ /* 0 cmp 0, junk in low limbs */
+ SET1 (x,0, 123);
+ SET1 (y,0, 456);
+ check_all (x, y, 0, 0);
+
+
+ /* 123 cmp 0 */
+ SET1 (x,1, 123);
+ SET1 (y,0, 456);
+ check_all (x, y, 1, 1);
+
+ /* 123:456 cmp 0 */
+ SET2 (x,2, 456,123);
+ SET1 (y,0, 9999);
+ check_all (x, y, 1, 1);
+
+
+ /* 123 cmp 123 */
+ SET1(x,1, 123);
+ SET1(y,1, 123);
+ check_all (x, y, 0, 0);
+
+ /* -123 cmp 123 */
+ SET1(x,-1, 123);
+ SET1(y,1, 123);
+ check_all (x, y, -1, 0);
+
+
+ /* 123 cmp 456 */
+ SET1(x,1, 123);
+ SET1(y,1, 456);
+ check_all (x, y, -1, -1);
+
+ /* -123 cmp 456 */
+ SET1(x,-1, 123);
+ SET1(y,1, 456);
+ check_all (x, y, -1, -1);
+
+ /* 123 cmp -456 */
+ SET1(x,1, 123);
+ SET1(y,-1, 456);
+ check_all (x, y, 1, -1);
+
+
+ /* 1:0 cmp 1:0 */
+ SET2 (x,2, 1,0);
+ SET2 (y,2, 1,0);
+ check_all (x, y, 0, 0);
+
+ /* -1:0 cmp 1:0 */
+ SET2 (x,-2, 1,0);
+ SET2 (y,2, 1,0);
+ check_all (x, y, -1, 0);
+
+
+ /* 2:0 cmp 1:0 */
+ SET2 (x,2, 2,0);
+ SET2 (y,2, 1,0);
+ check_all (x, y, 1, 1);
+
+
+ /* 4:3:2:1 cmp 2:1 */
+ SET4 (x,4, 4,3,2,1);
+ SET2 (y,2, 2,1);
+ check_all (x, y, 1, 1);
+
+ /* -4:3:2:1 cmp 2:1 */
+ SET4 (x,-4, 4,3,2,1);
+ SET2 (y,2, 2,1);
+ check_all (x, y, -1, 1);
+
+
+ mpz_clear (x);
+ mpz_clear (y);
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+ mp_trace_base = -16;
+
+ check_various ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-cmp_d.c b/vendor/gmp-6.3.0/tests/mpz/t-cmp_d.c
new file mode 100644
index 0000000..d7b9895
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-cmp_d.c
@@ -0,0 +1,292 @@
+/* Test mpz_cmp_d and mpz_cmpabs_d.
+
+Copyright 2001-2003, 2005 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+/* FIXME: Not sure if the tests here are exhaustive. Ought to try to get
+ each possible exit from mpz_cmp_d (and mpz_cmpabs_d) exercised. */
+
+
+#define SGN(n) ((n) > 0 ? 1 : (n) < 0 ? -1 : 0)
+
+
+void
+check_one (const char *name, mpz_srcptr x, double y, int cmp, int cmpabs)
+{
+ int got;
+
+ got = mpz_cmp_d (x, y);
+ if (SGN(got) != cmp)
+ {
+ int i;
+ printf ("mpz_cmp_d wrong (from %s)\n", name);
+ printf (" got %d\n", got);
+ printf (" want %d\n", cmp);
+ fail:
+ mpz_trace (" x", x);
+ printf (" y %g\n", y);
+ mp_trace_base=-16;
+ mpz_trace (" x", x);
+ printf (" y %g\n", y);
+ printf (" y");
+ for (i = 0; i < sizeof(y); i++)
+ printf (" %02X", (unsigned) ((unsigned char *) &y)[i]);
+ printf ("\n");
+ abort ();
+ }
+
+ got = mpz_cmpabs_d (x, y);
+ if (SGN(got) != cmpabs)
+ {
+ printf ("mpz_cmpabs_d wrong\n");
+ printf (" got %d\n", got);
+ printf (" want %d\n", cmpabs);
+ goto fail;
+ }
+}
+
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *x;
+ double y;
+ int cmp, cmpabs;
+
+ } data[] = {
+
+ { "0", 0.0, 0, 0 },
+
+ { "1", 0.0, 1, 1 },
+ { "-1", 0.0, -1, 1 },
+
+ { "1", 0.5, 1, 1 },
+ { "-1", -0.5, -1, 1 },
+
+ { "0", 1.0, -1, -1 },
+ { "0", -1.0, 1, -1 },
+
+ { "0x1000000000000000000000000000000000000000000000000", 1.0, 1, 1 },
+ { "-0x1000000000000000000000000000000000000000000000000", 1.0, -1, 1 },
+
+ { "0", 1e100, -1, -1 },
+ { "0", -1e100, 1, -1 },
+
+ { "2", 1.5, 1, 1 },
+ { "2", -1.5, 1, 1 },
+ { "-2", 1.5, -1, 1 },
+ { "-2", -1.5, -1, 1 },
+ };
+
+ mpz_t x;
+ int i;
+
+ mpz_init (x);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_str_or_abort (x, data[i].x, 0);
+ check_one ("check_data", x, data[i].y, data[i].cmp, data[i].cmpabs);
+ }
+
+ mpz_clear (x);
+}
+
+
+/* Equality of integers with up to 53 bits */
+void
+check_onebits (void)
+{
+ mpz_t x, x2;
+ double y;
+ int i;
+
+ mpz_init_set_ui (x, 0L);
+ mpz_init (x2);
+
+ for (i = 0; i < 512; i++)
+ {
+ mpz_mul_2exp (x, x, 1);
+ mpz_add_ui (x, x, 1L);
+
+ y = mpz_get_d (x);
+ mpz_set_d (x2, y);
+
+ /* stop if any truncation is occurring */
+ if (mpz_cmp (x, x2) != 0)
+ break;
+
+ check_one ("check_onebits", x, y, 0, 0);
+ check_one ("check_onebits", x, -y, 1, 0);
+ mpz_neg (x, x);
+ check_one ("check_onebits", x, y, -1, 0);
+ check_one ("check_onebits", x, -y, 0, 0);
+ mpz_neg (x, x);
+ }
+
+ mpz_clear (x);
+ mpz_clear (x2);
+}
+
+
+/* With the mpz differing by 1, in a limb position possibly below the double */
+void
+check_low_z_one (void)
+{
+ mpz_t x;
+ double y;
+ unsigned long i;
+
+ mpz_init (x);
+
+ /* FIXME: It'd be better to base this on the float format. */
+#if defined (__vax) || defined (__vax__)
+#define LIM 127 /* vax fp numbers have limited range */
+#else
+#define LIM 512
+#endif
+
+ for (i = 1; i < LIM; i++)
+ {
+ mpz_set_ui (x, 1L);
+ mpz_mul_2exp (x, x, i);
+ y = mpz_get_d (x);
+
+ check_one ("check_low_z_one", x, y, 0, 0);
+ check_one ("check_low_z_one", x, -y, 1, 0);
+ mpz_neg (x, x);
+ check_one ("check_low_z_one", x, y, -1, 0);
+ check_one ("check_low_z_one", x, -y, 0, 0);
+ mpz_neg (x, x);
+
+ mpz_sub_ui (x, x, 1);
+
+ check_one ("check_low_z_one", x, y, -1, -1);
+ check_one ("check_low_z_one", x, -y, 1, -1);
+ mpz_neg (x, x);
+ check_one ("check_low_z_one", x, y, -1, -1);
+ check_one ("check_low_z_one", x, -y, 1, -1);
+ mpz_neg (x, x);
+
+ mpz_add_ui (x, x, 2);
+
+ check_one ("check_low_z_one", x, y, 1, 1);
+ check_one ("check_low_z_one", x, -y, 1, 1);
+ mpz_neg (x, x);
+ check_one ("check_low_z_one", x, y, -1, 1);
+ check_one ("check_low_z_one", x, -y, -1, 1);
+ mpz_neg (x, x);
+ }
+
+ mpz_clear (x);
+}
+
+/* Comparing 1 and 1+2^-n. "y" is volatile to make gcc store and fetch it,
+ which forces it to a 64-bit double, whereas on x86 it would otherwise
+ remain on the float stack as an 80-bit long double. */
+void
+check_one_2exp (void)
+{
+ double e;
+ mpz_t x;
+ volatile double y;
+ int i;
+
+ mpz_init (x);
+
+ e = 1.0;
+ for (i = 0; i < 128; i++)
+ {
+ e /= 2.0;
+ y = 1.0 + e;
+ if (y == 1.0)
+ break;
+
+ mpz_set_ui (x, 1L);
+ check_one ("check_one_2exp", x, y, -1, -1);
+ check_one ("check_one_2exp", x, -y, 1, -1);
+
+ mpz_set_si (x, -1L);
+ check_one ("check_one_2exp", x, y, -1, -1);
+ check_one ("check_one_2exp", x, -y, 1, -1);
+ }
+
+ mpz_clear (x);
+}
+
+void
+check_infinity (void)
+{
+ mpz_t x;
+ double y = tests_infinity_d ();
+ if (y == 0.0)
+ return;
+
+ mpz_init (x);
+
+ /* 0 cmp inf */
+ mpz_set_ui (x, 0L);
+ check_one ("check_infinity", x, y, -1, -1);
+ check_one ("check_infinity", x, -y, 1, -1);
+
+ /* 123 cmp inf */
+ mpz_set_ui (x, 123L);
+ check_one ("check_infinity", x, y, -1, -1);
+ check_one ("check_infinity", x, -y, 1, -1);
+
+ /* -123 cmp inf */
+ mpz_set_si (x, -123L);
+ check_one ("check_infinity", x, y, -1, -1);
+ check_one ("check_infinity", x, -y, 1, -1);
+
+ /* 2^5000 cmp inf */
+ mpz_set_ui (x, 1L);
+ mpz_mul_2exp (x, x, 5000L);
+ check_one ("check_infinity", x, y, -1, -1);
+ check_one ("check_infinity", x, -y, 1, -1);
+
+ /* -2^5000 cmp inf */
+ mpz_neg (x, x);
+ check_one ("check_infinity", x, y, -1, -1);
+ check_one ("check_infinity", x, -y, 1, -1);
+
+ mpz_clear (x);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+
+ check_data ();
+ check_onebits ();
+ check_low_z_one ();
+ check_one_2exp ();
+ check_infinity ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-cmp_si.c b/vendor/gmp-6.3.0/tests/mpz/t-cmp_si.c
new file mode 100644
index 0000000..7667d3e
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-cmp_si.c
@@ -0,0 +1,101 @@
+/* Test mpz_cmp_si.
+
+Copyright 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+#define SGN(x) ((x) < 0 ? -1 : (x) == 0 ? 0 : 1)
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *a, *b;
+ int want;
+ } data[] = {
+ { "0", "1", -1 },
+ { "0", "0", 0 },
+ { "0", "-1", 1 },
+
+ { "1", "1", 0 },
+ { "1", "0", 1 },
+ { "1", "-1", 1 },
+
+ { "-1", "1", -1 },
+ { "-1", "0", -1 },
+ { "-1", "-1", 0 },
+
+ { "0", "-0x80000000", 1 },
+ { "0x80000000", "-0x80000000", 1 },
+ { "0x80000001", "-0x80000000", 1 },
+ { "-0x80000000", "-0x80000000", 0 },
+ { "-0x80000001", "-0x80000000", -1 },
+
+ { "0", "-0x8000000000000000", 1 },
+ { "0x8000000000000000", "-0x8000000000000000", 1 },
+ { "0x8000000000000001", "-0x8000000000000000", 1 },
+ { "-0x8000000000000000", "-0x8000000000000000", 0 },
+ { "-0x8000000000000001", "-0x8000000000000000", -1 },
+ };
+
+ mpz_t a, bz;
+ long b;
+ int got;
+ int i;
+
+ mpz_init (a);
+ mpz_init (bz);
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_str_or_abort (a, data[i].a, 0);
+ mpz_set_str_or_abort (bz, data[i].b, 0);
+
+ if (mpz_fits_slong_p (bz))
+ {
+ b = mpz_get_si (bz);
+ got = mpz_cmp_si (a, b);
+ if (SGN (got) != data[i].want)
+ {
+ printf ("mpz_cmp_si wrong on data[%d]\n", i);
+ printf (" a="); mpz_out_str (stdout, 10, a); printf ("\n");
+ printf (" b=%ld\n", b);
+ printf (" got=%d\n", got);
+ printf (" want=%d\n", data[i].want);
+ abort();
+ }
+ }
+ }
+
+ mpz_clear (a);
+ mpz_clear (bz);
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_data ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-cong.c b/vendor/gmp-6.3.0/tests/mpz/t-cong.c
new file mode 100644
index 0000000..59d8526
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-cong.c
@@ -0,0 +1,226 @@
+/* test mpz_congruent_p and mpz_congruent_ui_p
+
+Copyright 2001, 2002, 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_one (mpz_srcptr a, mpz_srcptr c, mpz_srcptr d, int want)
+{
+ int got;
+ int swap;
+
+ for (swap = 0; swap <= 1; swap++)
+ {
+ got = (mpz_congruent_p (a, c, d) != 0);
+ if (want != got)
+ {
+ printf ("mpz_congruent_p wrong\n");
+ printf (" expected %d got %d\n", want, got);
+ mpz_trace (" a", a);
+ mpz_trace (" c", c);
+ mpz_trace (" d", d);
+ mp_trace_base = -16;
+ mpz_trace (" a", a);
+ mpz_trace (" c", c);
+ mpz_trace (" d", d);
+ abort ();
+ }
+
+ if (mpz_fits_ulong_p (c) && mpz_fits_ulong_p (d))
+ {
+ unsigned long uc = mpz_get_ui (c);
+ unsigned long ud = mpz_get_ui (d);
+ got = (mpz_congruent_ui_p (a, uc, ud) != 0);
+ if (want != got)
+ {
+ printf ("mpz_congruent_ui_p wrong\n");
+ printf (" expected %d got %d\n", want, got);
+ mpz_trace (" a", a);
+ printf (" c=%lu\n", uc);
+ printf (" d=%lu\n", ud);
+ mp_trace_base = -16;
+ mpz_trace (" a", a);
+ printf (" c=0x%lX\n", uc);
+ printf (" d=0x%lX\n", ud);
+ abort ();
+ }
+ }
+
+ MPZ_SRCPTR_SWAP (a, c);
+ }
+}
+
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *a;
+ const char *c;
+ const char *d;
+ int want;
+
+ } data[] = {
+
+ /* strict equality mod 0 */
+ { "0", "0", "0", 1 },
+ { "11", "11", "0", 1 },
+ { "3", "11", "0", 0 },
+
+ /* anything congruent mod 1 */
+ { "0", "0", "1", 1 },
+ { "1", "0", "1", 1 },
+ { "0", "1", "1", 1 },
+ { "123", "456", "1", 1 },
+ { "0x123456789123456789", "0x987654321987654321", "1", 1 },
+
+ /* csize==1, dsize==2 changing to 1 after stripping 2s */
+ { "0x3333333333333333", "0x33333333",
+ "0x180000000", 1 },
+ { "0x33333333333333333333333333333333", "0x3333333333333333",
+ "0x18000000000000000", 1 },
+
+ /* another dsize==2 becoming 1, with opposite signs this time */
+ { "0x444444441",
+ "-0x22222221F",
+ "0x333333330", 1 },
+ { "0x44444444444444441",
+ "-0x2222222222222221F",
+ "0x33333333333333330", 1 },
+ };
+
+ mpz_t a, c, d;
+ int i;
+
+ mpz_init (a);
+ mpz_init (c);
+ mpz_init (d);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_str_or_abort (a, data[i].a, 0);
+ mpz_set_str_or_abort (c, data[i].c, 0);
+ mpz_set_str_or_abort (d, data[i].d, 0);
+ check_one (a, c, d, data[i].want);
+ }
+
+ mpz_clear (a);
+ mpz_clear (c);
+ mpz_clear (d);
+}
+
+
+void
+check_random (int argc, char *argv[])
+{
+ gmp_randstate_ptr rands = RANDS;
+ mpz_t a, c, d, ra, rc;
+ int i;
+ int want;
+ int reps = 10000;
+ mpz_t bs;
+ unsigned long size_range, size;
+
+ if (argc >= 2)
+ reps = atoi (argv[1]);
+
+ mpz_init (bs);
+
+ mpz_init (a);
+ mpz_init (c);
+ mpz_init (d);
+ mpz_init (ra);
+ mpz_init (rc);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 16 + 1; /* 0..65536 bit operands */
+
+ mpz_urandomb (bs, rands, size_range);
+ size = mpz_get_ui (bs);
+ mpz_rrandomb (a, rands, size);
+
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 16 + 1; /* 0..65536 bit operands */
+
+ mpz_urandomb (bs, rands, size_range);
+ size = mpz_get_ui (bs);
+ mpz_rrandomb (c, rands, size);
+
+ do
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 16 + 1; /* 0..65536 bit operands */
+
+ mpz_urandomb (bs, rands, size_range);
+ size = mpz_get_ui (bs);
+ mpz_rrandomb (d, rands, size);
+ }
+ while (SIZ(d) == 0);
+
+ mpz_negrandom (a, rands);
+ MPZ_CHECK_FORMAT (a);
+ mpz_negrandom (c, rands);
+ MPZ_CHECK_FORMAT (c);
+ mpz_negrandom (d, rands);
+
+ mpz_fdiv_r (ra, a, d);
+ mpz_fdiv_r (rc, c, d);
+
+ want = (mpz_cmp (ra, rc) == 0);
+ check_one (a, c, d, want);
+
+ mpz_sub (ra, ra, rc);
+ mpz_sub (a, a, ra);
+ MPZ_CHECK_FORMAT (a);
+ check_one (a, c, d, 1);
+
+ if (! mpz_pow2abs_p (d))
+ {
+ refmpz_combit (a, urandom() % (8*GMP_LIMB_BITS));
+ check_one (a, c, d, 0);
+ }
+ }
+
+ mpz_clear (bs);
+
+ mpz_clear (a);
+ mpz_clear (c);
+ mpz_clear (d);
+ mpz_clear (ra);
+ mpz_clear (rc);
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+
+ check_data ();
+ check_random (argc, argv);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-cong_2exp.c b/vendor/gmp-6.3.0/tests/mpz/t-cong_2exp.c
new file mode 100644
index 0000000..5ffe2d1
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-cong_2exp.c
@@ -0,0 +1,207 @@
+/* test mpz_congruent_2exp_p */
+
+/*
+Copyright 2001, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_one (mpz_srcptr a, mpz_srcptr c, unsigned long d, int want)
+{
+ mpz_t diff, d2exp;
+ int got;
+ int swap;
+
+ for (swap = 0; swap <= 1; swap++)
+ {
+ got = (mpz_congruent_2exp_p (a, c, d) != 0);
+ if (want != got)
+ {
+ mpz_init (diff);
+ mpz_init (d2exp);
+
+ mpz_sub (diff, a, c);
+ mpz_set_ui (d2exp, 1L);
+ mpz_mul_2exp (d2exp, d2exp, d);
+
+ printf ("mpz_congruent_2exp_p wrong\n");
+ printf (" expected %d got %d\n", want, got);
+ mpz_trace (" a", a);
+ mpz_trace (" c", c);
+ mpz_trace (" a-c", diff);
+ mpz_trace (" 2^d", d2exp);
+ printf (" d=%lu\n", d);
+
+ mp_trace_base = -16;
+ mpz_trace (" a", a);
+ mpz_trace (" c", c);
+ mpz_trace (" a-c", diff);
+ mpz_trace (" 2^d", d2exp);
+ printf (" d=0x%lX\n", d);
+ abort ();
+ }
+
+ MPZ_SRCPTR_SWAP (a, c);
+ }
+}
+
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *a;
+ const char *c;
+ unsigned long d;
+ int want;
+
+ } data[] = {
+
+ /* anything is congruent mod 1 */
+ { "0", "0", 0, 1 },
+ { "1", "0", 0, 1 },
+ { "0", "1", 0, 1 },
+ { "123", "-456", 0, 1 },
+ { "0x123456789123456789", "0x987654321987654321", 0, 1 },
+ { "0xfffffffffffffffffffffffffffffff7", "-0x9", 129, 0 },
+ { "0xfffffffffffffffffffffffffffffff6", "-0xa", 128, 1 },
+
+ };
+
+ mpz_t a, c;
+ int i;
+
+ mpz_init (a);
+ mpz_init (c);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_str_or_abort (a, data[i].a, 0);
+ mpz_set_str_or_abort (c, data[i].c, 0);
+ check_one (a, c, data[i].d, data[i].want);
+ }
+
+ mpz_clear (a);
+ mpz_clear (c);
+}
+
+
+void
+check_random (int reps)
+{
+ gmp_randstate_ptr rands = RANDS;
+ unsigned long d;
+ mpz_t a, c, ra, rc;
+ int i;
+
+ mpz_init (a);
+ mpz_init (c);
+ mpz_init (ra);
+ mpz_init (rc);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_errandomb (a, rands, 8*GMP_LIMB_BITS);
+ mpz_errandomb (c, rands, 8*GMP_LIMB_BITS);
+ d = urandom() % (8*GMP_LIMB_BITS);
+
+ mpz_mul_2exp (a, a, urandom() % (2*GMP_LIMB_BITS));
+ mpz_mul_2exp (c, c, urandom() % (2*GMP_LIMB_BITS));
+
+ mpz_negrandom (a, rands);
+ mpz_negrandom (c, rands);
+
+ mpz_fdiv_r_2exp (ra, a, d);
+ mpz_fdiv_r_2exp (rc, c, d);
+
+ mpz_sub (ra, ra, rc);
+ if (mpz_cmp_ui (ra, 0) != 0)
+ {
+ check_one (a, c, d, 0);
+ mpz_sub (a, a, ra);
+ }
+ check_one (a, c, d, 1);
+ if (d != 0)
+ {
+ mpz_combit (a, urandom() % d);
+ check_one (a, c, d, 0);
+ }
+ }
+
+ mpz_clear (a);
+ mpz_clear (c);
+ mpz_clear (ra);
+ mpz_clear (rc);
+}
+
+void
+check_random_bits (int reps)
+{
+ mp_bitcnt_t ea, ec, en, d;
+ mp_bitcnt_t m = 10 * GMP_LIMB_BITS;
+ mpz_t a, c;
+ int i;
+
+ mpz_init2 (a, m + 1);
+ mpz_init2 (c, m);
+
+ for (i = 0; i < reps; i++)
+ {
+ d = urandom() % m;
+ ea = urandom() % m;
+ ec = urandom() % m;
+ en = urandom() % m;
+
+ mpz_set_ui (c, 0);
+ mpz_setbit (c, en);
+
+ mpz_set_ui (a, 0);
+ mpz_setbit (a, ec);
+ mpz_sub (c , a, c);
+
+ mpz_set_ui (a, 0);
+ mpz_setbit (a, ea);
+ mpz_add (a , a, c);
+
+ check_one (a, c, d, ea >= d);
+ }
+
+ mpz_clear (a);
+ mpz_clear (c);
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ int reps = 5000;
+
+ tests_start ();
+ TESTS_REPS (reps, argv, argc);
+
+ check_data ();
+ check_random (reps);
+ check_random_bits (reps);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-div_2exp.c b/vendor/gmp-6.3.0/tests/mpz/t-div_2exp.c
new file mode 100644
index 0000000..d012aae
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-div_2exp.c
@@ -0,0 +1,223 @@
+/* Test mpz_[cft]div_[qr]_2exp.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+/* If the remainder is in the correct range and q*d+r is correct, then q
+ must have rounded correctly. */
+
+void
+check_one (mpz_srcptr a, unsigned long d)
+{
+ mpz_t q, r, p, d2exp;
+ int inplace;
+
+ mpz_init (d2exp);
+ mpz_init (q);
+ mpz_init (r);
+ mpz_init (p);
+
+ mpz_set_ui (d2exp, 1L);
+ mpz_mul_2exp (d2exp, d2exp, d);
+
+#define INPLACE(fun,dst,src,d) \
+ if (inplace) \
+ { \
+ mpz_set (dst, src); \
+ fun (dst, dst, d); \
+ } \
+ else \
+ fun (dst, src, d);
+
+ for (inplace = 0; inplace <= 1; inplace++)
+ {
+ INPLACE (mpz_fdiv_q_2exp, q, a, d);
+ INPLACE (mpz_fdiv_r_2exp, r, a, d);
+
+ mpz_mul_2exp (p, q, d);
+ mpz_add (p, p, r);
+ if (mpz_sgn (r) < 0 || mpz_cmp (r, d2exp) >= 0)
+ {
+ printf ("mpz_fdiv_r_2exp result out of range\n");
+ goto error;
+ }
+ if (mpz_cmp (p, a) != 0)
+ {
+ printf ("mpz_fdiv_[qr]_2exp doesn't multiply back\n");
+ goto error;
+ }
+
+
+ INPLACE (mpz_cdiv_q_2exp, q, a, d);
+ INPLACE (mpz_cdiv_r_2exp, r, a, d);
+
+ mpz_mul_2exp (p, q, d);
+ mpz_add (p, p, r);
+ if (mpz_sgn (r) > 0 || mpz_cmpabs (r, d2exp) >= 0)
+ {
+ printf ("mpz_cdiv_r_2exp result out of range\n");
+ goto error;
+ }
+ if (mpz_cmp (p, a) != 0)
+ {
+ printf ("mpz_cdiv_[qr]_2exp doesn't multiply back\n");
+ goto error;
+ }
+
+
+ INPLACE (mpz_tdiv_q_2exp, q, a, d);
+ INPLACE (mpz_tdiv_r_2exp, r, a, d);
+
+ mpz_mul_2exp (p, q, d);
+ mpz_add (p, p, r);
+ if (mpz_sgn (r) != 0 && mpz_sgn (r) != mpz_sgn (a))
+ {
+ printf ("mpz_tdiv_r_2exp result wrong sign\n");
+ goto error;
+ }
+ if (mpz_cmpabs (r, d2exp) >= 0)
+ {
+ printf ("mpz_tdiv_r_2exp result out of range\n");
+ goto error;
+ }
+ if (mpz_cmp (p, a) != 0)
+ {
+ printf ("mpz_tdiv_[qr]_2exp doesn't multiply back\n");
+ goto error;
+ }
+ }
+
+ mpz_clear (d2exp);
+ mpz_clear (q);
+ mpz_clear (r);
+ mpz_clear (p);
+ return;
+
+
+ error:
+ mpz_trace ("a", a);
+ printf ("d=%lu\n", d);
+ mpz_trace ("q", q);
+ mpz_trace ("r", r);
+ mpz_trace ("p", p);
+
+ mp_trace_base = -16;
+ mpz_trace ("a", a);
+ printf ("d=0x%lX\n", d);
+ mpz_trace ("q", q);
+ mpz_trace ("r", r);
+ mpz_trace ("p", p);
+
+ abort ();
+}
+
+
+void
+check_all (mpz_ptr a, unsigned long d)
+{
+ check_one (a, d);
+ mpz_neg (a, a);
+ check_one (a, d);
+}
+
+
+void
+check_various (void)
+{
+ static const unsigned long table[] = {
+ 0, 1, 2, 3, 4, 5,
+ GMP_NUMB_BITS-1, GMP_NUMB_BITS, GMP_NUMB_BITS+1,
+ 2*GMP_NUMB_BITS-1, 2*GMP_NUMB_BITS, 2*GMP_NUMB_BITS+1,
+ 3*GMP_NUMB_BITS-1, 3*GMP_NUMB_BITS, 3*GMP_NUMB_BITS+1,
+ 4*GMP_NUMB_BITS-1, 4*GMP_NUMB_BITS, 4*GMP_NUMB_BITS+1
+ };
+
+ int i, j;
+ unsigned long n, d;
+ mpz_t a;
+
+ mpz_init (a);
+
+ /* a==0, and various d */
+ mpz_set_ui (a, 0L);
+ for (i = 0; i < numberof (table); i++)
+ check_one (a, table[i]);
+
+ /* a==2^n, and various d */
+ for (i = 0; i < numberof (table); i++)
+ {
+ n = table[i];
+ mpz_set_ui (a, 1L);
+ mpz_mul_2exp (a, a, n);
+
+ for (j = 0; j < numberof (table); j++)
+ {
+ d = table[j];
+ check_all (a, d);
+ }
+ }
+
+ mpz_clear (a);
+}
+
+
+void
+check_random (int argc, char *argv[])
+{
+ gmp_randstate_ptr rands = RANDS;
+ int reps = 100;
+ mpz_t a;
+ unsigned long d;
+ int i;
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpz_init (a);
+
+ for (i = 0; i < reps; i++)
+ {
+ /* exponentially within 2 to 257 bits */
+ mpz_erandomb (a, rands, urandom () % 8 + 2);
+
+ d = urandom () % 256;
+
+ check_all (a, d);
+ }
+
+ mpz_clear (a);
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+
+ check_various ();
+ check_random (argc, argv);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-divis.c b/vendor/gmp-6.3.0/tests/mpz/t-divis.c
new file mode 100644
index 0000000..fe8186a
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-divis.c
@@ -0,0 +1,166 @@
+/* test mpz_divisible_p and mpz_divisible_ui_p
+
+Copyright 2001, 2009 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_one (mpz_srcptr a, mpz_srcptr d, int want)
+{
+ int got;
+
+ if (mpz_fits_ulong_p (d))
+ {
+ unsigned long u = mpz_get_ui (d);
+ got = (mpz_divisible_ui_p (a, u) != 0);
+ if (want != got)
+ {
+ printf ("mpz_divisible_ui_p wrong\n");
+ printf (" expected %d got %d\n", want, got);
+ mpz_trace (" a", a);
+ printf (" d=%lu\n", u);
+ mp_trace_base = -16;
+ mpz_trace (" a", a);
+ printf (" d=0x%lX\n", u);
+ abort ();
+ }
+ }
+
+ got = (mpz_divisible_p (a, d) != 0);
+ if (want != got)
+ {
+ printf ("mpz_divisible_p wrong\n");
+ printf (" expected %d got %d\n", want, got);
+ mpz_trace (" a", a);
+ mpz_trace (" d", d);
+ mp_trace_base = -16;
+ mpz_trace (" a", a);
+ mpz_trace (" d", d);
+ abort ();
+ }
+}
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *a;
+ const char *d;
+ int want;
+
+ } data[] = {
+
+ { "0", "0", 1 },
+ { "17", "0", 0 },
+ { "0", "1", 1 },
+ { "123", "1", 1 },
+ { "-123", "1", 1 },
+
+ { "0", "2", 1 },
+ { "1", "2", 0 },
+ { "2", "2", 1 },
+ { "-2", "2", 1 },
+ { "0x100000000000000000000000000000000", "2", 1 },
+ { "0x100000000000000000000000000000001", "2", 0 },
+
+ { "0x3333333333333333", "3", 1 },
+ { "0x3333333333333332", "3", 0 },
+ { "0x33333333333333333333333333333333", "3", 1 },
+ { "0x33333333333333333333333333333332", "3", 0 },
+
+ /* divisor changes from 2 to 1 limb after stripping 2s */
+ { "0x3333333300000000", "0x180000000", 1 },
+ { "0x33333333333333330000000000000000", "0x18000000000000000", 1 },
+ { "0x133333333333333330000000000000000", "0x18000000000000000", 0 },
+ };
+
+ mpz_t a, d;
+ int i;
+
+ mpz_init (a);
+ mpz_init (d);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_str_or_abort (a, data[i].a, 0);
+ mpz_set_str_or_abort (d, data[i].d, 0);
+ check_one (a, d, data[i].want);
+ }
+
+ mpz_clear (a);
+ mpz_clear (d);
+}
+
+void
+check_random (int reps)
+{
+ gmp_randstate_ptr rands = RANDS;
+ mpz_t a, d, r;
+ int i;
+ int want;
+
+ mpz_init (a);
+ mpz_init (d);
+ mpz_init (r);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_erandomb (a, rands, 1 << 19);
+ mpz_erandomb_nonzero (d, rands, 1 << 18);
+
+ mpz_fdiv_r (r, a, d);
+
+ want = (mpz_sgn (r) == 0);
+ check_one (a, d, want);
+
+ mpz_sub (a, a, r);
+ check_one (a, d, 1);
+
+ if (mpz_cmpabs_ui (d, 1L) == 0)
+ continue;
+
+ mpz_add_ui (a, a, 1L);
+ check_one (a, d, 0);
+ }
+
+ mpz_clear (a);
+ mpz_clear (d);
+ mpz_clear (r);
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ int reps = 100;
+
+ tests_start ();
+
+ TESTS_REPS (reps, argv, argc);
+
+ check_data ();
+ check_random (reps);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-divis_2exp.c b/vendor/gmp-6.3.0/tests/mpz/t-divis_2exp.c
new file mode 100644
index 0000000..636c751
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-divis_2exp.c
@@ -0,0 +1,132 @@
+/* test mpz_divisible_2exp_p */
+
+/*
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_one (mpz_srcptr a, unsigned long d, int want)
+{
+ int got;
+
+ got = (mpz_divisible_2exp_p (a, d) != 0);
+ if (want != got)
+ {
+ printf ("mpz_divisible_2exp_p wrong\n");
+ printf (" expected %d got %d\n", want, got);
+ mpz_trace (" a", a);
+ printf (" d=%lu\n", d);
+ mp_trace_base = -16;
+ mpz_trace (" a", a);
+ printf (" d=0x%lX\n", d);
+ abort ();
+ }
+}
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *a;
+ unsigned long d;
+ int want;
+
+ } data[] = {
+
+ { "0", 0, 1 },
+ { "0", 1, 1 },
+ { "0", 2, 1 },
+ { "0", 3, 1 },
+
+ { "1", 0, 1 },
+ { "1", 1, 0 },
+ { "1", 2, 0 },
+ { "1", 3, 0 },
+ { "1", 10000, 0 },
+
+ { "4", 0, 1 },
+ { "4", 1, 1 },
+ { "4", 2, 1 },
+ { "4", 3, 0 },
+ { "4", 4, 0 },
+ { "4", 10000, 0 },
+
+ { "0x80000000", 31, 1 },
+ { "0x80000000", 32, 0 },
+ { "0x80000000", 64, 0 },
+
+ { "0x100000000", 32, 1 },
+ { "0x100000000", 33, 0 },
+ { "0x100000000", 64, 0 },
+
+ { "0x8000000000000000", 63, 1 },
+ { "0x8000000000000000", 64, 0 },
+ { "0x8000000000000000", 128, 0 },
+
+ { "0x10000000000000000", 64, 1 },
+ { "0x10000000000000000", 65, 0 },
+ { "0x10000000000000000", 128, 0 },
+ { "0x10000000000000000", 256, 0 },
+
+ { "0x10000000000000000100000000", 32, 1 },
+ { "0x10000000000000000100000000", 33, 0 },
+ { "0x10000000000000000100000000", 64, 0 },
+
+ { "0x1000000000000000010000000000000000", 64, 1 },
+ { "0x1000000000000000010000000000000000", 65, 0 },
+ { "0x1000000000000000010000000000000000", 128, 0 },
+ { "0x1000000000000000010000000000000000", 256, 0 },
+ { "0x1000000000000000010000000000000000", 1024, 0 },
+
+ };
+
+ mpz_t a, d;
+ int i;
+
+ mpz_init (a);
+ mpz_init (d);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_str_or_abort (a, data[i].a, 0);
+ check_one (a, data[i].d, data[i].want);
+
+ mpz_neg (a, a);
+ check_one (a, data[i].d, data[i].want);
+ }
+
+ mpz_clear (a);
+ mpz_clear (d);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+
+ check_data ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-export.c b/vendor/gmp-6.3.0/tests/mpz/t-export.c
new file mode 100644
index 0000000..fa411e3
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-export.c
@@ -0,0 +1,205 @@
+/* Test mpz_export.
+
+Copyright 2002, 2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *src;
+ size_t want_count;
+ int order;
+ size_t size;
+ int endian;
+ int nail;
+ char want_data[64];
+
+ } data[] = {
+
+ { "0", 0,1, 1,1, 0 },
+ { "0", 0,1, 2,1, 0 },
+ { "0", 0,1, 3,1, 0 },
+
+ { "0x12345678", 4,1, 1,1, 0, { '\022', '\064', '\126', '\170' } },
+ { "0x12345678", 1,1, 4,1, 0, { '\022', '\064', '\126', '\170' } },
+ { "0x12345678", 1,-1, 4,1, 0, { '\022', '\064', '\126', '\170' } },
+
+ { "0x12345678", 4,-1, 1,-1, 0, { '\170', '\126', '\064', '\022' } },
+ { "0x12345678", 1,1, 4,-1, 0, { '\170', '\126', '\064', '\022' } },
+ { "0x12345678", 1,-1, 4,-1, 0, { '\170', '\126', '\064', '\022' } },
+
+ { "0x15", 5,1, 1,1, 7, { '\001', '\000', '\001', '\000', '\001' } },
+
+ { "0x1FFFFFFFFFFF", 3,1, 2,1, 1, {
+ '\177','\377', '\177','\377', '\177','\377' } },
+ { "0x1FFFFFFFFFFF", 3,1, 2,-1, 1, {
+ '\377','\177', '\377','\177', '\377','\177' } },
+ { "0x7", 3,1, 2,1, 15, {
+ '\000','\001', '\000','\001', '\000','\001' } },
+ { "0x7", 3,1, 2,-1, 15, {
+ '\001','\000', '\001','\000', '\001','\000' } },
+
+ { "0x24", 3,1, 2,1, 14, { '\000','\002', '\000','\001', '\000','\000' }},
+ { "0x24", 3,1, 2,-1, 14, { '\002','\000', '\001','\000', '\000','\000' }},
+ { "0x24", 3,-1, 2,-1, 14, { '\000','\000', '\001','\000', '\002','\000' }},
+ { "0x24", 3,-1, 2,1, 14, { '\000','\000', '\000','\001', '\000','\002' }},
+
+ { "0x123456789ABC", 3,1, 2,1, 0, {
+ '\022','\064', '\126','\170', '\232','\274' } },
+ { "0x123456789ABC", 3,-1, 2,1, 0, {
+ '\232','\274', '\126','\170', '\022','\064' } },
+ { "0x123456789ABC", 3,1, 2,-1, 0, {
+ '\064','\022', '\170','\126', '\274','\232' } },
+ { "0x123456789ABC", 3,-1, 2,-1, 0, {
+ '\274','\232', '\170','\126', '\064','\022' } },
+
+ { "0x112233445566778899AABBCC", 3,1, 4,1, 0,
+ { '\021','\042','\063','\104',
+ '\125','\146','\167','\210',
+ '\231','\252','\273','\314' } },
+ { "0x112233445566778899AABBCC", 3,-1, 4,1, 0,
+ { '\231','\252','\273','\314',
+ '\125','\146','\167','\210',
+ '\021','\042','\063','\104' } },
+ { "0x112233445566778899AABBCC", 3,1, 4,-1, 0,
+ { '\104','\063','\042','\021',
+ '\210','\167','\146','\125',
+ '\314','\273','\252','\231' } },
+ { "0x112233445566778899AABBCC", 3,-1, 4,-1, 0,
+ { '\314','\273','\252','\231',
+ '\210','\167','\146','\125',
+ '\104','\063','\042','\021' } },
+
+ { "0x100120023003400450056006700780089009A00AB00BC00C", 3,1, 8,1, 0,
+ { '\020','\001','\040','\002','\060','\003','\100','\004',
+ '\120','\005','\140','\006','\160','\007','\200','\010',
+ '\220','\011','\240','\012','\260','\013','\300','\014' } },
+ { "0x100120023003400450056006700780089009A00AB00BC00C", 3,-1, 8,1, 0,
+ { '\220','\011','\240','\012','\260','\013','\300','\014',
+ '\120','\005','\140','\006','\160','\007','\200','\010',
+ '\020','\001','\040','\002','\060','\003','\100','\004' } },
+ { "0x100120023003400450056006700780089009A00AB00BC00C", 3,1, 8,-1, 0,
+ { '\004','\100','\003','\060','\002','\040','\001','\020',
+ '\010','\200','\007','\160','\006','\140','\005','\120',
+ '\014','\300','\013','\260','\012','\240','\011','\220' } },
+ { "0x100120023003400450056006700780089009A00AB00BC00C", 3,-1, 8,-1, 0,
+ { '\014','\300','\013','\260','\012','\240','\011','\220',
+ '\010','\200','\007','\160','\006','\140','\005','\120',
+ '\004','\100','\003','\060','\002','\040','\001','\020' } },
+
+ { "0x155555555555555555555555", 3,1, 4,1, 1,
+ { '\125','\125','\125','\125',
+ '\052','\252','\252','\252',
+ '\125','\125','\125','\125' } },
+ { "0x155555555555555555555555", 3,-1, 4,1, 1,
+ { '\125','\125','\125','\125',
+ '\052','\252','\252','\252',
+ '\125','\125','\125','\125' } },
+ { "0x155555555555555555555555", 3,1, 4,-1, 1,
+ { '\125','\125','\125','\125',
+ '\252','\252','\252','\052',
+ '\125','\125','\125','\125' } },
+ { "0x155555555555555555555555", 3,-1, 4,-1, 1,
+ { '\125','\125','\125','\125',
+ '\252','\252','\252','\052',
+ '\125','\125','\125','\125' } },
+ };
+
+ char buf[sizeof(data[0].src) + sizeof (mp_limb_t) + 128];
+ char *got_data;
+ void *ret;
+ size_t align, got_count, j;
+ int i, error = 0;
+ mpz_t src;
+
+ mpz_init (src);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ for (align = 0; align < sizeof (mp_limb_t); align++)
+ {
+ mpz_set_str_or_abort (src, data[i].src, 0);
+ MPZ_CHECK_FORMAT (src);
+ got_data = buf + align;
+
+ ASSERT_ALWAYS (data[i].want_count * data[i].size + align
+ <= sizeof (buf));
+
+ memset (got_data, '\0', data[i].want_count * data[i].size);
+ ret = mpz_export (got_data, &got_count, data[i].order,
+ data[i].size, data[i].endian, data[i].nail, src);
+
+ if (ret != got_data)
+ {
+ printf ("return doesn't equal given pointer\n");
+ error = 1;
+ }
+ if (got_count != data[i].want_count)
+ {
+ printf ("wrong count\n");
+ error = 1;
+ }
+ if (memcmp (got_data, data[i].want_data, got_count * data[i].size) != 0)
+ {
+ printf ("wrong result data\n");
+ error = 1;
+ }
+ if (error)
+ {
+ printf (" at data[%d] align=%d\n", i, (int) align);
+ printf (" src \"%s\"\n", data[i].src);
+ mpz_trace (" src", src);
+ printf (" order=%d size=%lu endian=%d nail=%u\n",
+ data[i].order,
+ (unsigned long) data[i].size, data[i].endian, data[i].nail);
+ printf (" want count %lu\n", (unsigned long) data[i].want_count);
+ printf (" got count %lu\n", (unsigned long) got_count);
+ printf (" want");
+ for (j = 0; j < data[i].want_count*data[i].size; j++)
+ printf (" 0x%02X,", (unsigned) (unsigned char) data[i].want_data[j]);
+ printf ("\n");
+ printf (" got ");
+ for (j = 0; j < got_count*data[i].size; j++)
+ printf (" 0x%02X,", (unsigned) (unsigned char) got_data[j]);
+ printf ("\n");
+ abort ();
+ }
+ }
+ }
+ mpz_clear (src);
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+
+ mp_trace_base = -16;
+ check_data ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-fac_ui.c b/vendor/gmp-6.3.0/tests/mpz/t-fac_ui.c
new file mode 100644
index 0000000..15b6070
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-fac_ui.c
@@ -0,0 +1,108 @@
+/* Exercise mpz_fac_ui and mpz_2fac_ui.
+
+Copyright 2000-2002, 2012, 2015 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+/* Usage: t-fac_ui [x|num]
+
+ With no arguments testing goes up to the initial value of "limit" below.
+ With a number argument tests are carried that far, or with a literal "x"
+ tests are continued without limit (this being meant only for development
+ purposes). */
+
+
+int
+main (int argc, char *argv[])
+{
+ unsigned long n, m;
+ unsigned long limit = 2222;
+ mpz_t df[2], f, r;
+
+ tests_start ();
+
+ if (argc > 1 && argv[1][0] == 'x')
+ limit = ULONG_MAX;
+ else
+ TESTS_REPS (limit, argv, argc);
+
+ /* for small limb testing */
+ limit = MIN (limit, MP_LIMB_T_MAX);
+
+ mpz_init_set_ui (df[0], 1); /* 0!! = 1 */
+ mpz_init_set_ui (df[1], 1); /* -1!! = 1 */
+ mpz_init_set_ui (f, 1); /* 0! = 1 */
+ mpz_init (r);
+
+ for (n = 0, m = 0; n < limit; n++)
+ {
+ mpz_fac_ui (r, n);
+ MPZ_CHECK_FORMAT (r);
+
+ if (mpz_cmp (f, r) != 0)
+ {
+ printf ("mpz_fac_ui(%lu) wrong\n", n);
+ printf (" got "); mpz_out_str (stdout, 10, r); printf("\n");
+ printf (" want "); mpz_out_str (stdout, 10, f); printf("\n");
+ abort ();
+ }
+
+ mpz_2fac_ui (r, n);
+ MPZ_CHECK_FORMAT (r);
+
+ if (mpz_cmp (df[m], r) != 0)
+ {
+ printf ("mpz_2fac_ui(%lu) wrong\n", n);
+ printf (" got "); mpz_out_str (stdout, 10, r); printf("\n");
+ printf (" want "); mpz_out_str (stdout, 10, df[m]); printf("\n");
+ abort ();
+ }
+
+ m ^= 1;
+ mpz_mul_ui (df[m], df[m], n+1); /* (n+1)!! = (n-1)!! * (n+1) */
+ mpz_mul_ui (f, f, n+1); /* (n+1)! = n! * (n+1) */
+ }
+
+ n = 2097169; /* a prime = 1 mod 4*/
+ if (n / 2 > MP_LIMB_T_MAX)
+ n = 131041; /* a smaller prime :-) */
+ mpz_fac_ui (f, n / 2); /* ((n-1)/2)! */
+ m = mpz_fdiv_ui (f, n); /* ((n-1)/2)! mod n*/
+ mpz_set_ui (f, m);
+ mpz_mul_ui (f, f, m); /* (((n-1)/2)!)^2 */
+ m = mpz_fdiv_ui (f, n); /* (((n-1)/2)!)^2 mod n*/
+ if ( m != n - 1)
+ {
+ printf ("mpz_fac_ui(%lu) wrong\n", n / 2);
+ printf (" al-Haytham's theorem not verified: got %lu, expected %lu.\n", m, n - 1);
+ abort ();
+ }
+
+ mpz_clear (df[0]);
+ mpz_clear (df[1]);
+ mpz_clear (f);
+ mpz_clear (r);
+
+ tests_end ();
+
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-fdiv.c b/vendor/gmp-6.3.0/tests/mpz/t-fdiv.c
new file mode 100644
index 0000000..71503df
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-fdiv.c
@@ -0,0 +1,146 @@
+/* Test mpz_abs, mpz_add, mpz_cmp, mpz_cmp_ui, mpz_fdiv_qr, mpz_fdiv_q,
+ mpz_fdiv_r, mpz_mul.
+
+Copyright 1993, 1994, 1996, 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+void dump_abort (mpz_t, mpz_t);
+void debug_mp (mpz_t, int);
+
+int
+main (int argc, char **argv)
+{
+ mpz_t dividend, divisor;
+ mpz_t quotient, remainder;
+ mpz_t quotient2, remainder2;
+ mpz_t temp;
+ mp_size_t dividend_size, divisor_size;
+ int i;
+ int reps = 1000;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+
+ tests_start ();
+ rands = RANDS;
+
+ mpz_init (bs);
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpz_init (dividend);
+ mpz_init (divisor);
+ mpz_init (quotient);
+ mpz_init (remainder);
+ mpz_init (quotient2);
+ mpz_init (remainder2);
+ mpz_init (temp);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 16 + 2; /* 0..131071 bit operands */
+
+ do
+ {
+ mpz_urandomb (bs, rands, size_range);
+ divisor_size = mpz_get_ui (bs);
+ mpz_rrandomb (divisor, rands, divisor_size);
+ }
+ while (mpz_sgn (divisor) == 0);
+
+ mpz_urandomb (bs, rands, size_range);
+ dividend_size = mpz_get_ui (bs) + divisor_size;
+ mpz_rrandomb (dividend, rands, dividend_size);
+
+ mpz_urandomb (bs, rands, 2);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 1) != 0)
+ mpz_neg (dividend, dividend);
+ if ((bsi & 2) != 0)
+ mpz_neg (divisor, divisor);
+
+ /* printf ("%ld %ld\n", SIZ (dividend), SIZ (divisor)); */
+
+ mpz_fdiv_qr (quotient, remainder, dividend, divisor);
+ mpz_fdiv_q (quotient2, dividend, divisor);
+ mpz_fdiv_r (remainder2, dividend, divisor);
+
+ /* First determine that the quotients and remainders computed
+ with different functions are equal. */
+ if (mpz_cmp (quotient, quotient2) != 0)
+ dump_abort (dividend, divisor);
+ if (mpz_cmp (remainder, remainder2) != 0)
+ dump_abort (dividend, divisor);
+
+ /* Check if the sign of the quotient is correct. */
+ if (mpz_cmp_ui (quotient, 0) != 0)
+ if ((mpz_cmp_ui (quotient, 0) < 0)
+ != ((mpz_cmp_ui (dividend, 0) ^ mpz_cmp_ui (divisor, 0)) < 0))
+ dump_abort (dividend, divisor);
+
+ /* Check if the remainder has the same sign as the divisor
+ (quotient rounded towards minus infinity). */
+ if (mpz_cmp_ui (remainder, 0) != 0)
+ if ((mpz_cmp_ui (remainder, 0) < 0) != (mpz_cmp_ui (divisor, 0) < 0))
+ dump_abort (dividend, divisor);
+
+ mpz_mul (temp, quotient, divisor);
+ mpz_add (temp, temp, remainder);
+ if (mpz_cmp (temp, dividend) != 0)
+ dump_abort (dividend, divisor);
+
+ mpz_abs (temp, divisor);
+ mpz_abs (remainder, remainder);
+ if (mpz_cmp (remainder, temp) >= 0)
+ dump_abort (dividend, divisor);
+ }
+
+ mpz_clear (bs);
+ mpz_clear (dividend);
+ mpz_clear (divisor);
+ mpz_clear (quotient);
+ mpz_clear (remainder);
+ mpz_clear (quotient2);
+ mpz_clear (remainder2);
+ mpz_clear (temp);
+
+ tests_end ();
+ exit (0);
+}
+
+void
+dump_abort (mpz_t dividend, mpz_t divisor)
+{
+ fprintf (stderr, "ERROR\n");
+ fprintf (stderr, "dividend = "); debug_mp (dividend, -16);
+ fprintf (stderr, "divisor = "); debug_mp (divisor, -16);
+ abort();
+}
+
+void
+debug_mp (mpz_t x, int base)
+{
+ mpz_out_str (stderr, base, x); fputc ('\n', stderr);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-fdiv_ui.c b/vendor/gmp-6.3.0/tests/mpz/t-fdiv_ui.c
new file mode 100644
index 0000000..87620ca
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-fdiv_ui.c
@@ -0,0 +1,158 @@
+/* Test mpz_abs, mpz_add, mpz_cmp, mpz_cmp_ui, mpz_fdiv_qr_ui, mpz_fdiv_q_ui,
+ mpz_fdiv_r_ui, mpz_fdiv_ui, mpz_mul_ui.
+
+Copyright 1993, 1994, 1996, 2000-2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+void dump_abort (const char *, mpz_t, unsigned long);
+void debug_mp (mpz_t, int);
+
+int
+main (int argc, char **argv)
+{
+ mpz_t dividend;
+ mpz_t quotient, remainder;
+ mpz_t quotient2, remainder2;
+ mpz_t temp;
+ mp_size_t dividend_size;
+ unsigned long divisor;
+ int i;
+ int reps = 10000;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+ unsigned long r_rq, r_q, r_r, r;
+
+ tests_start ();
+ rands = RANDS;
+
+ mpz_init (bs);
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpz_init (dividend);
+ mpz_init (quotient);
+ mpz_init (remainder);
+ mpz_init (quotient2);
+ mpz_init (remainder2);
+ mpz_init (temp);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 10 + 2; /* 0..2047 bit operands */
+
+ do
+ {
+ mpz_rrandomb (bs, rands, 64);
+ divisor = mpz_get_ui (bs);
+ }
+ while (divisor == 0);
+
+ mpz_urandomb (bs, rands, size_range);
+ dividend_size = mpz_get_ui (bs);
+ mpz_rrandomb (dividend, rands, dividend_size);
+
+ mpz_urandomb (bs, rands, 2);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 1) != 0)
+ mpz_neg (dividend, dividend);
+
+ /* printf ("%ld\n", SIZ (dividend)); */
+
+ r_rq = mpz_fdiv_qr_ui (quotient, remainder, dividend, divisor);
+ r_q = mpz_fdiv_q_ui (quotient2, dividend, divisor);
+ r_r = mpz_fdiv_r_ui (remainder2, dividend, divisor);
+ r = mpz_fdiv_ui (dividend, divisor);
+
+ /* First determine that the quotients and remainders computed
+ with different functions are equal. */
+ if (mpz_cmp (quotient, quotient2) != 0)
+ dump_abort ("quotients from mpz_fdiv_qr_ui and mpz_fdiv_q_ui differ",
+ dividend, divisor);
+ if (mpz_cmp (remainder, remainder2) != 0)
+ dump_abort ("remainders from mpz_fdiv_qr_ui and mpz_fdiv_r_ui differ",
+ dividend, divisor);
+
+ /* Check if the sign of the quotient is correct. */
+ if (mpz_cmp_ui (quotient, 0) != 0)
+ if ((mpz_cmp_ui (quotient, 0) < 0)
+ != (mpz_cmp_ui (dividend, 0) < 0))
+ dump_abort ("quotient sign wrong", dividend, divisor);
+
+ /* Check if the remainder has the same sign as the (positive) divisor
+ (quotient rounded towards minus infinity). */
+ if (mpz_cmp_ui (remainder, 0) != 0)
+ if (mpz_cmp_ui (remainder, 0) < 0)
+ dump_abort ("remainder sign wrong", dividend, divisor);
+
+ mpz_mul_ui (temp, quotient, divisor);
+ mpz_add (temp, temp, remainder);
+ if (mpz_cmp (temp, dividend) != 0)
+ dump_abort ("n mod d != n - [n/d]*d", dividend, divisor);
+
+ mpz_abs (remainder, remainder);
+ if (mpz_cmp_ui (remainder, divisor) >= 0)
+ dump_abort ("remainder greater than divisor", dividend, divisor);
+
+ if (mpz_cmp_ui (remainder, r_rq) != 0)
+ dump_abort ("remainder returned from mpz_fdiv_qr_ui is wrong",
+ dividend, divisor);
+ if (mpz_cmp_ui (remainder, r_q) != 0)
+ dump_abort ("remainder returned from mpz_fdiv_q_ui is wrong",
+ dividend, divisor);
+ if (mpz_cmp_ui (remainder, r_r) != 0)
+ dump_abort ("remainder returned from mpz_fdiv_r_ui is wrong",
+ dividend, divisor);
+ if (mpz_cmp_ui (remainder, r) != 0)
+ dump_abort ("remainder returned from mpz_fdiv_ui is wrong",
+ dividend, divisor);
+ }
+
+ mpz_clear (bs);
+ mpz_clear (dividend);
+ mpz_clear (quotient);
+ mpz_clear (remainder);
+ mpz_clear (quotient2);
+ mpz_clear (remainder2);
+ mpz_clear (temp);
+
+ tests_end ();
+ exit (0);
+}
+
+void
+dump_abort (const char *str, mpz_t dividend, unsigned long divisor)
+{
+ fprintf (stderr, "ERROR: %s\n", str);
+ fprintf (stderr, "dividend = "); debug_mp (dividend, -16);
+ fprintf (stderr, "divisor = %lX\n", divisor);
+ abort();
+}
+
+void
+debug_mp (mpz_t x, int base)
+{
+ mpz_out_str (stderr, base, x); fputc ('\n', stderr);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-fib_ui.c b/vendor/gmp-6.3.0/tests/mpz/t-fib_ui.c
new file mode 100644
index 0000000..ec9425c
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-fib_ui.c
@@ -0,0 +1,155 @@
+/* Test mpz_fib_ui and mpz_fib2_ui.
+
+Copyright 2000-2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+/* Usage: t-fib_ui [x|num]
+
+ Run with no arguments, tests goes up to the initial value of "limit"
+ below. With a number argument tests are carried up that far, or with a
+ literal "x" tests are continued without limit (this being only meant for
+ development purposes).
+
+ The size tests performed are designed to partially replicate what will be
+ going on in mpz_fib_ui. There's plenty of ASSERTs there, but of course
+ they're not normally enabled.
+
+ Misfeatures:
+
+ The tests on MPN_FIB2_SIZE are a bit useless, since that macro includes a
+ +2 for the internal purposes of mpn_fib2_ui. It's probably better to
+ give mpn_fib2_ui a run with assertion checking enabled. */
+
+
+#define MPZ_FIB_SIZE_FLOAT(n) \
+ ((mp_size_t) ((n) * 0.6942419 / GMP_NUMB_BITS + 1))
+
+
+void
+check_fib_table (void)
+{
+ int i;
+ mp_limb_t want;
+
+ ASSERT_ALWAYS (FIB_TABLE(-1) == 1);
+ ASSERT_ALWAYS (FIB_TABLE(0) == 0);
+
+ for (i = 1; i <= FIB_TABLE_LIMIT; i++)
+ {
+ want = FIB_TABLE(i-1) + FIB_TABLE(i-2);
+ if (FIB_TABLE(i) != want)
+ {
+ printf ("FIB_TABLE(%d) wrong\n", i);
+ gmp_printf (" got %#Nx\n", &FIB_TABLE(i), 1);
+ gmp_printf (" want %#Nx\n", &want, 1);
+ abort ();
+ }
+ }
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ unsigned long n;
+ unsigned long limit = 100 * GMP_LIMB_BITS;
+ mpz_t want_fn, want_fn1, got_fn, got_fn1;
+
+ tests_start ();
+ mp_trace_base = -16;
+ if (argc > 1 && argv[1][0] == 'x')
+ limit = ULONG_MAX;
+ else
+ TESTS_REPS (limit, argv, argc);
+
+ check_fib_table ();
+
+ /* start at n==0 */
+ mpz_init_set_ui (want_fn1, 1); /* F[-1] */
+ mpz_init_set_ui (want_fn, 0); /* F[0] */
+ mpz_init (got_fn);
+ mpz_init (got_fn1);
+
+ for (n = 0; n < limit; n++)
+ {
+ /* check our float formula seems right */
+ if (MPZ_FIB_SIZE_FLOAT (n) < SIZ(want_fn))
+ {
+ printf ("MPZ_FIB_SIZE_FLOAT wrong at n=%lu\n", n);
+ printf (" MPZ_FIB_SIZE_FLOAT %ld\n", MPZ_FIB_SIZE_FLOAT (n));
+ printf (" SIZ(want_fn) %d\n", SIZ(want_fn));
+ abort ();
+ }
+
+ /* check MPN_FIB2_SIZE seems right, compared to actual size and
+ compared to our float formula */
+ if (MPN_FIB2_SIZE (n) < MPZ_FIB_SIZE_FLOAT (n))
+ {
+ printf ("MPN_FIB2_SIZE wrong at n=%lu\n", n);
+ printf (" MPN_FIB2_SIZE %ld\n", MPN_FIB2_SIZE (n));
+ printf (" MPZ_FIB_SIZE_FLOAT %ld\n", MPZ_FIB_SIZE_FLOAT (n));
+ abort ();
+ }
+ if (MPN_FIB2_SIZE (n) < SIZ(want_fn))
+ {
+ printf ("MPN_FIB2_SIZE wrong at n=%lu\n", n);
+ printf (" MPN_FIB2_SIZE %ld\n", MPN_FIB2_SIZE (n));
+ printf (" SIZ(want_fn) %d\n", SIZ(want_fn));
+ abort ();
+ }
+
+ mpz_fib2_ui (got_fn, got_fn1, n);
+ MPZ_CHECK_FORMAT (got_fn);
+ MPZ_CHECK_FORMAT (got_fn1);
+ if (mpz_cmp (got_fn, want_fn) != 0 || mpz_cmp (got_fn1, want_fn1) != 0)
+ {
+ printf ("mpz_fib2_ui(%lu) wrong\n", n);
+ mpz_trace ("want fn ", want_fn);
+ mpz_trace ("got fn ", got_fn);
+ mpz_trace ("want fn1", want_fn1);
+ mpz_trace ("got fn1", got_fn1);
+ abort ();
+ }
+
+ mpz_fib_ui (got_fn, n);
+ MPZ_CHECK_FORMAT (got_fn);
+ if (mpz_cmp (got_fn, want_fn) != 0)
+ {
+ printf ("mpz_fib_ui(%lu) wrong\n", n);
+ mpz_trace ("want fn", want_fn);
+ mpz_trace ("got fn", got_fn);
+ abort ();
+ }
+
+ mpz_add (want_fn1, want_fn1, want_fn); /* F[n+1] = F[n] + F[n-1] */
+ mpz_swap (want_fn1, want_fn);
+ }
+
+ mpz_clear (want_fn);
+ mpz_clear (want_fn1);
+ mpz_clear (got_fn);
+ mpz_clear (got_fn1);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-fits.c b/vendor/gmp-6.3.0/tests/mpz/t-fits.c
new file mode 100644
index 0000000..6819588
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-fits.c
@@ -0,0 +1,197 @@
+/* Test mpz_fits_*_p */
+
+/*
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+/* Nothing sophisticated here, just exercise mpz_fits_*_p on a small amount
+ of data. */
+
+#define EXPECT_S(fun,name,answer) \
+ got = fun (z); \
+ if (got != answer) \
+ { \
+ printf ("%s (%s) got %d want %d\n", name, expr, got, answer); \
+ printf (" z size %d\n", SIZ(z)); \
+ printf (" z dec "); mpz_out_str (stdout, 10, z); printf ("\n"); \
+ printf (" z hex "); mpz_out_str (stdout, 16, z); printf ("\n"); \
+ error = 1; \
+ }
+
+#define EXPECT(fun,answer) EXPECT_S(fun,#fun,answer)
+
+int
+main (void)
+{
+ mpz_t z;
+ int got;
+ const char *expr;
+ int error = 0;
+
+ tests_start ();
+ mpz_init (z);
+
+ mpz_set_ui (z, 0L);
+ expr = "0";
+ EXPECT (mpz_fits_ulong_p, 1);
+ EXPECT (mpz_fits_uint_p, 1);
+ EXPECT (mpz_fits_ushort_p, 1);
+ EXPECT (mpz_fits_slong_p, 1);
+ EXPECT (mpz_fits_sint_p, 1);
+ EXPECT (mpz_fits_sshort_p, 1);
+
+ mpz_set_ui (z, 1L);
+ expr = "1";
+ EXPECT (mpz_fits_ulong_p, 1);
+ EXPECT (mpz_fits_uint_p, 1);
+ EXPECT (mpz_fits_ushort_p, 1);
+ EXPECT (mpz_fits_slong_p, 1);
+ EXPECT (mpz_fits_sint_p, 1);
+ EXPECT (mpz_fits_sshort_p, 1);
+
+ mpz_set_si (z, -1L);
+ expr = "-1";
+ EXPECT (mpz_fits_ulong_p, 0);
+ EXPECT (mpz_fits_uint_p, 0);
+ EXPECT (mpz_fits_ushort_p, 0);
+ EXPECT (mpz_fits_slong_p, 1);
+ EXPECT (mpz_fits_sint_p, 1);
+ EXPECT (mpz_fits_sshort_p, 1);
+
+ mpz_set_ui (z, 1L);
+ mpz_mul_2exp (z, z, 5L*GMP_LIMB_BITS);
+ expr = "2^(5*BPML)";
+ EXPECT (mpz_fits_ulong_p, 0);
+ EXPECT (mpz_fits_uint_p, 0);
+ EXPECT (mpz_fits_ushort_p, 0);
+ EXPECT (mpz_fits_slong_p, 0);
+ EXPECT (mpz_fits_sint_p, 0);
+ EXPECT (mpz_fits_sshort_p, 0);
+
+
+ mpz_set_ui (z, (unsigned long) USHRT_MAX);
+ expr = "USHRT_MAX";
+ EXPECT (mpz_fits_ulong_p, 1);
+ EXPECT (mpz_fits_uint_p, 1);
+ EXPECT (mpz_fits_ushort_p, 1);
+
+ mpz_set_ui (z, (unsigned long) USHRT_MAX);
+ mpz_add_ui (z, z, 1L);
+ expr = "USHRT_MAX + 1";
+ EXPECT (mpz_fits_ushort_p, 0);
+
+
+ mpz_set_ui (z, (unsigned long) UINT_MAX);
+ expr = "UINT_MAX";
+ EXPECT (mpz_fits_ulong_p, 1);
+ EXPECT (mpz_fits_uint_p, 1);
+
+ mpz_set_ui (z, (unsigned long) UINT_MAX);
+ mpz_add_ui (z, z, 1L);
+ expr = "UINT_MAX + 1";
+ EXPECT (mpz_fits_uint_p, 0);
+
+
+ mpz_set_ui (z, ULONG_MAX);
+ expr = "ULONG_MAX";
+ EXPECT (mpz_fits_ulong_p, 1);
+
+ mpz_set_ui (z, ULONG_MAX);
+ mpz_add_ui (z, z, 1L);
+ expr = "ULONG_MAX + 1";
+ EXPECT (mpz_fits_ulong_p, 0);
+
+
+ mpz_set_si (z, (long) SHRT_MAX);
+ expr = "SHRT_MAX";
+ EXPECT (mpz_fits_slong_p, 1);
+ EXPECT (mpz_fits_sint_p, 1);
+ EXPECT (mpz_fits_sshort_p, 1);
+
+ mpz_set_si (z, (long) SHRT_MAX);
+ mpz_add_ui (z, z, 1L);
+ expr = "SHRT_MAX + 1";
+ EXPECT (mpz_fits_sshort_p, 0);
+
+
+ mpz_set_si (z, (long) INT_MAX);
+ expr = "INT_MAX";
+ EXPECT (mpz_fits_slong_p, 1);
+ EXPECT (mpz_fits_sint_p, 1);
+
+ mpz_set_si (z, (long) INT_MAX);
+ mpz_add_ui (z, z, 1L);
+ expr = "INT_MAX + 1";
+ EXPECT (mpz_fits_sint_p, 0);
+
+
+ mpz_set_si (z, LONG_MAX);
+ expr = "LONG_MAX";
+ EXPECT (mpz_fits_slong_p, 1);
+
+ mpz_set_si (z, LONG_MAX);
+ mpz_add_ui (z, z, 1L);
+ expr = "LONG_MAX + 1";
+ EXPECT (mpz_fits_slong_p, 0);
+
+
+ mpz_set_si (z, (long) SHRT_MIN);
+ expr = "SHRT_MIN";
+ EXPECT (mpz_fits_slong_p, 1);
+ EXPECT (mpz_fits_sint_p, 1);
+ EXPECT (mpz_fits_sshort_p, 1);
+
+ mpz_set_si (z, (long) SHRT_MIN);
+ mpz_sub_ui (z, z, 1L);
+ expr = "SHRT_MIN + 1";
+ EXPECT (mpz_fits_sshort_p, 0);
+
+
+ mpz_set_si (z, (long) INT_MIN);
+ expr = "INT_MIN";
+ EXPECT (mpz_fits_slong_p, 1);
+ EXPECT (mpz_fits_sint_p, 1);
+
+ mpz_set_si (z, (long) INT_MIN);
+ mpz_sub_ui (z, z, 1L);
+ expr = "INT_MIN + 1";
+ EXPECT (mpz_fits_sint_p, 0);
+
+
+ mpz_set_si (z, LONG_MIN);
+ expr = "LONG_MIN";
+ EXPECT (mpz_fits_slong_p, 1);
+
+ mpz_set_si (z, LONG_MIN);
+ mpz_sub_ui (z, z, 1L);
+ expr = "LONG_MIN + 1";
+ EXPECT (mpz_fits_slong_p, 0);
+
+
+ if (error)
+ abort ();
+
+ mpz_clear (z);
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-gcd.c b/vendor/gmp-6.3.0/tests/mpz/t-gcd.c
new file mode 100644
index 0000000..46b278a
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-gcd.c
@@ -0,0 +1,467 @@
+/* Test mpz_gcd, mpz_gcdext, and mpz_gcd_ui.
+
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2005, 2008, 2009, 2012 Free
+Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+void one_test (mpz_t, mpz_t, mpz_t, int);
+void debug_mp (mpz_t, int);
+
+static int gcdext_valid_p (const mpz_t, const mpz_t, const mpz_t, const mpz_t);
+
+/* Keep one_test's variables global, so that we don't need
+ to reinitialize them for each test. */
+mpz_t gcd1, gcd2, s, temp1, temp2, temp3;
+
+#define MAX_SCHOENHAGE_THRESHOLD HGCD_REDUCE_THRESHOLD
+
+/* Define this to make all operands be large enough for Schoenhage gcd
+ to be used. */
+#ifndef WHACK_SCHOENHAGE
+#define WHACK_SCHOENHAGE 0
+#endif
+
+#if WHACK_SCHOENHAGE
+#define MIN_OPERAND_BITSIZE (MAX_SCHOENHAGE_THRESHOLD * GMP_NUMB_BITS)
+#else
+#define MIN_OPERAND_BITSIZE 1
+#endif
+
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *a;
+ const char *b;
+ const char *want;
+ } data[] = {
+ /* This tickled a bug in gmp 4.1.2 mpn/x86/k6/gcd_finda.asm. */
+ { "0x3FFC000007FFFFFFFFFF00000000003F83FFFFFFFFFFFFFFF80000000000000001",
+ "0x1FFE0007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC000000000000000000000001",
+ "5" }
+ };
+
+ mpz_t a, b, got, want;
+ int i;
+
+ mpz_inits (a, b, got, want, NULL);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_str_or_abort (a, data[i].a, 0);
+ mpz_set_str_or_abort (b, data[i].b, 0);
+ mpz_set_str_or_abort (want, data[i].want, 0);
+ mpz_gcd (got, a, b);
+ MPZ_CHECK_FORMAT (got);
+ if (mpz_cmp (got, want) != 0)
+ {
+ printf ("mpz_gcd wrong on data[%d]\n", i);
+ printf (" a %s\n", data[i].a);
+ printf (" b %s\n", data[i].b);
+ mpz_trace (" a", a);
+ mpz_trace (" b", b);
+ mpz_trace (" want", want);
+ mpz_trace (" got ", got);
+ abort ();
+ }
+ }
+
+ mpz_clears (a, b, got, want, NULL);
+}
+
+void
+make_chain_operands (mpz_t ref, mpz_t a, mpz_t b, gmp_randstate_t rs, int nb1, int nb2, int chain_len)
+{
+ mpz_t bs, temp1, temp2;
+ int j;
+
+ mpz_inits (bs, temp1, temp2, NULL);
+
+ /* Generate a division chain backwards, allowing otherwise unlikely huge
+ quotients. */
+
+ mpz_set_ui (a, 0);
+ mpz_urandomb (bs, rs, 32);
+ mpz_urandomb (bs, rs, mpz_get_ui (bs) % nb1 + 1);
+ mpz_rrandomb (b, rs, mpz_get_ui (bs));
+ mpz_add_ui (b, b, 1);
+ mpz_set (ref, b);
+
+ for (j = 0; j < chain_len; j++)
+ {
+ mpz_urandomb (bs, rs, 32);
+ mpz_urandomb (bs, rs, mpz_get_ui (bs) % nb2 + 1);
+ mpz_rrandomb (temp2, rs, mpz_get_ui (bs) + 1);
+ mpz_add_ui (temp2, temp2, 1);
+ mpz_mul (temp1, b, temp2);
+ mpz_add (a, a, temp1);
+
+ mpz_urandomb (bs, rs, 32);
+ mpz_urandomb (bs, rs, mpz_get_ui (bs) % nb2 + 1);
+ mpz_rrandomb (temp2, rs, mpz_get_ui (bs) + 1);
+ mpz_add_ui (temp2, temp2, 1);
+ mpz_mul (temp1, a, temp2);
+ mpz_add (b, b, temp1);
+ }
+
+ mpz_clears (bs, temp1, temp2, NULL);
+}
+
+/* Test operands from a table of seed data. This variant creates the operands
+ using plain ol' mpz_rrandomb. This is a hack for better coverage of the gcd
+ code, which depends on that the random number generators give the exact
+ numbers we expect. */
+void
+check_kolmo1 (void)
+{
+ static const struct {
+ unsigned int seed;
+ int nb;
+ const char *want;
+ } data[] = {
+ { 59618, 38208, "5"},
+ { 76521, 49024, "3"},
+ { 85869, 54976, "1"},
+ { 99449, 63680, "1"},
+ {112453, 72000, "1"}
+ };
+
+ gmp_randstate_t rs;
+ mpz_t bs, a, b, want;
+ int i, unb, vnb, nb;
+
+ gmp_randinit_default (rs);
+
+ mpz_inits (bs, a, b, want, NULL);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ nb = data[i].nb;
+
+ gmp_randseed_ui (rs, data[i].seed);
+
+ mpz_urandomb (bs, rs, 32);
+ unb = mpz_get_ui (bs) % nb;
+ mpz_urandomb (bs, rs, 32);
+ vnb = mpz_get_ui (bs) % nb;
+
+ mpz_rrandomb (a, rs, unb);
+ mpz_rrandomb (b, rs, vnb);
+
+ mpz_set_str_or_abort (want, data[i].want, 0);
+
+ one_test (a, b, want, -1);
+ }
+
+ mpz_clears (bs, a, b, want, NULL);
+ gmp_randclear (rs);
+}
+
+/* Test operands from a table of seed data. This variant creates the operands
+ using a division chain. This is a hack for better coverage of the gcd
+ code, which depends on that the random number generators give the exact
+ numbers we expect. */
+void
+check_kolmo2 (void)
+{
+ static const struct {
+ unsigned int seed;
+ int nb, chain_len;
+ } data[] = {
+ { 917, 15, 5 },
+ { 1032, 18, 6 },
+ { 1167, 18, 6 },
+ { 1174, 18, 6 },
+ { 1192, 18, 6 },
+ };
+
+ gmp_randstate_t rs;
+ mpz_t bs, a, b, want;
+ int i;
+
+ gmp_randinit_default (rs);
+
+ mpz_inits (bs, a, b, want, NULL);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ gmp_randseed_ui (rs, data[i].seed);
+ make_chain_operands (want, a, b, rs, data[i].nb, data[i].nb, data[i].chain_len);
+ one_test (a, b, want, -1);
+ }
+
+ mpz_clears (bs, a, b, want, NULL);
+ gmp_randclear (rs);
+}
+
+int
+main (int argc, char **argv)
+{
+ mpz_t op1, op2, ref;
+ int i, chain_len;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+ long int reps = 200;
+
+ tests_start ();
+ TESTS_REPS (reps, argv, argc);
+
+ rands = RANDS;
+
+ mpz_inits (bs, op1, op2, ref, gcd1, gcd2, temp1, temp2, temp3, s, NULL);
+
+ check_data ();
+ check_kolmo1 ();
+ check_kolmo2 ();
+
+ /* Testcase to exercise the u0 == u1 case in mpn_gcdext_lehmer_n. */
+ /* mpz_set_ui (op2, GMP_NUMB_MAX); */ /* FIXME: Huge limb doesn't always fit */
+ mpz_set_ui (op2, 0);
+ mpz_setbit (op2, GMP_NUMB_BITS);
+ mpz_sub_ui (op2, op2, 1);
+ mpz_mul_2exp (op1, op2, 100);
+ mpz_add (op1, op1, op2);
+ mpz_mul_ui (op2, op2, 2);
+ one_test (op1, op2, NULL, -1);
+
+ for (i = 0; i < reps; i++)
+ {
+ /* Generate plain operands with unknown gcd. These types of operands
+ have proven to trigger certain bugs in development versions of the
+ gcd code. The "hgcd->row[3].rsize > M" ASSERT is not triggered by
+ the division chain code below, but that is most likely just a result
+ of that other ASSERTs are triggered before it. */
+
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 17 + 2;
+
+ mpz_urandomb (bs, rands, size_range);
+ mpz_rrandomb (op1, rands, mpz_get_ui (bs) + MIN_OPERAND_BITSIZE);
+ mpz_urandomb (bs, rands, size_range);
+ mpz_rrandomb (op2, rands, mpz_get_ui (bs) + MIN_OPERAND_BITSIZE);
+
+ mpz_urandomb (bs, rands, 8);
+ bsi = mpz_get_ui (bs);
+
+ if ((bsi & 0x3c) == 4)
+ mpz_mul (op1, op1, op2); /* make op1 a multiple of op2 */
+ else if ((bsi & 0x3c) == 8)
+ mpz_mul (op2, op1, op2); /* make op2 a multiple of op1 */
+
+ if ((bsi & 1) != 0)
+ mpz_neg (op1, op1);
+ if ((bsi & 2) != 0)
+ mpz_neg (op2, op2);
+
+ one_test (op1, op2, NULL, i);
+
+ /* Generate a division chain backwards, allowing otherwise unlikely huge
+ quotients. */
+
+ mpz_urandomb (bs, rands, 32);
+ chain_len = mpz_get_ui (bs) % LOG2C (GMP_NUMB_BITS * MAX_SCHOENHAGE_THRESHOLD);
+ mpz_urandomb (bs, rands, 32);
+ chain_len = mpz_get_ui (bs) % (1 << chain_len) / 32;
+
+ make_chain_operands (ref, op1, op2, rands, 16, 12, chain_len);
+
+ one_test (op1, op2, ref, i);
+ }
+
+ /* Check that we can use NULL as first argument of mpz_gcdext. */
+ mpz_set_si (op1, -10);
+ mpz_set_si (op2, 0);
+ mpz_gcdext (NULL, temp1, temp2, op1, op2);
+ ASSERT_ALWAYS (mpz_cmp_si (temp1, -1) == 0);
+ ASSERT_ALWAYS (mpz_cmp_si (temp2, 0) == 0);
+ mpz_set_si (op2, 6);
+ mpz_gcdext (NULL, temp1, temp2, op1, op2);
+ ASSERT_ALWAYS (mpz_cmp_si (temp1, 1) == 0);
+ ASSERT_ALWAYS (mpz_cmp_si (temp2, 2) == 0);
+
+ mpz_clears (bs, op1, op2, ref, gcd1, gcd2, temp1, temp2, temp3, s, NULL);
+
+ tests_end ();
+ exit (0);
+}
+
+void
+debug_mp (mpz_t x, int base)
+{
+ mpz_out_str (stderr, base, x); fputc ('\n', stderr);
+}
+
+void
+one_test (mpz_t op1, mpz_t op2, mpz_t ref, int i)
+{
+ /*
+ printf ("%d %d %d\n", SIZ (op1), SIZ (op2), ref != NULL ? SIZ (ref) : 0);
+ fflush (stdout);
+ */
+
+ /*
+ fprintf (stderr, "op1="); debug_mp (op1, -16);
+ fprintf (stderr, "op2="); debug_mp (op2, -16);
+ */
+
+ mpz_gcdext (gcd1, s, NULL, op1, op2);
+ MPZ_CHECK_FORMAT (gcd1);
+ MPZ_CHECK_FORMAT (s);
+
+ if (ref && mpz_cmp (ref, gcd1) != 0)
+ {
+ fprintf (stderr, "ERROR in test %d\n", i);
+ fprintf (stderr, "mpz_gcdext returned incorrect result\n");
+ fprintf (stderr, "op1="); debug_mp (op1, -16);
+ fprintf (stderr, "op2="); debug_mp (op2, -16);
+ fprintf (stderr, "expected result:\n"); debug_mp (ref, -16);
+ fprintf (stderr, "mpz_gcdext returns:\n");debug_mp (gcd1, -16);
+ abort ();
+ }
+
+ if (!gcdext_valid_p(op1, op2, gcd1, s))
+ {
+ fprintf (stderr, "ERROR in test %d\n", i);
+ fprintf (stderr, "mpz_gcdext returned invalid result\n");
+ fprintf (stderr, "op1="); debug_mp (op1, -16);
+ fprintf (stderr, "op2="); debug_mp (op2, -16);
+ fprintf (stderr, "mpz_gcdext returns:\n");debug_mp (gcd1, -16);
+ fprintf (stderr, "s="); debug_mp (s, -16);
+ abort ();
+ }
+
+ mpz_gcd (gcd2, op1, op2);
+ MPZ_CHECK_FORMAT (gcd2);
+
+ if (mpz_cmp (gcd2, gcd1) != 0)
+ {
+ fprintf (stderr, "ERROR in test %d\n", i);
+ fprintf (stderr, "mpz_gcd returned incorrect result\n");
+ fprintf (stderr, "op1="); debug_mp (op1, -16);
+ fprintf (stderr, "op2="); debug_mp (op2, -16);
+ fprintf (stderr, "expected result:\n"); debug_mp (gcd1, -16);
+ fprintf (stderr, "mpz_gcd returns:\n"); debug_mp (gcd2, -16);
+ abort ();
+ }
+
+ /* This should probably move to t-gcd_ui.c */
+ if (mpz_fits_ulong_p (op1) || mpz_fits_ulong_p (op2))
+ {
+ if (mpz_fits_ulong_p (op1))
+ mpz_gcd_ui (gcd2, op2, mpz_get_ui (op1));
+ else
+ mpz_gcd_ui (gcd2, op1, mpz_get_ui (op2));
+ if (mpz_cmp (gcd2, gcd1))
+ {
+ fprintf (stderr, "ERROR in test %d\n", i);
+ fprintf (stderr, "mpz_gcd_ui returned incorrect result\n");
+ fprintf (stderr, "op1="); debug_mp (op1, -16);
+ fprintf (stderr, "op2="); debug_mp (op2, -16);
+ fprintf (stderr, "expected result:\n"); debug_mp (gcd1, -16);
+ fprintf (stderr, "mpz_gcd_ui returns:\n"); debug_mp (gcd2, -16);
+ abort ();
+ }
+ }
+
+ mpz_gcdext (gcd2, temp1, temp2, op1, op2);
+ MPZ_CHECK_FORMAT (gcd2);
+ MPZ_CHECK_FORMAT (temp1);
+ MPZ_CHECK_FORMAT (temp2);
+
+ mpz_mul (temp1, temp1, op1);
+ mpz_mul (temp2, temp2, op2);
+ mpz_add (temp1, temp1, temp2);
+
+ if (mpz_cmp (gcd1, gcd2) != 0
+ || mpz_cmp (gcd2, temp1) != 0)
+ {
+ fprintf (stderr, "ERROR in test %d\n", i);
+ fprintf (stderr, "mpz_gcdext returned incorrect result\n");
+ fprintf (stderr, "op1="); debug_mp (op1, -16);
+ fprintf (stderr, "op2="); debug_mp (op2, -16);
+ fprintf (stderr, "expected result:\n"); debug_mp (gcd1, -16);
+ fprintf (stderr, "mpz_gcdext returns:\n");debug_mp (gcd2, -16);
+ abort ();
+ }
+}
+
+/* Called when g is supposed to be gcd(a,b), and g = s a + t b, for some t.
+ Uses temp1, temp2 and temp3. */
+static int
+gcdext_valid_p (const mpz_t a, const mpz_t b, const mpz_t g, const mpz_t s)
+{
+ /* It's not clear that gcd(0,0) is well defined, but we allow it and require that
+ gcd(0,0) = 0. */
+ if (mpz_sgn (g) < 0)
+ return 0;
+
+ if (mpz_sgn (a) == 0)
+ {
+ /* Must have g == abs (b). Any value for s is in some sense "correct",
+ but it makes sense to require that s == 0. */
+ return mpz_cmpabs (g, b) == 0 && mpz_sgn (s) == 0;
+ }
+ else if (mpz_sgn (b) == 0)
+ {
+ /* Must have g == abs (a), s == sign (a) */
+ return mpz_cmpabs (g, a) == 0 && mpz_cmp_si (s, mpz_sgn (a)) == 0;
+ }
+
+ if (mpz_sgn (g) <= 0)
+ return 0;
+
+ mpz_tdiv_qr (temp1, temp3, a, g);
+ if (mpz_sgn (temp3) != 0)
+ return 0;
+
+ mpz_tdiv_qr (temp2, temp3, b, g);
+ if (mpz_sgn (temp3) != 0)
+ return 0;
+
+ /* Require that 2 |s| < |b/g|, or |s| == 1. */
+ if (mpz_cmpabs_ui (s, 1) > 0)
+ {
+ mpz_mul_2exp (temp3, s, 1);
+ if (mpz_cmpabs (temp3, temp2) >= 0)
+ return 0;
+ }
+
+ /* Compute the other cofactor. */
+ mpz_mul(temp2, s, a);
+ mpz_sub(temp2, g, temp2);
+ mpz_tdiv_qr(temp2, temp3, temp2, b);
+
+ if (mpz_sgn (temp3) != 0)
+ return 0;
+
+ /* Require that 2 |t| < |a/g| or |t| == 1*/
+ if (mpz_cmpabs_ui (temp2, 1) > 0)
+ {
+ mpz_mul_2exp (temp2, temp2, 1);
+ if (mpz_cmpabs (temp2, temp1) >= 0)
+ return 0;
+ }
+ return 1;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-gcd_ui.c b/vendor/gmp-6.3.0/tests/mpz/t-gcd_ui.c
new file mode 100644
index 0000000..3f56a97
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-gcd_ui.c
@@ -0,0 +1,156 @@
+/* Test mpz_gcd_ui.
+
+Copyright 2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+/* Check mpz_gcd_ui doesn't try to return a value out of range.
+ This was wrong in gmp 4.1.2 with a long long limb. */
+static void
+check_ui_range (void)
+{
+ unsigned long got;
+ mpz_t x;
+ int i;
+
+ mpz_init_set_ui (x, ULONG_MAX);
+
+ for (i = 0; i < 20; i++)
+ {
+ mpz_mul_2exp (x, x, 1L);
+ got = mpz_gcd_ui (NULL, x, 0L);
+ if (got != 0)
+ {
+ printf ("mpz_gcd_ui (ULONG_MAX*2^%d, 0)\n", i);
+ printf (" return %#lx\n", got);
+ printf (" should be 0\n");
+ abort ();
+ }
+ }
+
+ mpz_clear (x);
+}
+
+static void
+check_ui_factors (void)
+{
+#define NUM_FACTORS 9
+ static const char* factors[NUM_FACTORS] = {
+ "641", "274177", "3", "5", "17", "257", "65537",
+ "59649589127497217", "1238926361552897" };
+ unsigned long got;
+ mpz_t x, b, d, f, g;
+ int i, j;
+ gmp_randstate_ptr rands;
+
+ if (GMP_NUMB_BITS < 5 || GMP_NUMB_BITS == 8
+ || GMP_NUMB_BITS == 16 || GMP_NUMB_BITS > 511)
+ {
+ printf ("No usable factors for 2^%i+1.\n", GMP_NUMB_BITS);
+ return;
+ }
+
+ mpz_init (x);
+ mpz_init (d);
+ mpz_init (f);
+ mpz_init (g);
+
+ mpz_setbit (x, GMP_NUMB_BITS);
+ mpz_add_ui (x, x, 1);
+
+ for (i = 0; i < NUM_FACTORS; ++i)
+ {
+ mpz_set_str (f, factors[i], 10);
+ if (mpz_divisible_p (x, f))
+ {
+ mpz_mul_2exp (f, f, 1);
+ /* d is an odd multiple of the factor f, exactly filling a limb. */
+ mpz_sub (d, x, f);
+ /* f = 2^GMP_NUMB_BITS mod d. */
+ mpz_sub_ui (f, f, 1);
+ break;
+ }
+ }
+
+ mpz_gcd (g, f, d);
+ if (mpz_even_p (d) || mpz_cmp (d, f) <= 0 || mpz_cmp_ui (g, 1) != 0)
+ {
+ printf ("No usable factor found.\n");
+ abort ();
+ }
+
+ rands = RANDS;
+ mpz_mul_ui (x, d, gmp_urandomm_ui (rands, 30000) + 1);
+
+ mpz_init (b);
+ mpz_setbit (b, GMP_NUMB_BITS - 1);
+ for (j = 0; j < 4; ++j)
+ {
+ mpz_add (x, x, b);
+
+ for (i = 1; i >= -1; --i)
+ {
+ if (mpz_fits_ulong_p (d)
+ && ((got = mpz_gcd_ui (NULL, x, mpz_get_ui (d)))
+ != (i != 0 ? 1 : mpz_get_ui (d))))
+ {
+ printf ("mpz_gcd_ui (f, kV+%i*2^%i, V): error (j = %i)\n", i, GMP_NUMB_BITS - 1, j);
+ printf (" return %#lx\n", got);
+ printf (" should be %#lx\n", (i != 0 ? 1 : mpz_get_ui (d)));
+ abort ();
+ }
+
+ mpz_gcd (g, x, d);
+ if ((mpz_cmp_ui (g, 1) == 0) != (i != 0))
+ {
+ printf ("mpz_gcd (f, kV+%i*2^%i, V): error (j = %i)\n", i, GMP_NUMB_BITS - 1, j);
+ printf (" should%s be one.\n",(i != 0 ? "" : " not"));
+ abort ();
+ }
+
+ mpz_sub (x, x, b);
+ }
+ /* Back to the original x. */
+ mpz_addmul_ui (x, b, 2);
+ mpz_mul (b, b, f);
+ mpz_mod (b, b, d);
+ }
+
+ mpz_clear (g);
+ mpz_clear (x);
+ mpz_clear (f);
+ mpz_clear (d);
+ mpz_clear (b);
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_ui_range ();
+ check_ui_factors ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-get_d.c b/vendor/gmp-6.3.0/tests/mpz/t-get_d.c
new file mode 100644
index 0000000..f4c839f
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-get_d.c
@@ -0,0 +1,80 @@
+/* Test mpz_get_d.
+
+Copyright 2002, 2012, 2020 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_onebit (void)
+{
+ int i;
+ mpz_t z;
+ double got, want;
+ /* FIXME: It'd be better to base this on the float format. */
+#if defined (__vax) || defined (__vax__)
+ int limit = 127 - 1; /* vax fp numbers have limited range */
+#else
+ int limit = 512;
+#endif
+
+ mpz_init (z);
+
+ got = mpz_get_d (z);
+ if (got != 0)
+ {
+ printf ("mpz_get_d wrong on zero\n");
+ abort();
+ }
+
+ mpz_set_ui (z, 1L);
+ want = 1.0;
+
+ for (i = 0; i < limit; i++)
+ {
+ got = mpz_get_d (z);
+
+ if (got != want)
+ {
+ printf ("mpz_get_d wrong on 2**%d\n", i);
+ mpz_trace (" z ", z);
+ printf (" want %.20g\n", want);
+ printf (" got %.20g\n", got);
+ abort();
+ }
+
+ mpz_mul_2exp (z, z, 1L);
+ want *= 2.0;
+ }
+ mpz_clear (z);
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_onebit ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-get_d_2exp.c b/vendor/gmp-6.3.0/tests/mpz/t-get_d_2exp.c
new file mode 100644
index 0000000..04cf1a4
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-get_d_2exp.c
@@ -0,0 +1,222 @@
+/* Test mpz_get_d_2exp.
+
+Copyright 2002, 2003, 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+static void
+check_zero (void)
+{
+ mpz_t z;
+ double got, want;
+ long got_exp, want_exp;
+
+ mpz_init_set_ui (z, 0);
+
+ want = 0.0;
+ want_exp = 0;
+ got = mpz_get_d_2exp (&got_exp, z);
+ if (got != want || got_exp != want_exp)
+ {
+ printf ("mpz_get_d_2exp wrong on zero\n");
+ mpz_trace (" z ", z);
+ d_trace (" want ", want);
+ d_trace (" got ", got);
+ printf (" want exp %ld\n", want_exp);
+ printf (" got exp %ld\n", got_exp);
+ abort();
+ }
+
+ mpz_clear (z);
+}
+
+static void
+check_onebit (void)
+{
+ static const unsigned long data[] = {
+ 1, 32, 52, 53, 54, 63, 64, 65, 128, 256, 511, 512, 513
+ };
+ mpz_t z;
+ double got, want;
+ long got_exp, want_exp;
+ int i;
+
+ mpz_init (z);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_ui (z, 1L);
+ mpz_mul_2exp (z, z, data[i]);
+ want = 0.5;
+ want_exp = data[i] + 1;
+ got = mpz_get_d_2exp (&got_exp, z);
+ if (got != want || got_exp != want_exp)
+ {
+ printf ("mpz_get_d_2exp wrong on 2**%ld\n", data[i]);
+ mpz_trace (" z ", z);
+ d_trace (" want ", want);
+ d_trace (" got ", got);
+ printf (" want exp %ld\n", want_exp);
+ printf (" got exp %ld\n", got_exp);
+ abort();
+ }
+
+ mpz_set_si (z, -1L);
+ mpz_mul_2exp (z, z, data[i]);
+ want = -0.5;
+ want_exp = data[i] + 1;
+ got = mpz_get_d_2exp (&got_exp, z);
+ if (got != want || got_exp != want_exp)
+ {
+ printf ("mpz_get_d_2exp wrong on -2**%ld\n", data[i]);
+ mpz_trace (" z ", z);
+ d_trace (" want ", want);
+ d_trace (" got ", got);
+ printf (" want exp %ld\n", want_exp);
+ printf (" got exp %ld\n", got_exp);
+ abort();
+ }
+ }
+ mpz_clear (z);
+}
+
+/* Check that hardware rounding doesn't make mpz_get_d_2exp return a value
+ outside its defined range. */
+static void
+check_round (void)
+{
+ static const unsigned long data[] = { 1, 32, 53, 54, 64, 128, 256, 512 };
+ mpz_t z;
+ double got;
+ long got_exp;
+ int i, rnd_mode, old_rnd_mode;
+
+ mpz_init (z);
+ old_rnd_mode = tests_hardware_getround ();
+
+ for (rnd_mode = 0; rnd_mode < 4; rnd_mode++)
+ {
+ tests_hardware_setround (rnd_mode);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_ui (z, 1L);
+ mpz_mul_2exp (z, z, data[i]);
+ mpz_sub_ui (z, z, 1L);
+
+ got = mpz_get_d_2exp (&got_exp, z);
+ if (got < 0.5 || got >= 1.0)
+ {
+ printf ("mpz_get_d_2exp wrong on 2**%lu-1\n", data[i]);
+ printf ("result out of range, expect 0.5 <= got < 1.0\n");
+ printf (" rnd_mode = %d\n", rnd_mode);
+ printf (" data[i] = %lu\n", data[i]);
+ mpz_trace (" z ", z);
+ d_trace (" got ", got);
+ printf (" got exp %ld\n", got_exp);
+ abort();
+ }
+
+ mpz_neg (z, z);
+ got = mpz_get_d_2exp (&got_exp, z);
+ if (got <= -1.0 || got > -0.5)
+ {
+ printf ("mpz_get_d_2exp wrong on -2**%lu-1\n", data[i]);
+ printf ("result out of range, expect -1.0 < got <= -0.5\n");
+ printf (" rnd_mode = %d\n", rnd_mode);
+ printf (" data[i] = %lu\n", data[i]);
+ mpz_trace (" z ", z);
+ d_trace (" got ", got);
+ printf (" got exp %ld\n", got_exp);
+ abort();
+ }
+ }
+ }
+
+ mpz_clear (z);
+ tests_hardware_setround (old_rnd_mode);
+}
+
+static void
+check_rand (void)
+{
+ gmp_randstate_ptr rands = RANDS;
+ int i;
+ mpz_t z;
+ double got;
+ long got_exp;
+ unsigned long bits;
+
+ mpz_init (z);
+
+ for (i = 0; i < 200; i++)
+ {
+ bits = gmp_urandomm_ui (rands, 512L);
+ mpz_urandomb (z, rands, bits);
+
+ got = mpz_get_d_2exp (&got_exp, z);
+ if (mpz_sgn (z) == 0)
+ continue;
+ bits = mpz_sizeinbase (z, 2);
+
+ if (got < 0.5 || got >= 1.0)
+ {
+ printf ("mpz_get_d_2exp out of range, expect 0.5 <= got < 1.0\n");
+ mpz_trace (" z ", z);
+ d_trace (" got ", got);
+ printf (" got exp %ld\n", got_exp);
+ abort();
+ }
+
+ /* FIXME: If mpz_get_d_2exp rounds upwards we might have got_exp ==
+ bits+1, so leave this test disabled until we decide if that's what
+ should happen, or not. */
+#if 0
+ if (got_exp != bits)
+ {
+ printf ("mpz_get_d_2exp wrong exponent\n", i);
+ mpz_trace (" z ", z);
+ d_trace (" bits ", bits);
+ d_trace (" got ", got);
+ printf (" got exp %ld\n", got_exp);
+ abort();
+ }
+#endif
+ }
+ mpz_clear (z);
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+ mp_trace_base = -16;
+
+ check_zero ();
+ check_onebit ();
+ check_round ();
+ check_rand ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-get_si.c b/vendor/gmp-6.3.0/tests/mpz/t-get_si.c
new file mode 100644
index 0000000..51f104a
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-get_si.c
@@ -0,0 +1,121 @@
+/* Exercise mpz_get_si.
+
+Copyright 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *n;
+ long want;
+ } data[] = {
+ { "0", 0L },
+ { "1", 1L },
+ { "-1", -1L },
+ { "2", 2L },
+ { "-2", -2L },
+ { "12345", 12345L },
+ { "-12345", -12345L },
+ };
+
+ int i;
+ mpz_t n;
+ long got;
+
+ mpz_init (n);
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_str_or_abort (n, data[i].n, 0);
+
+ got = mpz_get_si (n);
+ if (got != data[i].want)
+ {
+ printf ("mpz_get_si wrong at data[%d]\n", i);
+ printf (" n \"%s\" (", data[i].n);
+ mpz_out_str (stdout, 10, n); printf (", hex ");
+ mpz_out_str (stdout, 16, n); printf (")\n");
+ printf (" got %ld (0x%lX)\n", got, got);
+ printf (" want %ld (0x%lX)\n", data[i].want, data[i].want);
+ abort();
+ }
+ }
+ mpz_clear (n);
+}
+
+
+void
+check_max (void)
+{
+ mpz_t n;
+ long want;
+ long got;
+
+ mpz_init (n);
+
+#define CHECK_MAX(name) \
+ if (got != want) \
+ { \
+ printf ("mpz_get_si wrong on %s\n", name); \
+ printf (" n "); \
+ mpz_out_str (stdout, 10, n); printf (", hex "); \
+ mpz_out_str (stdout, 16, n); printf ("\n"); \
+ printf (" got %ld, hex %lX\n", got, got); \
+ printf (" want %ld, hex %lX\n", want, want); \
+ abort(); \
+ }
+
+ want = LONG_MAX;
+ mpz_set_si (n, want);
+ got = mpz_get_si (n);
+ CHECK_MAX ("LONG_MAX");
+
+ want = LONG_MIN;
+ mpz_set_si (n, want);
+ got = mpz_get_si (n);
+ CHECK_MAX ("LONG_MIN");
+
+ /* The following checks that -0x100000000 gives -0x80000000. This doesn't
+ actually fit in a long and the result from mpz_get_si() is undefined,
+ but -0x80000000 is what comes out currently, and it should be that
+ value irrespective of the mp_limb_t size (long or long long). */
+
+ want = LONG_MIN;
+ mpz_mul_2exp (n, n, 1);
+ CHECK_MAX ("-0x100...00");
+
+ mpz_clear (n);
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_data ();
+ check_max ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-hamdist.c b/vendor/gmp-6.3.0/tests/mpz/t-hamdist.c
new file mode 100644
index 0000000..544a03f
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-hamdist.c
@@ -0,0 +1,123 @@
+/* Test mpz_hamdist.
+
+Copyright 2001, 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_twobits (void)
+{
+ unsigned long i, j, got, want;
+ mpz_t x, y;
+
+ mpz_init (x);
+ mpz_init (y);
+ for (i = 0; i < 5 * GMP_NUMB_BITS; i++)
+ {
+ for (j = 0; j < 5 * GMP_NUMB_BITS; j++)
+ {
+ mpz_set_ui (x, 0L);
+ mpz_setbit (x, i);
+ mpz_set_ui (y, 0L);
+ mpz_setbit (y, j);
+
+ want = 2 * (i != j);
+ got = mpz_hamdist (x, y);
+ if (got != want)
+ {
+ printf ("mpz_hamdist wrong on 2 bits pos/pos\n");
+ wrong:
+ printf (" i %lu\n", i);
+ printf (" j %lu\n", j);
+ printf (" got %lu\n", got);
+ printf (" want %lu\n", want);
+ mpz_trace (" x ", x);
+ mpz_trace (" y ", y);
+ abort();
+ }
+
+ mpz_neg (x, x);
+ mpz_neg (y, y);
+ want = ABS ((long) (i-j));
+ got = mpz_hamdist (x, y);
+ if (got != want)
+ {
+ printf ("mpz_hamdist wrong on 2 bits neg/neg\n");
+ goto wrong;
+ }
+ }
+
+ }
+ mpz_clear (x);
+ mpz_clear (y);
+}
+
+
+void
+check_rand (void)
+{
+ gmp_randstate_ptr rands = RANDS;
+ unsigned long got, want;
+ int i;
+ mpz_t x, y;
+
+ mpz_init (x);
+ mpz_init (y);
+
+ for (i = 0; i < 2000; i++)
+ {
+ mpz_erandomb (x, rands, 6 * GMP_NUMB_BITS);
+ mpz_negrandom (x, rands);
+ mpz_mul_2exp (x, x, urandom() % (4 * GMP_NUMB_BITS));
+
+ mpz_erandomb (y, rands, 6 * GMP_NUMB_BITS);
+ mpz_negrandom (y, rands);
+ mpz_mul_2exp (y, y, urandom() % (4 * GMP_NUMB_BITS));
+
+ want = refmpz_hamdist (x, y);
+ got = mpz_hamdist (x, y);
+ if (got != want)
+ {
+ printf ("mpz_hamdist wrong on random\n");
+ printf (" got %lu\n", got);
+ printf (" want %lu\n", want);
+ mpz_trace (" x ", x);
+ mpz_trace (" y ", y);
+ abort();
+ }
+ }
+ mpz_clear (x);
+ mpz_clear (y);
+}
+
+int
+main (void)
+{
+ tests_start ();
+ mp_trace_base = -16;
+
+ check_twobits ();
+ check_rand ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-import.c b/vendor/gmp-6.3.0/tests/mpz/t-import.c
new file mode 100644
index 0000000..a295317
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-import.c
@@ -0,0 +1,175 @@
+/* Test mpz_import.
+
+Copyright 2002, 2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *want;
+ size_t count;
+ int order;
+ size_t size;
+ int endian;
+ int nail;
+ char src[64];
+
+ } data[] = {
+
+ { "0", 0,1, 1,1, 0 },
+ { "0", 1,1, 0,1, 0 },
+
+ { "0x12345678", 4,1, 1,1, 0, { '\22', '\64', '\126', '\170' } },
+ { "0x12345678", 1,1, 4,1, 0, { '\22', '\64', '\126', '\170' } },
+ { "0x12345678", 1,-1, 4,1, 0, { '\22', '\64', '\126', '\170' } },
+
+ { "0x12345678", 4,-1, 1,-1, 0, { '\170', '\126', '\064', '\22' } },
+ { "0x12345678", 1,1, 4,-1, 0, { '\170', '\126', '\064', '\22' } },
+ { "0x12345678", 1,-1, 4,-1, 0, { '\170', '\126', '\064', '\22' } },
+
+ { "0", 5,1, 1,1, 7, { '\376', '\376', '\376', '\376', '\376' } },
+ { "0", 5,-1, 1,1, 7, { '\376', '\376', '\376', '\376', '\376' } },
+ { "0x15", 5,1, 1,1, 7, { '\377', '\376', '\377', '\376', '\377' } },
+
+ { "0", 3,1, 2,1, 1, { '\200','\000', '\200','\000', '\200','\000' }},
+ { "0", 3,1, 2,-1, 1, { '\000','\200', '\000','\200', '\000','\200' }},
+ { "0", 3,1, 2,1, 15, { '\377','\376', '\377','\376', '\377','\376' }},
+
+ { "0x2A", 3,1, 2,1, 14, { '\377','\376', '\377','\376', '\377','\376' } },
+ { "0x06", 3,1, 2,1, 14, { '\377','\374', '\377','\375', '\377','\376' } },
+ { "0x24", 3,-1, 2,1, 14, { '\377','\374', '\377','\375', '\377','\376' } },
+
+ { "0x123456789ABC", 3,1, 2,1, 0, {
+ '\022','\064', '\126','\170', '\232','\274' } },
+ { "0x123456789ABC", 3,-1, 2,1, 0, {
+ '\232','\274', '\126','\170', '\022','\064' } },
+ { "0x123456789ABC", 3,1, 2,-1, 0, {
+ '\064','\022', '\170','\126', '\274','\232' } },
+ { "0x123456789ABC", 3,-1, 2,-1, 0, {
+ '\274','\232', '\170','\126', '\064','\022' } },
+
+ { "0x112233445566778899AABBCC", 3,1, 4,1, 0,
+ { '\021','\042','\063','\104',
+ '\125','\146','\167','\210',
+ '\231','\252','\273','\314' } },
+ { "0x112233445566778899AABBCC", 3,-1, 4,1, 0,
+ { '\231','\252','\273','\314',
+ '\125','\146','\167','\210',
+ '\021','\042','\063','\104' } },
+ { "0x112233445566778899AABBCC", 3,1, 4,-1, 0,
+ { '\104','\063','\042','\021',
+ '\210','\167','\146','\125',
+ '\314','\273','\252','\231' } },
+ { "0x112233445566778899AABBCC", 3,-1, 4,-1, 0,
+ { '\314','\273','\252','\231',
+ '\210','\167','\146','\125',
+ '\104','\063','\042','\021' } },
+
+ { "0x100120023003400450056006700780089009A00AB00BC00C", 3,1, 8,1, 0,
+ { '\020','\001','\040','\002','\060','\003','\100','\004',
+ '\120','\005','\140','\006','\160','\007','\200','\010',
+ '\220','\011','\240','\012','\260','\013','\300','\014' } },
+ { "0x100120023003400450056006700780089009A00AB00BC00C", 3,-1, 8,1, 0,
+ { '\220','\011','\240','\012','\260','\013','\300','\014',
+ '\120','\005','\140','\006','\160','\007','\200','\010',
+ '\020','\001','\040','\002','\060','\003','\100','\004' } },
+ { "0x100120023003400450056006700780089009A00AB00BC00C", 3,1, 8,-1, 0,
+ { '\004','\100','\003','\060','\002','\040','\001','\020',
+ '\010','\200','\007','\160','\006','\140','\005','\120',
+ '\014','\300','\013','\260','\012','\240','\011','\220' } },
+ { "0x100120023003400450056006700780089009A00AB00BC00C", 3,-1, 8,-1, 0,
+ { '\014','\300','\013','\260','\012','\240','\011','\220',
+ '\010','\200','\007','\160','\006','\140','\005','\120',
+ '\004','\100','\003','\060','\002','\040','\001','\020' } },
+
+ { "0x155555555555555555555555", 3,1, 4,1, 1,
+ { '\325','\125','\125','\125',
+ '\252','\252','\252','\252',
+ '\325','\125','\125','\125' } },
+ { "0x155555555555555555555555", 3,-1, 4,1, 1,
+ { '\325','\125','\125','\125',
+ '\252','\252','\252','\252',
+ '\325','\125','\125','\125' } },
+ { "0x155555555555555555555555", 3,1, 4,-1, 1,
+ { '\125','\125','\125','\325',
+ '\252','\252','\252','\252',
+ '\125','\125','\125','\325' } },
+ { "0x155555555555555555555555", 3,-1, 4,-1, 1,
+ { '\125','\125','\125','\325',
+ '\252','\252','\252','\252',
+ '\125','\125','\125','\325' } },
+ };
+
+ char buf[sizeof(data[0].src) + sizeof (mp_limb_t)];
+ char *src;
+ size_t align;
+ int i;
+ mpz_t got, want;
+
+ mpz_init (got);
+ mpz_init (want);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ for (align = 0; align < sizeof (mp_limb_t); align++)
+ {
+ mpz_set_str_or_abort (want, data[i].want, 0);
+ src = buf + align;
+ memcpy (src, data[i].src, data[i].count * data[i].size);
+
+ mpz_set_ui (got, 0L);
+ mpz_import (got, data[i].count, data[i].order,
+ data[i].size, data[i].endian, data[i].nail, src);
+
+ MPZ_CHECK_FORMAT (got);
+ if (mpz_cmp (got, want) != 0)
+ {
+ printf ("wrong at data[%d]\n", i);
+ printf (" count=%lu order=%d size=%lu endian=%d nail=%u align=%lu\n",
+ (unsigned long) data[i].count, data[i].order,
+ (unsigned long) data[i].size, data[i].endian, data[i].nail,
+ (unsigned long) align);
+ mpz_trace (" got ", got);
+ mpz_trace (" want", want);
+ abort ();
+ }
+ }
+ }
+ mpz_clear (got);
+ mpz_clear (want);
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+
+ mp_trace_base = -16;
+ check_data ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-inp_str.c b/vendor/gmp-6.3.0/tests/mpz/t-inp_str.c
new file mode 100644
index 0000000..e686de5
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-inp_str.c
@@ -0,0 +1,198 @@
+/* Test mpz_inp_str.
+
+Copyright 2001, 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#if HAVE_UNISTD_H
+#include <unistd.h> /* for unlink */
+#endif
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+#define FILENAME "t-inp_str.tmp"
+
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *inp;
+ int base;
+ const char *want;
+ int want_nread;
+
+ } data[] = {
+
+ { "0", 10, "0", 1 },
+
+ { "abc", 10, "0", 0 },
+ { "0xf", 10, "0", 1 },
+ { "ghi", 16, "0", 0 },
+ { "100", 90, "0", 0 },
+
+ { "ff", 16, "255", 2 },
+ { "-ff", 16, "-255", 3 },
+ { "FF", 16, "255", 2 },
+ { "-FF", 16, "-255", 3 },
+
+ { "z", 36, "35", 1 },
+ { "Z", 36, "35", 1 },
+ { "1B", 59, "70", 2 },
+ { "a", 60, "36", 1 },
+ { "A", 61, "10", 1 },
+
+ { "0x0", 0, "0", 3 },
+ { "0X10", 0, "16", 4 },
+ { "-0X0", 0, "0", 4 },
+ { "-0x10", 0, "-16", 5 },
+
+ { "0b0", 0, "0", 3 },
+ { "0B10", 0, "2", 4 },
+ { "-0B0", 0, "0", 4 },
+ { "-0b10", 0, "-2", 5 },
+
+ { "00", 0, "0", 2 },
+ { "010", 0, "8", 3 },
+ { "-00", 0, "0", 3 },
+ { "-010", 0, "-8", 4 },
+
+ { "0x", 0, "0", 2 },
+ { "0", 0, "0", 1 },
+ { " 030", 10, "30", 4 },
+ };
+
+ mpz_t got, want;
+ long ftell_nread;
+ int i, pre, post, j, got_nread, want_nread;
+ FILE *fp;
+
+ mpz_init (got);
+ mpz_init (want);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ for (pre = 0; pre <= 3; pre++)
+ {
+ for (post = 0; post <= 2; post++)
+ {
+ mpz_set_str_or_abort (want, data[i].want, 0);
+ MPZ_CHECK_FORMAT (want);
+
+ /* create the file new each time to ensure its length is what
+ we want */
+ fp = fopen (FILENAME, "w+");
+ ASSERT_ALWAYS (fp != NULL);
+ for (j = 0; j < pre; j++)
+ putc (' ', fp);
+ fputs (data[i].inp, fp);
+ for (j = 0; j < post; j++)
+ putc (' ', fp);
+ fflush (fp);
+ ASSERT_ALWAYS (! ferror(fp));
+
+ rewind (fp);
+ got_nread = mpz_inp_str (got, fp, data[i].base);
+
+ if (got_nread != 0)
+ {
+ ftell_nread = ftell (fp);
+ if (got_nread != ftell_nread)
+ {
+ printf ("mpz_inp_str nread wrong\n");
+ printf (" inp \"%s\"\n", data[i].inp);
+ printf (" base %d\n", data[i].base);
+ printf (" pre %d\n", pre);
+ printf (" post %d\n", post);
+ printf (" got_nread %d\n", got_nread);
+ printf (" ftell_nread %ld\n", ftell_nread);
+ abort ();
+ }
+ }
+
+ /* if data[i].inp is a whole string to read and there's no post
+ whitespace then expect to have EOF */
+ if (post == 0 && data[i].want_nread == strlen(data[i].inp))
+ {
+ int c = getc(fp);
+ if (c != EOF)
+ {
+ printf ("mpz_inp_str didn't read to EOF\n");
+ printf (" inp \"%s\"\n", data[i].inp);
+ printf (" base %d\n", data[i].base);
+ printf (" pre %d\n", pre);
+ printf (" post %d\n", post);
+ printf (" c '%c' %#x\n", c, c);
+ abort ();
+ }
+ }
+
+ /* only expect "pre" included in the count when non-zero */
+ want_nread = data[i].want_nread;
+ if (want_nread != 0)
+ want_nread += pre;
+
+ if (got_nread != want_nread)
+ {
+ printf ("mpz_inp_str nread wrong\n");
+ printf (" inp \"%s\"\n", data[i].inp);
+ printf (" base %d\n", data[i].base);
+ printf (" pre %d\n", pre);
+ printf (" post %d\n", post);
+ printf (" got_nread %d\n", got_nread);
+ printf (" want_nread %d\n", want_nread);
+ abort ();
+ }
+
+ MPZ_CHECK_FORMAT (got);
+
+ if (mpz_cmp (got, want) != 0)
+ {
+ printf ("mpz_inp_str wrong result\n");
+ printf (" inp \"%s\"\n", data[i].inp);
+ printf (" base %d\n", data[i].base);
+ mpz_trace (" got ", got);
+ mpz_trace (" want", want);
+ abort ();
+ }
+
+ ASSERT_ALWAYS (fclose (fp) == 0);
+ }
+ }
+ }
+
+ mpz_clear (got);
+ mpz_clear (want);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_data ();
+
+ unlink (FILENAME);
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-invert.c b/vendor/gmp-6.3.0/tests/mpz/t-invert.c
new file mode 100644
index 0000000..0081c49
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-invert.c
@@ -0,0 +1,117 @@
+/* Test mpz_invert.
+
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2005, 2008, 2009, 2012, 2014 Free
+Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+int
+main (int argc, char **argv)
+{
+ mpz_t a, m, ainv, t;
+ int test, r;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+ int reps = 1000;
+
+ tests_start ();
+ TESTS_REPS (reps, argv, argc);
+
+ rands = RANDS;
+
+ mpz_init (bs);
+ mpz_init (a);
+ mpz_init (m);
+ mpz_init (ainv);
+ mpz_init (t);
+
+ for (test = 0; test < reps; test++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 16 + 2;
+
+ mpz_urandomb (bs, rands, size_range);
+ mpz_rrandomb (a, rands, mpz_get_ui (bs));
+ do {
+ mpz_urandomb (bs, rands, size_range);
+ mpz_rrandomb (m, rands, mpz_get_ui (bs));
+ } while (mpz_sgn (m) == 0);
+
+ mpz_urandomb (bs, rands, 8);
+ bsi = mpz_get_ui (bs);
+
+ if ((bsi & 1) != 0)
+ mpz_neg (a, a);
+ if ((bsi & 2) != 0)
+ mpz_neg (m, m);
+
+ r = mpz_invert (ainv, a, m);
+ if (r != 0)
+ {
+ MPZ_CHECK_FORMAT (ainv);
+
+ if (mpz_cmp_ui (ainv, 0) < 0 || mpz_cmpabs (ainv, m) >= 0)
+ {
+ fprintf (stderr, "ERROR in test %d\n", test);
+ gmp_fprintf (stderr, "Inverse out of range.\n");
+ gmp_fprintf (stderr, "a = %Zx\n", a);
+ gmp_fprintf (stderr, "1/a = %Zx\n", ainv);
+ gmp_fprintf (stderr, "m = %Zx\n", m);
+ abort ();
+ }
+
+ mpz_mul (t, ainv, a);
+ mpz_mod (t, t, m);
+
+ if (mpz_cmp_ui (t, mpz_cmpabs_ui (m, 1) != 0) != 0)
+ {
+ fprintf (stderr, "ERROR in test %d\n", test);
+ gmp_fprintf (stderr, "a^(-1)*a != 1 (mod m)\n");
+ gmp_fprintf (stderr, "a = %Zx\n", a);
+ gmp_fprintf (stderr, "m = %Zx\n", m);
+ abort ();
+ }
+ }
+ else /* Inverse deos not exist */
+ {
+ mpz_gcd (t, a, m);
+ if (mpz_cmp_ui (t, 1) == 0)
+ {
+ fprintf (stderr, "ERROR in test %d\n", test);
+ gmp_fprintf (stderr, "Inverse exists, but was not found.\n");
+ gmp_fprintf (stderr, "a = %Zx\n", a);
+ gmp_fprintf (stderr, "m = %Zx\n", m);
+ abort ();
+ }
+ }
+ }
+
+ mpz_clear (bs);
+ mpz_clear (a);
+ mpz_clear (m);
+ mpz_clear (ainv);
+ mpz_clear (t);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-io_raw.c b/vendor/gmp-6.3.0/tests/mpz/t-io_raw.c
new file mode 100644
index 0000000..e299b5a
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-io_raw.c
@@ -0,0 +1,286 @@
+/* Test mpz_inp_raw and mpz_out_raw.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#define FILENAME "t-io_raw.tmp"
+
+
+/* In the fopen, "b" selects binary mode on DOS systems, meaning no
+ conversion of '\n' to and from CRLF. It's believed systems without such
+ nonsense will simply ignore the "b", but in case that's not so a plain
+ "w+" is attempted if "w+b" fails. */
+
+FILE *
+fopen_wplusb_or_die (const char *filename)
+{
+ FILE *fp;
+ fp = fopen (filename, "w+b");
+ if (fp == NULL)
+ fp = fopen (filename, "w+");
+
+ if (fp == NULL)
+ {
+ printf ("Cannot create file %s\n", filename);
+ abort ();
+ }
+ return fp;
+}
+
+/* use 0x80 to check nothing bad happens with sign extension etc */
+#define BYTEVAL(i) (((i) + 1) | 0x80)
+
+void
+check_in (void)
+{
+ int i, j, zeros, neg, error = 0;
+ mpz_t want, got;
+ size_t want_ret, got_ret;
+ mp_size_t size;
+ FILE *fp;
+
+ mpz_init (want);
+ mpz_init (got);
+
+ for (i = 0; i < 32; i++)
+ {
+ for (zeros = 0; zeros < 8; zeros++)
+ {
+ for (neg = 0; neg <= 1; neg++)
+ {
+ want_ret = i + zeros + 4;
+
+ /* need this to get the twos complement right */
+ ASSERT_ALWAYS (sizeof (size) >= 4);
+
+ size = i + zeros;
+ if (neg)
+ size = -size;
+
+ fp = fopen_wplusb_or_die (FILENAME);
+ for (j = 3; j >= 0; j--)
+ ASSERT_ALWAYS (putc ((size >> (j*8)) & 0xFF, fp) != EOF);
+ for (j = 0; j < zeros; j++)
+ ASSERT_ALWAYS (putc ('\0', fp) != EOF);
+ for (j = 0; j < i; j++)
+ ASSERT_ALWAYS (putc (BYTEVAL (j), fp) != EOF);
+ /* and some trailing garbage */
+ ASSERT_ALWAYS (putc ('x', fp) != EOF);
+ ASSERT_ALWAYS (putc ('y', fp) != EOF);
+ ASSERT_ALWAYS (putc ('z', fp) != EOF);
+ ASSERT_ALWAYS (fflush (fp) == 0);
+ rewind (fp);
+
+ got_ret = mpz_inp_raw (got, fp);
+ ASSERT_ALWAYS (! ferror(fp));
+ ASSERT_ALWAYS (fclose (fp) == 0);
+
+ MPZ_CHECK_FORMAT (got);
+
+ if (got_ret != want_ret)
+ {
+ printf ("check_in: return value wrong\n");
+ error = 1;
+ }
+ if (mpz_cmp (got, want) != 0)
+ {
+ printf ("check_in: result wrong\n");
+ error = 1;
+ }
+ if (error)
+ {
+ printf (" i=%d zeros=%d neg=%d\n", i, zeros, neg);
+ printf (" got_ret %lu\n", (unsigned long) got_ret);
+ printf (" want_ret %lu\n", (unsigned long) want_ret);
+ mpz_trace (" got ", got);
+ mpz_trace (" want ", want);
+ abort ();
+ }
+
+ mpz_neg (want, want);
+ }
+ }
+ mpz_mul_2exp (want, want, 8);
+ mpz_add_ui (want, want, (unsigned long) BYTEVAL (i));
+ }
+
+ mpz_clear (want);
+ mpz_clear (got);
+}
+
+
+void
+check_out (void)
+{
+ int i, j, neg, error = 0;
+ mpz_t z;
+ char want[256], got[256], *p;
+ size_t want_len, got_ret, got_read;
+ mp_size_t size;
+ FILE *fp;
+
+ mpz_init (z);
+
+ for (i = 0; i < 32; i++)
+ {
+ for (neg = 0; neg <= 1; neg++)
+ {
+ want_len = i + 4;
+
+ /* need this to get the twos complement right */
+ ASSERT_ALWAYS (sizeof (size) >= 4);
+
+ size = i;
+ if (neg)
+ size = -size;
+
+ p = want;
+ for (j = 3; j >= 0; j--)
+ *p++ = size >> (j*8);
+ for (j = 0; j < i; j++)
+ *p++ = BYTEVAL (j);
+ ASSERT_ALWAYS (p <= want + sizeof (want));
+
+ fp = fopen_wplusb_or_die (FILENAME);
+ got_ret = mpz_out_raw (fp, z);
+ ASSERT_ALWAYS (fflush (fp) == 0);
+ rewind (fp);
+ got_read = fread (got, 1, sizeof(got), fp);
+ ASSERT_ALWAYS (! ferror(fp));
+ ASSERT_ALWAYS (fclose (fp) == 0);
+
+ if (got_ret != want_len)
+ {
+ printf ("check_out: wrong return value\n");
+ error = 1;
+ }
+ if (got_read != want_len)
+ {
+ printf ("check_out: wrong number of bytes read back\n");
+ error = 1;
+ }
+ if (memcmp (want, got, want_len) != 0)
+ {
+ printf ("check_out: wrong data\n");
+ error = 1;
+ }
+ if (error)
+ {
+ printf (" i=%d neg=%d\n", i, neg);
+ mpz_trace (" z", z);
+ printf (" got_ret %lu\n", (unsigned long) got_ret);
+ printf (" got_read %lu\n", (unsigned long) got_read);
+ printf (" want_len %lu\n", (unsigned long) want_len);
+ printf (" want");
+ for (j = 0; j < want_len; j++)
+ printf (" %02X", (unsigned) (unsigned char) want[j]);
+ printf ("\n");
+ printf (" got ");
+ for (j = 0; j < want_len; j++)
+ printf (" %02X", (unsigned) (unsigned char) got[j]);
+ printf ("\n");
+ abort ();
+ }
+
+ mpz_neg (z, z);
+ }
+ mpz_mul_2exp (z, z, 8);
+ mpz_add_ui (z, z, (unsigned long) BYTEVAL (i));
+ }
+
+ mpz_clear (z);
+}
+
+
+void
+check_rand (void)
+{
+ gmp_randstate_ptr rands = RANDS;
+ int i, error = 0;
+ mpz_t got, want;
+ size_t inp_ret, out_ret;
+ FILE *fp;
+
+ mpz_init (want);
+ mpz_init (got);
+
+ for (i = 0; i < 500; i++)
+ {
+ mpz_erandomb (want, rands, 10*GMP_LIMB_BITS);
+ mpz_negrandom (want, rands);
+
+ fp = fopen_wplusb_or_die (FILENAME);
+ out_ret = mpz_out_raw (fp, want);
+ ASSERT_ALWAYS (fflush (fp) == 0);
+ rewind (fp);
+ inp_ret = mpz_inp_raw (got, fp);
+ ASSERT_ALWAYS (fclose (fp) == 0);
+
+ MPZ_CHECK_FORMAT (got);
+
+ if (inp_ret != out_ret)
+ {
+ printf ("check_rand: different inp/out return values\n");
+ error = 1;
+ }
+ if (mpz_cmp (got, want) != 0)
+ {
+ printf ("check_rand: wrong result\n");
+ error = 1;
+ }
+ if (error)
+ {
+ printf (" out_ret %lu\n", (unsigned long) out_ret);
+ printf (" inp_ret %lu\n", (unsigned long) inp_ret);
+ mpz_trace (" want", want);
+ mpz_trace (" got ", got);
+ abort ();
+ }
+ }
+
+ mpz_clear (got);
+ mpz_clear (want);
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+ mp_trace_base = -16;
+
+ check_in ();
+ check_out ();
+ check_rand ();
+
+ unlink (FILENAME);
+ tests_end ();
+
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-jac.c b/vendor/gmp-6.3.0/tests/mpz/t-jac.c
new file mode 100644
index 0000000..ed8aff8
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-jac.c
@@ -0,0 +1,1008 @@
+/* Exercise mpz_*_kronecker_*() and mpz_jacobi() functions.
+
+Copyright 1999-2004, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+/* With no arguments the various Kronecker/Jacobi symbol routines are
+ checked against some test data and a lot of derived data.
+
+ To check the test data against PARI-GP, run
+
+ t-jac -p | gp -q
+
+ Enhancements:
+
+ More big test cases than those given by check_squares_zi would be good. */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#ifdef _LONG_LONG_LIMB
+#define LL(l,ll) ll
+#else
+#define LL(l,ll) l
+#endif
+
+
+int option_pari = 0;
+
+
+unsigned long
+mpz_mod4 (mpz_srcptr z)
+{
+ mpz_t m;
+ unsigned long ret;
+
+ mpz_init (m);
+ mpz_fdiv_r_2exp (m, z, 2);
+ ret = mpz_get_ui (m);
+ mpz_clear (m);
+ return ret;
+}
+
+int
+mpz_fits_ulimb_p (mpz_srcptr z)
+{
+ return (SIZ(z) == 1 || SIZ(z) == 0);
+}
+
+mp_limb_t
+mpz_get_ulimb (mpz_srcptr z)
+{
+ if (SIZ(z) == 0)
+ return 0;
+ else
+ return PTR(z)[0];
+}
+
+
+void
+try_base (mp_limb_t a, mp_limb_t b, int answer)
+{
+ int got;
+
+ if ((b & 1) == 0 || b == 1 || a > b)
+ return;
+
+ got = mpn_jacobi_base (a, b, 0);
+ if (got != answer)
+ {
+ printf (LL("mpn_jacobi_base (%lu, %lu) is %d should be %d\n",
+ "mpn_jacobi_base (%llu, %llu) is %d should be %d\n"),
+ a, b, got, answer);
+ abort ();
+ }
+}
+
+
+void
+try_zi_ui (mpz_srcptr a, unsigned long b, int answer)
+{
+ int got;
+
+ got = mpz_kronecker_ui (a, b);
+ if (got != answer)
+ {
+ printf ("mpz_kronecker_ui (");
+ mpz_out_str (stdout, 10, a);
+ printf (", %lu) is %d should be %d\n", b, got, answer);
+ abort ();
+ }
+}
+
+
+void
+try_zi_si (mpz_srcptr a, long b, int answer)
+{
+ int got;
+
+ got = mpz_kronecker_si (a, b);
+ if (got != answer)
+ {
+ printf ("mpz_kronecker_si (");
+ mpz_out_str (stdout, 10, a);
+ printf (", %ld) is %d should be %d\n", b, got, answer);
+ abort ();
+ }
+}
+
+
+void
+try_ui_zi (unsigned long a, mpz_srcptr b, int answer)
+{
+ int got;
+
+ got = mpz_ui_kronecker (a, b);
+ if (got != answer)
+ {
+ printf ("mpz_ui_kronecker (%lu, ", a);
+ mpz_out_str (stdout, 10, b);
+ printf (") is %d should be %d\n", got, answer);
+ abort ();
+ }
+}
+
+
+void
+try_si_zi (long a, mpz_srcptr b, int answer)
+{
+ int got;
+
+ got = mpz_si_kronecker (a, b);
+ if (got != answer)
+ {
+ printf ("mpz_si_kronecker (%ld, ", a);
+ mpz_out_str (stdout, 10, b);
+ printf (") is %d should be %d\n", got, answer);
+ abort ();
+ }
+}
+
+
+/* Don't bother checking mpz_jacobi, since it only differs for b even, and
+ we don't have an actual expected answer for it. tests/devel/try.c does
+ some checks though. */
+void
+try_zi_zi (mpz_srcptr a, mpz_srcptr b, int answer)
+{
+ int got;
+
+ got = mpz_kronecker (a, b);
+ if (got != answer)
+ {
+ printf ("mpz_kronecker (");
+ mpz_out_str (stdout, 10, a);
+ printf (", ");
+ mpz_out_str (stdout, 10, b);
+ printf (") is %d should be %d\n", got, answer);
+ abort ();
+ }
+}
+
+
+void
+try_pari (mpz_srcptr a, mpz_srcptr b, int answer)
+{
+ printf ("try(");
+ mpz_out_str (stdout, 10, a);
+ printf (",");
+ mpz_out_str (stdout, 10, b);
+ printf (",%d)\n", answer);
+}
+
+
+void
+try_each (mpz_srcptr a, mpz_srcptr b, int answer)
+{
+#if 0
+ fprintf(stderr, "asize = %d, bsize = %d\n",
+ mpz_sizeinbase (a, 2), mpz_sizeinbase (b, 2));
+#endif
+ if (option_pari)
+ {
+ try_pari (a, b, answer);
+ return;
+ }
+
+ if (mpz_fits_ulimb_p (a) && mpz_fits_ulimb_p (b))
+ try_base (mpz_get_ulimb (a), mpz_get_ulimb (b), answer);
+
+ if (mpz_fits_ulong_p (b))
+ try_zi_ui (a, mpz_get_ui (b), answer);
+
+ if (mpz_fits_slong_p (b))
+ try_zi_si (a, mpz_get_si (b), answer);
+
+ if (mpz_fits_ulong_p (a))
+ try_ui_zi (mpz_get_ui (a), b, answer);
+
+ if (mpz_fits_sint_p (a))
+ try_si_zi (mpz_get_si (a), b, answer);
+
+ try_zi_zi (a, b, answer);
+}
+
+
+/* Try (a/b) and (a/-b). */
+void
+try_pn (mpz_srcptr a, mpz_srcptr b_orig, int answer)
+{
+ mpz_t b;
+
+ mpz_init_set (b, b_orig);
+ try_each (a, b, answer);
+
+ mpz_neg (b, b);
+ if (mpz_sgn (a) < 0)
+ answer = -answer;
+
+ try_each (a, b, answer);
+
+ mpz_clear (b);
+}
+
+
+/* Try (a+k*p/b) for various k, using the fact (a/b) is periodic in a with
+ period p. For b>0, p=b if b!=2mod4 or p=4*b if b==2mod4. */
+
+void
+try_periodic_num (mpz_srcptr a_orig, mpz_srcptr b, int answer)
+{
+ mpz_t a, a_period;
+ int i;
+
+ if (mpz_sgn (b) <= 0)
+ return;
+
+ mpz_init_set (a, a_orig);
+ mpz_init_set (a_period, b);
+ if (mpz_mod4 (b) == 2)
+ mpz_mul_ui (a_period, a_period, 4);
+
+ /* don't bother with these tests if they're only going to produce
+ even/even */
+ if (mpz_even_p (a) && mpz_even_p (b) && mpz_even_p (a_period))
+ goto done;
+
+ for (i = 0; i < 6; i++)
+ {
+ mpz_add (a, a, a_period);
+ try_pn (a, b, answer);
+ }
+
+ mpz_set (a, a_orig);
+ for (i = 0; i < 6; i++)
+ {
+ mpz_sub (a, a, a_period);
+ try_pn (a, b, answer);
+ }
+
+ done:
+ mpz_clear (a);
+ mpz_clear (a_period);
+}
+
+
+/* Try (a/b+k*p) for various k, using the fact (a/b) is periodic in b of
+ period p.
+
+ period p
+ a==0,1mod4 a
+ a==2mod4 4*a
+ a==3mod4 and b odd 4*a
+ a==3mod4 and b even 8*a
+
+ In Henri Cohen's book the period is given as 4*a for all a==2,3mod4, but
+ a counterexample would seem to be (3/2)=-1 which with (3/14)=+1 doesn't
+ have period 4*a (but rather 8*a with (3/26)=-1). Maybe the plain 4*a is
+ to be read as applying to a plain Jacobi symbol with b odd, rather than
+ the Kronecker extension to b even. */
+
+void
+try_periodic_den (mpz_srcptr a, mpz_srcptr b_orig, int answer)
+{
+ mpz_t b, b_period;
+ int i;
+
+ if (mpz_sgn (a) == 0 || mpz_sgn (b_orig) == 0)
+ return;
+
+ mpz_init_set (b, b_orig);
+
+ mpz_init_set (b_period, a);
+ if (mpz_mod4 (a) == 3 && mpz_even_p (b))
+ mpz_mul_ui (b_period, b_period, 8L);
+ else if (mpz_mod4 (a) >= 2)
+ mpz_mul_ui (b_period, b_period, 4L);
+
+ /* don't bother with these tests if they're only going to produce
+ even/even */
+ if (mpz_even_p (a) && mpz_even_p (b) && mpz_even_p (b_period))
+ goto done;
+
+ for (i = 0; i < 6; i++)
+ {
+ mpz_add (b, b, b_period);
+ try_pn (a, b, answer);
+ }
+
+ mpz_set (b, b_orig);
+ for (i = 0; i < 6; i++)
+ {
+ mpz_sub (b, b, b_period);
+ try_pn (a, b, answer);
+ }
+
+ done:
+ mpz_clear (b);
+ mpz_clear (b_period);
+}
+
+
+static const unsigned long ktable[] = {
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ GMP_NUMB_BITS-1, GMP_NUMB_BITS, GMP_NUMB_BITS+1,
+ 2*GMP_NUMB_BITS-1, 2*GMP_NUMB_BITS, 2*GMP_NUMB_BITS+1,
+ 3*GMP_NUMB_BITS-1, 3*GMP_NUMB_BITS, 3*GMP_NUMB_BITS+1
+};
+
+
+/* Try (a/b*2^k) for various k. */
+void
+try_2den (mpz_srcptr a, mpz_srcptr b_orig, int answer)
+{
+ mpz_t b;
+ int kindex;
+ int answer_a2, answer_k;
+ unsigned long k;
+
+ /* don't bother when b==0 */
+ if (mpz_sgn (b_orig) == 0)
+ return;
+
+ mpz_init_set (b, b_orig);
+
+ /* (a/2) is 0 if a even, 1 if a==1 or 7 mod 8, -1 if a==3 or 5 mod 8 */
+ answer_a2 = (mpz_even_p (a) ? 0
+ : (((SIZ(a) >= 0 ? PTR(a)[0] : -PTR(a)[0]) + 2) & 7) < 4 ? 1
+ : -1);
+
+ for (kindex = 0; kindex < numberof (ktable); kindex++)
+ {
+ k = ktable[kindex];
+
+ /* answer_k = answer*(answer_a2^k) */
+ answer_k = (answer_a2 == 0 && k != 0 ? 0
+ : (k & 1) == 1 && answer_a2 == -1 ? -answer
+ : answer);
+
+ mpz_mul_2exp (b, b_orig, k);
+ try_pn (a, b, answer_k);
+ }
+
+ mpz_clear (b);
+}
+
+
+/* Try (a*2^k/b) for various k. If it happens mpz_ui_kronecker() gets (2/b)
+ wrong it will show up as wrong answers demanded. */
+void
+try_2num (mpz_srcptr a_orig, mpz_srcptr b, int answer)
+{
+ mpz_t a;
+ int kindex;
+ int answer_2b, answer_k;
+ unsigned long k;
+
+ /* don't bother when a==0 */
+ if (mpz_sgn (a_orig) == 0)
+ return;
+
+ mpz_init (a);
+
+ /* (2/b) is 0 if b even, 1 if b==1 or 7 mod 8, -1 if b==3 or 5 mod 8 */
+ answer_2b = (mpz_even_p (b) ? 0
+ : (((SIZ(b) >= 0 ? PTR(b)[0] : -PTR(b)[0]) + 2) & 7) < 4 ? 1
+ : -1);
+
+ for (kindex = 0; kindex < numberof (ktable); kindex++)
+ {
+ k = ktable[kindex];
+
+ /* answer_k = answer*(answer_2b^k) */
+ answer_k = (answer_2b == 0 && k != 0 ? 0
+ : (k & 1) == 1 && answer_2b == -1 ? -answer
+ : answer);
+
+ mpz_mul_2exp (a, a_orig, k);
+ try_pn (a, b, answer_k);
+ }
+
+ mpz_clear (a);
+}
+
+
+/* The try_2num() and try_2den() routines don't in turn call
+ try_periodic_num() and try_periodic_den() because it hugely increases the
+ number of tests performed, without obviously increasing coverage.
+
+ Useful extra derived cases can be added here. */
+
+void
+try_all (mpz_t a, mpz_t b, int answer)
+{
+ try_pn (a, b, answer);
+ try_periodic_num (a, b, answer);
+ try_periodic_den (a, b, answer);
+ try_2num (a, b, answer);
+ try_2den (a, b, answer);
+}
+
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *a;
+ const char *b;
+ int answer;
+
+ } data[] = {
+
+ /* Note that the various derived checks in try_all() reduce the cases
+ that need to be given here. */
+
+ /* some zeros */
+ { "0", "0", 0 },
+ { "0", "2", 0 },
+ { "0", "6", 0 },
+ { "5", "0", 0 },
+ { "24", "60", 0 },
+
+ /* (a/1) = 1, any a
+ In particular note (0/1)=1 so that (a/b)=(a mod b/b). */
+ { "0", "1", 1 },
+ { "1", "1", 1 },
+ { "2", "1", 1 },
+ { "3", "1", 1 },
+ { "4", "1", 1 },
+ { "5", "1", 1 },
+
+ /* (0/b) = 0, b != 1 */
+ { "0", "3", 0 },
+ { "0", "5", 0 },
+ { "0", "7", 0 },
+ { "0", "9", 0 },
+ { "0", "11", 0 },
+ { "0", "13", 0 },
+ { "0", "15", 0 },
+
+ /* (1/b) = 1 */
+ { "1", "1", 1 },
+ { "1", "3", 1 },
+ { "1", "5", 1 },
+ { "1", "7", 1 },
+ { "1", "9", 1 },
+ { "1", "11", 1 },
+
+ /* (-1/b) = (-1)^((b-1)/2) which is -1 for b==3 mod 4 */
+ { "-1", "1", 1 },
+ { "-1", "3", -1 },
+ { "-1", "5", 1 },
+ { "-1", "7", -1 },
+ { "-1", "9", 1 },
+ { "-1", "11", -1 },
+ { "-1", "13", 1 },
+ { "-1", "15", -1 },
+ { "-1", "17", 1 },
+ { "-1", "19", -1 },
+
+ /* (2/b) = (-1)^((b^2-1)/8) which is -1 for b==3,5 mod 8.
+ try_2num() will exercise multiple powers of 2 in the numerator. */
+ { "2", "1", 1 },
+ { "2", "3", -1 },
+ { "2", "5", -1 },
+ { "2", "7", 1 },
+ { "2", "9", 1 },
+ { "2", "11", -1 },
+ { "2", "13", -1 },
+ { "2", "15", 1 },
+ { "2", "17", 1 },
+
+ /* (-2/b) = (-1)^((b^2-1)/8)*(-1)^((b-1)/2) which is -1 for b==5,7mod8.
+ try_2num() will exercise multiple powers of 2 in the numerator, which
+ will test that the shift in mpz_si_kronecker() uses unsigned not
+ signed. */
+ { "-2", "1", 1 },
+ { "-2", "3", 1 },
+ { "-2", "5", -1 },
+ { "-2", "7", -1 },
+ { "-2", "9", 1 },
+ { "-2", "11", 1 },
+ { "-2", "13", -1 },
+ { "-2", "15", -1 },
+ { "-2", "17", 1 },
+
+ /* (a/2)=(2/a).
+ try_2den() will exercise multiple powers of 2 in the denominator. */
+ { "3", "2", -1 },
+ { "5", "2", -1 },
+ { "7", "2", 1 },
+ { "9", "2", 1 },
+ { "11", "2", -1 },
+
+ /* Harriet Griffin, "Elementary Theory of Numbers", page 155, various
+ examples. */
+ { "2", "135", 1 },
+ { "135", "19", -1 },
+ { "2", "19", -1 },
+ { "19", "135", 1 },
+ { "173", "135", 1 },
+ { "38", "135", 1 },
+ { "135", "173", 1 },
+ { "173", "5", -1 },
+ { "3", "5", -1 },
+ { "5", "173", -1 },
+ { "173", "3", -1 },
+ { "2", "3", -1 },
+ { "3", "173", -1 },
+ { "253", "21", 1 },
+ { "1", "21", 1 },
+ { "21", "253", 1 },
+ { "21", "11", -1 },
+ { "-1", "11", -1 },
+
+ /* Griffin page 147 */
+ { "-1", "17", 1 },
+ { "2", "17", 1 },
+ { "-2", "17", 1 },
+ { "-1", "89", 1 },
+ { "2", "89", 1 },
+
+ /* Griffin page 148 */
+ { "89", "11", 1 },
+ { "1", "11", 1 },
+ { "89", "3", -1 },
+ { "2", "3", -1 },
+ { "3", "89", -1 },
+ { "11", "89", 1 },
+ { "33", "89", -1 },
+
+ /* H. Davenport, "The Higher Arithmetic", page 65, the quadratic
+ residues and non-residues mod 19. */
+ { "1", "19", 1 },
+ { "4", "19", 1 },
+ { "5", "19", 1 },
+ { "6", "19", 1 },
+ { "7", "19", 1 },
+ { "9", "19", 1 },
+ { "11", "19", 1 },
+ { "16", "19", 1 },
+ { "17", "19", 1 },
+ { "2", "19", -1 },
+ { "3", "19", -1 },
+ { "8", "19", -1 },
+ { "10", "19", -1 },
+ { "12", "19", -1 },
+ { "13", "19", -1 },
+ { "14", "19", -1 },
+ { "15", "19", -1 },
+ { "18", "19", -1 },
+
+ /* Residues and non-residues mod 13 */
+ { "0", "13", 0 },
+ { "1", "13", 1 },
+ { "2", "13", -1 },
+ { "3", "13", 1 },
+ { "4", "13", 1 },
+ { "5", "13", -1 },
+ { "6", "13", -1 },
+ { "7", "13", -1 },
+ { "8", "13", -1 },
+ { "9", "13", 1 },
+ { "10", "13", 1 },
+ { "11", "13", -1 },
+ { "12", "13", 1 },
+
+ /* various */
+ { "5", "7", -1 },
+ { "15", "17", 1 },
+ { "67", "89", 1 },
+
+ /* special values inducing a==b==1 at the end of jac_or_kron() */
+ { "0x10000000000000000000000000000000000000000000000001",
+ "0x10000000000000000000000000000000000000000000000003", 1 },
+
+ /* Test for previous bugs in jacobi_2. */
+ { "0x43900000000", "0x42400000439", -1 }, /* 32-bit limbs */
+ { "0x4390000000000000000", "0x4240000000000000439", -1 }, /* 64-bit limbs */
+
+ { "198158408161039063", "198158360916398807", -1 },
+
+ /* Some tests involving large quotients in the continued fraction
+ expansion. */
+ { "37200210845139167613356125645445281805",
+ "451716845976689892447895811408978421929", -1 },
+ { "67674091930576781943923596701346271058970643542491743605048620644676477275152701774960868941561652032482173612421015",
+ "4902678867794567120224500687210807069172039735", 0 },
+ { "2666617146103764067061017961903284334497474492754652499788571378062969111250584288683585223600172138551198546085281683283672592", "2666617146103764067061017961903284334497474492754652499788571378062969111250584288683585223600172138551198546085281683290481773", 1 },
+
+ /* Exercises the case asize == 1, btwos > 0 in mpz_jacobi. */
+ { "804609", "421248363205206617296534688032638102314410556521742428832362659824", 1 } ,
+ { "4190209", "2239744742177804210557442048984321017460028974602978995388383905961079286530650825925074203175536427000", 1 },
+
+ /* Exercises the case asize == 1, btwos = 63 in mpz_jacobi
+ (relevant when GMP_LIMB_BITS == 64). */
+ { "17311973299000934401", "1675975991242824637446753124775689449936871337036614677577044717424700351103148799107651171694863695242089956242888229458836426332300124417011114380886016", 1 },
+ { "3220569220116583677", "41859917623035396746", -1 },
+
+ /* Other test cases that triggered bugs during development. */
+ { "37200210845139167613356125645445281805", "340116213441272389607827434472642576514", -1 },
+ { "74400421690278335226712251290890563610", "451716845976689892447895811408978421929", -1 },
+ };
+
+ int i;
+ mpz_t a, b;
+
+ mpz_init (a);
+ mpz_init (b);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_str_or_abort (a, data[i].a, 0);
+ mpz_set_str_or_abort (b, data[i].b, 0);
+ try_all (a, b, data[i].answer);
+ }
+
+ mpz_clear (a);
+ mpz_clear (b);
+}
+
+
+/* (a^2/b)=1 if gcd(a,b)=1, or (a^2/b)=0 if gcd(a,b)!=1.
+ This includes when a=0 or b=0. */
+void
+check_squares_zi (void)
+{
+ gmp_randstate_ptr rands = RANDS;
+ mpz_t a, b, g;
+ int i, answer;
+ mp_size_t size_range, an, bn;
+ mpz_t bs;
+
+ mpz_init (bs);
+ mpz_init (a);
+ mpz_init (b);
+ mpz_init (g);
+
+ for (i = 0; i < 50; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 10 + i/8 + 2;
+
+ mpz_urandomb (bs, rands, size_range);
+ an = mpz_get_ui (bs);
+ mpz_rrandomb (a, rands, an);
+
+ mpz_urandomb (bs, rands, size_range);
+ bn = mpz_get_ui (bs);
+ mpz_rrandomb (b, rands, bn);
+
+ mpz_gcd (g, a, b);
+ if (mpz_cmp_ui (g, 1L) == 0)
+ answer = 1;
+ else
+ answer = 0;
+
+ mpz_mul (a, a, a);
+
+ try_all (a, b, answer);
+ }
+
+ mpz_clear (bs);
+ mpz_clear (a);
+ mpz_clear (b);
+ mpz_clear (g);
+}
+
+
+/* Check the handling of asize==0, make sure it isn't affected by the low
+ limb. */
+void
+check_a_zero (void)
+{
+ mpz_t a, b;
+
+ mpz_init_set_ui (a, 0);
+ mpz_init (b);
+
+ mpz_set_ui (b, 1L);
+ PTR(a)[0] = 0;
+ try_all (a, b, 1); /* (0/1)=1 */
+ PTR(a)[0] = 1;
+ try_all (a, b, 1); /* (0/1)=1 */
+
+ mpz_set_si (b, -1L);
+ PTR(a)[0] = 0;
+ try_all (a, b, 1); /* (0/-1)=1 */
+ PTR(a)[0] = 1;
+ try_all (a, b, 1); /* (0/-1)=1 */
+
+ mpz_set_ui (b, 0);
+ PTR(a)[0] = 0;
+ try_all (a, b, 0); /* (0/0)=0 */
+ PTR(a)[0] = 1;
+ try_all (a, b, 0); /* (0/0)=0 */
+
+ mpz_set_ui (b, 2);
+ PTR(a)[0] = 0;
+ try_all (a, b, 0); /* (0/2)=0 */
+ PTR(a)[0] = 1;
+ try_all (a, b, 0); /* (0/2)=0 */
+
+ mpz_clear (a);
+ mpz_clear (b);
+}
+
+
+/* Assumes that b = prod p_k^e_k */
+int
+ref_jacobi (mpz_srcptr a, mpz_srcptr b, unsigned nprime,
+ mpz_t prime[], unsigned *exp)
+{
+ unsigned i;
+ int res;
+
+ for (i = 0, res = 1; i < nprime; i++)
+ if (exp[i])
+ {
+ int legendre = refmpz_legendre (a, prime[i]);
+ if (!legendre)
+ return 0;
+ if (exp[i] & 1)
+ res *= legendre;
+ }
+ return res;
+}
+
+void
+check_jacobi_factored (void)
+{
+#define PRIME_N 10
+#define PRIME_MAX_SIZE 50
+#define PRIME_MAX_EXP 4
+#define PRIME_A_COUNT 10
+#define PRIME_B_COUNT 5
+#define PRIME_MAX_B_SIZE 2000
+
+ gmp_randstate_ptr rands = RANDS;
+ mpz_t prime[PRIME_N];
+ unsigned exp[PRIME_N];
+ mpz_t a, b, t, bs;
+ unsigned i;
+
+ mpz_init (a);
+ mpz_init (b);
+ mpz_init (t);
+ mpz_init (bs);
+
+ /* Generate primes */
+ for (i = 0; i < PRIME_N; i++)
+ {
+ mp_size_t size;
+ mpz_init (prime[i]);
+ mpz_urandomb (bs, rands, 32);
+ size = mpz_get_ui (bs) % PRIME_MAX_SIZE + 2;
+ mpz_rrandomb (prime[i], rands, size);
+ if (mpz_cmp_ui (prime[i], 3) <= 0)
+ mpz_set_ui (prime[i], 3);
+ else
+ mpz_nextprime (prime[i], prime[i]);
+ }
+
+ for (i = 0; i < PRIME_B_COUNT; i++)
+ {
+ unsigned j, k;
+ mp_bitcnt_t bsize;
+
+ mpz_set_ui (b, 1);
+ bsize = 1;
+
+ for (j = 0; j < PRIME_N && bsize < PRIME_MAX_B_SIZE; j++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ exp[j] = mpz_get_ui (bs) % PRIME_MAX_EXP;
+ mpz_pow_ui (t, prime[j], exp[j]);
+ mpz_mul (b, b, t);
+ bsize = mpz_sizeinbase (b, 2);
+ }
+ for (k = 0; k < PRIME_A_COUNT; k++)
+ {
+ int answer;
+ mpz_rrandomb (a, rands, bsize + 2);
+ answer = ref_jacobi (a, b, j, prime, exp);
+ try_all (a, b, answer);
+ }
+ }
+ for (i = 0; i < PRIME_N; i++)
+ mpz_clear (prime[i]);
+
+ mpz_clear (a);
+ mpz_clear (b);
+ mpz_clear (t);
+ mpz_clear (bs);
+
+#undef PRIME_N
+#undef PRIME_MAX_SIZE
+#undef PRIME_MAX_EXP
+#undef PRIME_A_COUNT
+#undef PRIME_B_COUNT
+#undef PRIME_MAX_B_SIZE
+}
+
+/* These tests compute (a|n), where the quotient sequence includes
+ large quotients, and n has a known factorization. Such inputs are
+ generated as follows. First, construct a large n, as a power of a
+ prime p of moderate size.
+
+ Next, compute a matrix from factors (q,1;1,0), with q chosen with
+ uniformly distributed size. We must stop with matrix elements of
+ roughly half the size of n. Denote elements of M as M = (m00, m01;
+ m10, m11).
+
+ We now look for solutions to
+
+ n = m00 x + m01 y
+ a = m10 x + m11 y
+
+ with x,y > 0. Since n >= m00 * m01, there exists a positive
+ solution to the first equation. Find those x, y, and substitute in
+ the second equation to get a. Then the quotient sequence for (a|n)
+ is precisely the quotients used when constructing M, followed by
+ the quotient sequence for (x|y).
+
+ Numbers should also be large enough that we exercise hgcd_jacobi,
+ which means that they should be larger than
+
+ max (GCD_DC_THRESHOLD, 3 * HGCD_THRESHOLD)
+
+ With an n of roughly 40000 bits, this should hold on most machines.
+*/
+
+void
+check_large_quotients (void)
+{
+#define COUNT 50
+#define PBITS 200
+#define PPOWER 201
+#define MAX_QBITS 500
+
+ gmp_randstate_ptr rands = RANDS;
+
+ mpz_t p, n, q, g, s, t, x, y, bs;
+ mpz_t M[2][2];
+ mp_bitcnt_t nsize;
+ unsigned i;
+
+ mpz_init (p);
+ mpz_init (n);
+ mpz_init (q);
+ mpz_init (g);
+ mpz_init (s);
+ mpz_init (t);
+ mpz_init (x);
+ mpz_init (y);
+ mpz_init (bs);
+ mpz_init (M[0][0]);
+ mpz_init (M[0][1]);
+ mpz_init (M[1][0]);
+ mpz_init (M[1][1]);
+
+ /* First generate a number with known factorization, as a random
+ smallish prime raised to an odd power. Then (a|n) = (a|p). */
+ mpz_rrandomb (p, rands, PBITS);
+ mpz_nextprime (p, p);
+ mpz_pow_ui (n, p, PPOWER);
+
+ nsize = mpz_sizeinbase (n, 2);
+
+ for (i = 0; i < COUNT; i++)
+ {
+ int answer;
+ mp_bitcnt_t msize;
+
+ mpz_set_ui (M[0][0], 1);
+ mpz_set_ui (M[0][1], 0);
+ mpz_set_ui (M[1][0], 0);
+ mpz_set_ui (M[1][1], 1);
+
+ for (msize = 1; 2*(msize + MAX_QBITS) + 1 < nsize ;)
+ {
+ unsigned i;
+ mpz_rrandomb (bs, rands, 32);
+ mpz_rrandomb (q, rands, 1 + mpz_get_ui (bs) % MAX_QBITS);
+
+ /* Multiply by (q, 1; 1,0) from the right */
+ for (i = 0; i < 2; i++)
+ {
+ mp_bitcnt_t size;
+ mpz_swap (M[i][0], M[i][1]);
+ mpz_addmul (M[i][0], M[i][1], q);
+ size = mpz_sizeinbase (M[i][0], 2);
+ if (size > msize)
+ msize = size;
+ }
+ }
+ mpz_gcdext (g, s, t, M[0][0], M[0][1]);
+ ASSERT_ALWAYS (mpz_cmp_ui (g, 1) == 0);
+
+ /* Solve n = M[0][0] * x + M[0][1] * y */
+ if (mpz_sgn (s) > 0)
+ {
+ mpz_mul (x, n, s);
+ mpz_fdiv_qr (q, x, x, M[0][1]);
+ mpz_mul (y, q, M[0][0]);
+ mpz_addmul (y, t, n);
+ ASSERT_ALWAYS (mpz_sgn (y) > 0);
+ }
+ else
+ {
+ mpz_mul (y, n, t);
+ mpz_fdiv_qr (q, y, y, M[0][0]);
+ mpz_mul (x, q, M[0][1]);
+ mpz_addmul (x, s, n);
+ ASSERT_ALWAYS (mpz_sgn (x) > 0);
+ }
+ mpz_mul (x, x, M[1][0]);
+ mpz_addmul (x, y, M[1][1]);
+
+ /* Now (x|n) has the selected large quotients */
+ answer = refmpz_legendre (x, p);
+ try_zi_zi (x, n, answer);
+ }
+ mpz_clear (p);
+ mpz_clear (n);
+ mpz_clear (q);
+ mpz_clear (g);
+ mpz_clear (s);
+ mpz_clear (t);
+ mpz_clear (x);
+ mpz_clear (y);
+ mpz_clear (bs);
+ mpz_clear (M[0][0]);
+ mpz_clear (M[0][1]);
+ mpz_clear (M[1][0]);
+ mpz_clear (M[1][1]);
+#undef COUNT
+#undef PBITS
+#undef PPOWER
+#undef MAX_QBITS
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+
+ if (argc >= 2 && strcmp (argv[1], "-p") == 0)
+ {
+ option_pari = 1;
+
+ printf ("\
+try(a,b,answer) =\n\
+{\n\
+ if (kronecker(a,b) != answer,\n\
+ print(\"wrong at \", a, \",\", b,\n\
+ \" expected \", answer,\n\
+ \" pari says \", kronecker(a,b)))\n\
+}\n");
+ }
+
+ check_data ();
+ check_squares_zi ();
+ check_a_zero ();
+ check_jacobi_factored ();
+ check_large_quotients ();
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-lcm.c b/vendor/gmp-6.3.0/tests/mpz/t-lcm.c
new file mode 100644
index 0000000..1b45212
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-lcm.c
@@ -0,0 +1,184 @@
+/* Test mpz_lcm and mpz_lcm_ui.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_all (mpz_ptr want, mpz_srcptr x_orig, mpz_srcptr y_orig)
+{
+ mpz_t got, x, y;
+ int negx, negy, swap, inplace;
+
+ mpz_init (got);
+ mpz_init_set (x, x_orig);
+ mpz_init_set (y, y_orig);
+
+ for (swap = 0; swap < 2; swap++)
+ {
+ mpz_swap (x, y);
+
+ for (negx = 0; negx < 2; negx++)
+ {
+ mpz_neg (x, x);
+
+ for (negy = 0; negy < 2; negy++)
+ {
+ mpz_neg (y, y);
+
+ for (inplace = 0; inplace <= 1; inplace++)
+ {
+ if (inplace)
+ { mpz_set (got, x); mpz_lcm (got, got, y); }
+ else
+ mpz_lcm (got, x, y);
+ MPZ_CHECK_FORMAT (got);
+
+ if (mpz_cmp (got, want) != 0)
+ {
+ printf ("mpz_lcm wrong, inplace=%d\n", inplace);
+ fail:
+ mpz_trace ("x", x);
+ mpz_trace ("y", y);
+ mpz_trace ("got", got);
+ mpz_trace ("want", want);
+ abort ();
+ }
+
+ if (mpz_fits_ulong_p (y))
+ {
+ unsigned long yu = mpz_get_ui (y);
+ if (inplace)
+ { mpz_set (got, x); mpz_lcm_ui (got, got, yu); }
+ else
+ mpz_lcm_ui (got, x, yu);
+
+ if (mpz_cmp (got, want) != 0)
+ {
+ printf ("mpz_lcm_ui wrong, inplace=%d\n", inplace);
+ printf ("yu=%lu\n", yu);
+ goto fail;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ mpz_clear (got);
+ mpz_clear (x);
+ mpz_clear (y);
+}
+
+
+void
+check_primes (void)
+{
+ static unsigned long prime[] = {
+ 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,
+ 101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,
+ 191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,
+ 281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,
+ 389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,
+ };
+ mpz_t want, x, y;
+ int i;
+
+ mpz_init (want);
+ mpz_init (x);
+ mpz_init (y);
+
+ /* Check zeros. */
+ mpz_set_ui (want, 0);
+ mpz_set_ui (x, 1);
+ check_all (want, want, want);
+ check_all (want, want, x);
+ check_all (want, x, want);
+
+ /* New prime each time. */
+ mpz_set_ui (want, 1L);
+ for (i = 0; i < numberof (prime); i++)
+ {
+ mpz_set (x, want);
+ mpz_set_ui (y, prime[i]);
+ mpz_mul_ui (want, want, prime[i]);
+ check_all (want, x, y);
+ }
+
+ /* Old prime each time. */
+ mpz_set (x, want);
+ for (i = 0; i < numberof (prime); i++)
+ {
+ mpz_set_ui (y, prime[i]);
+ check_all (want, x, y);
+ }
+
+ /* One old, one new each time. */
+ mpz_set_ui (want, prime[0]);
+ for (i = 1; i < numberof (prime); i++)
+ {
+ mpz_set (x, want);
+ mpz_set_ui (y, prime[i] * prime[i-1]);
+ mpz_mul_ui (want, want, prime[i]);
+ check_all (want, x, y);
+ }
+
+ /* Triplets with A,B in x and B,C in y. */
+ mpz_set_ui (want, 1L);
+ mpz_set_ui (x, 1L);
+ mpz_set_ui (y, 1L);
+ for (i = 0; i+2 < numberof (prime); i += 3)
+ {
+ mpz_mul_ui (want, want, prime[i]);
+ mpz_mul_ui (want, want, prime[i+1]);
+ mpz_mul_ui (want, want, prime[i+2]);
+
+ mpz_mul_ui (x, x, prime[i]);
+ mpz_mul_ui (x, x, prime[i+1]);
+
+ mpz_mul_ui (y, y, prime[i+1]);
+ mpz_mul_ui (y, y, prime[i+2]);
+
+ check_all (want, x, y);
+ }
+
+
+ mpz_clear (want);
+ mpz_clear (x);
+ mpz_clear (y);
+}
+
+
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+
+ check_primes ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-limbs.c b/vendor/gmp-6.3.0/tests/mpz/t-limbs.c
new file mode 100644
index 0000000..6526e92
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-limbs.c
@@ -0,0 +1,232 @@
+/* Test mpz_limbs_* functions
+
+Copyright 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#define COUNT 100
+#define BITSIZE 500
+
+/* Like mpz_add. For simplicity, support positive inputs only. */
+static void
+alt_add (mpz_ptr r, mpz_srcptr a, mpz_srcptr b)
+{
+ mp_size_t an = mpz_size (a);
+ mp_size_t bn = mpz_size (b);
+ mp_ptr rp;
+
+ ASSERT (an > 0);
+ ASSERT (bn > 0);
+ if (an < bn)
+ {
+ MP_SIZE_T_SWAP (an, bn);
+ MPZ_SRCPTR_SWAP (a, b);
+ }
+ rp = mpz_limbs_modify (r, an + 1);
+ rp[an] = mpn_add (rp, mpz_limbs_read (a), an, mpz_limbs_read (b), bn);
+ mpz_limbs_finish (r, an + 1);
+}
+
+static void
+check_funcs (const char *name,
+ void (*f)(mpz_ptr, mpz_srcptr, mpz_srcptr),
+ void (*ref_f)(mpz_ptr, mpz_srcptr, mpz_srcptr),
+ mpz_srcptr a, mpz_srcptr b)
+{
+ mpz_t r, ref;
+ mpz_inits (r, ref, NULL);
+
+ ref_f (ref, a, b);
+ MPZ_CHECK_FORMAT (ref);
+ f (r, a, b);
+ MPZ_CHECK_FORMAT (r);
+
+ if (mpz_cmp (r, ref) != 0)
+ {
+ printf ("%s failed, abits %u, bbits %u\n",
+ name,
+ (unsigned) mpz_sizeinbase (a, 2),
+ (unsigned) mpz_sizeinbase (b, 2));
+ gmp_printf ("a = %Zx\n", a);
+ gmp_printf ("b = %Zx\n", b);
+ gmp_printf ("r = %Zx (bad)\n", r);
+ gmp_printf ("ref = %Zx\n", ref);
+ abort ();
+ }
+ mpz_clears (r, ref, NULL);
+}
+
+static void
+check_add (void)
+{
+ gmp_randstate_ptr rands = RANDS;
+ mpz_t bs, a, b;
+ unsigned i;
+ mpz_inits (bs, a, b, NULL);
+ for (i = 0; i < COUNT; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ mpz_rrandomb (a, rands, 1 + mpz_get_ui (bs) % BITSIZE);
+ mpz_urandomb (bs, rands, 32);
+ mpz_rrandomb (b, rands, 1 + mpz_get_ui (bs) % BITSIZE);
+
+ check_funcs ("add", alt_add, mpz_add, a, b);
+ }
+ mpz_clears (bs, a, b, NULL);
+}
+
+static void
+alt_mul (mpz_ptr r, mpz_srcptr a, mpz_srcptr b)
+{
+ mp_size_t an = mpz_size (a);
+ mp_size_t bn = mpz_size (b);
+ mp_srcptr ap, bp;
+ TMP_DECL;
+
+ TMP_MARK;
+
+ ASSERT (an > 0);
+ ASSERT (bn > 0);
+ if (an < bn)
+ {
+ MP_SIZE_T_SWAP (an, bn);
+ MPZ_SRCPTR_SWAP (a, b);
+ }
+ /* NOTE: This copying seems unnecessary; better to allocate new
+ result area, and free the old area when done. */
+ if (r == a)
+ {
+ mp_ptr tp = TMP_ALLOC_LIMBS (an);
+ MPN_COPY (tp, mpz_limbs_read (a), an);
+ ap = tp;
+ bp = (a == b) ? ap : mpz_limbs_read (b);
+ }
+ else if (r == b)
+ {
+ mp_ptr tp = TMP_ALLOC_LIMBS (bn);
+ MPN_COPY (tp, mpz_limbs_read (b), bn);
+ bp = tp;
+ ap = mpz_limbs_read (a);
+ }
+ else
+ {
+ ap = mpz_limbs_read (a);
+ bp = mpz_limbs_read (b);
+ }
+ mpn_mul (mpz_limbs_write (r, an + bn),
+ ap, an, bp, bn);
+
+ mpz_limbs_finish (r, an + bn);
+}
+
+void
+check_mul (void)
+{
+ gmp_randstate_ptr rands = RANDS;
+ mpz_t bs, a, b;
+ unsigned i;
+ mpz_inits (bs, a, b, NULL);
+ for (i = 0; i < COUNT; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ mpz_rrandomb (a, rands, 1 + mpz_get_ui (bs) % BITSIZE);
+ mpz_urandomb (bs, rands, 32);
+ mpz_rrandomb (b, rands, 1 + mpz_get_ui (bs) % BITSIZE);
+
+ check_funcs ("mul", alt_mul, mpz_mul, a, b);
+ }
+ mpz_clears (bs, a, b, NULL);
+}
+
+#define MAX_SIZE 100
+
+static void
+check_roinit (void)
+{
+ gmp_randstate_ptr rands = RANDS;
+ mpz_t bs, a, b, r, ref;
+ unsigned i;
+
+ mpz_inits (bs, a, b, r, ref, NULL);
+
+ for (i = 0; i < COUNT; i++)
+ {
+ mp_srcptr ap, bp;
+ mp_size_t an, bn;
+ mpz_urandomb (bs, rands, 32);
+ mpz_rrandomb (a, rands, 1 + mpz_get_ui (bs) % BITSIZE);
+ mpz_urandomb (bs, rands, 32);
+ mpz_rrandomb (b, rands, 1 + mpz_get_ui (bs) % BITSIZE);
+
+ an = mpz_size (a);
+ ap = mpz_limbs_read (a);
+ bn = mpz_size (b);
+ bp = mpz_limbs_read (b);
+
+ mpz_add (ref, a, b);
+ {
+ mpz_t a1, b1;
+#if __STDC_VERSION__ >= 199901
+ const mpz_t a2 = MPZ_ROINIT_N ( (mp_ptr) ap, an);
+ const mpz_t b2 = MPZ_ROINIT_N ( (mp_ptr) bp, bn);
+
+ mpz_set_ui (r, 0);
+ mpz_add (r, a2, b2);
+ if (mpz_cmp (r, ref) != 0)
+ {
+ printf ("MPZ_ROINIT_N failed\n");
+ gmp_printf ("a = %Zx\n", a);
+ gmp_printf ("b = %Zx\n", b);
+ gmp_printf ("r = %Zx (bad)\n", r);
+ gmp_printf ("ref = %Zx\n", ref);
+ abort ();
+ }
+#endif
+ mpz_set_ui (r, 0);
+ mpz_add (r, mpz_roinit_n (a1, ap, an), mpz_roinit_n (b1, bp, bn));
+ if (mpz_cmp (r, ref) != 0)
+ {
+ printf ("mpz_roinit_n failed\n");
+ gmp_printf ("a = %Zx\n", a);
+ gmp_printf ("b = %Zx\n", b);
+ gmp_printf ("r = %Zx (bad)\n", r);
+ gmp_printf ("ref = %Zx\n", ref);
+ abort ();
+ }
+ }
+ }
+ mpz_clears (bs, a, b, r, ref, NULL);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+ tests_end ();
+
+ check_add ();
+ check_mul ();
+ check_roinit ();
+
+ return 0;
+
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-lucm.c b/vendor/gmp-6.3.0/tests/mpz/t-lucm.c
new file mode 100644
index 0000000..24be85b
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-lucm.c
@@ -0,0 +1,144 @@
+/* Test mpz_powm, mpz_lucas_mod.
+
+Copyright 1991, 1993, 1994, 1996, 1999-2001, 2009, 2012, 2018 Free Software
+Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+void debug_mp (mpz_t, int);
+
+#define SIZEM 8
+
+/* FIXME: Should we implement another sequence to test lucas mod? */
+/* Eg: a generalisation of what we use for Fibonacci: */
+/* U_{2n-1} = U_n^2 - Q*U_{n-1}^2 */
+/* U_{2n+1} = D*U_n^2 + Q*U_{2n-1} + 2*Q^n ; whith D = (P^2-4*Q) */
+/* P*U_{2n} = U_{2n+1} + Q*U_{2n-1} */
+
+int
+main (int argc, char **argv)
+{
+ mpz_t base, exp, mod;
+ mpz_t r1, r2, t1, t2;
+ mp_size_t exp_size, mod_size;
+ int i, res;
+ int reps = 1000;
+ long Q;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+
+ tests_start ();
+ TESTS_REPS (reps, argv, argc);
+
+ rands = RANDS;
+
+ mpz_init (bs);
+
+ mpz_init (base);
+ mpz_init (exp);
+ mpz_init (mod);
+ mpz_init (r1);
+ mpz_init (r2);
+ mpz_init (t1);
+ mpz_init (t2);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % SIZEM + 1;
+
+ do /* Loop until base >= 2 and fits in a long. */
+ {
+ mpz_urandomb (base, rands, BITS_PER_ULONG - 2);
+ }
+ while (mpz_cmp_ui (base, 2) < 0 || mpz_fits_slong_p (base) == 0);
+
+ Q = mpz_get_ui (base);
+
+ do
+ {
+ ++size_range;
+ size_range = MIN (size_range, SIZEM);
+ mpz_urandomb (bs, rands, size_range);
+ mod_size = mpz_get_ui (bs);
+ mpz_rrandomb (mod, rands, mod_size);
+ mpz_add_ui (mod, mod, 16);
+ }
+ while (mpz_gcd_ui (NULL, mod, Q) != 1);
+
+ mod_size = mpz_sizeinbase (mod, 2) - 3;
+ mpz_urandomb (bs, rands, 32);
+ exp_size = mpz_get_ui (bs) % mod_size + 2;
+
+ mpz_tdiv_q_2exp (exp, mod, exp_size);
+ mpz_add_ui (exp, exp, 1);
+
+ mpz_urandomb (bs, rands, 2);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 1) != 0)
+ {
+ mpz_neg (base, base);
+ Q = -Q;
+ }
+
+ res = mpz_lucas_mod (t1, r2, Q, exp_size, mod, t2, r1);
+ if (res && ++reps)
+ continue;
+ MPZ_CHECK_FORMAT (r2);
+ if (mpz_cmp_ui (r2, 0) < 0)
+ mpz_add (r2, r2, mod);
+ mpz_powm (r1, base, exp, mod);
+
+ if (mpz_cmp (r1, r2) != 0)
+ {
+ fprintf (stderr, "\nIncorrect results in test %d for operands:\n", i);
+ debug_mp (base, -16);
+ debug_mp (exp, -16);
+ debug_mp (mod, -16);
+ fprintf (stderr, "mpz_powm result:\n");
+ debug_mp (r1, -16);
+ fprintf (stderr, "mpz_lucas_mod result (%d) Q=%ld:\n", res, Q);
+ debug_mp (r2, -16);
+ abort ();
+ }
+ }
+
+ mpz_clear (bs);
+ mpz_clear (base);
+ mpz_clear (exp);
+ mpz_clear (mod);
+ mpz_clear (r1);
+ mpz_clear (r2);
+ mpz_clear (t1);
+ mpz_clear (t2);
+
+ tests_end ();
+ exit (0);
+}
+
+void
+debug_mp (mpz_t x, int base)
+{
+ mpz_out_str (stderr, base, x); fputc ('\n', stderr);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-lucnum_ui.c b/vendor/gmp-6.3.0/tests/mpz/t-lucnum_ui.c
new file mode 100644
index 0000000..34c4315
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-lucnum_ui.c
@@ -0,0 +1,96 @@
+/* Test mpz_lucnum_ui and mpz_lucnum2_ui.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+/* Usage: t-lucnum_ui [n]
+
+ Test up to L[n], or if n is omitted then the default limit below. A
+ literal "x" for the limit means continue forever, this being meant only
+ for development. */
+
+
+void
+check_sequence (int argc, char *argv[])
+{
+ unsigned long n;
+ unsigned long limit = 100 * GMP_LIMB_BITS;
+ mpz_t want_ln, want_ln1, got_ln, got_ln1;
+
+ if (argc > 1 && argv[1][0] == 'x')
+ limit = ULONG_MAX;
+ else
+ TESTS_REPS (limit, argv, argc);
+
+ /* start at n==0 */
+ mpz_init_set_si (want_ln1, -1); /* L[-1] */
+ mpz_init_set_ui (want_ln, 2); /* L[0] */
+ mpz_init (got_ln);
+ mpz_init (got_ln1);
+
+ for (n = 0; n < limit; n++)
+ {
+ mpz_lucnum2_ui (got_ln, got_ln1, n);
+ MPZ_CHECK_FORMAT (got_ln);
+ MPZ_CHECK_FORMAT (got_ln1);
+ if (mpz_cmp (got_ln, want_ln) != 0 || mpz_cmp (got_ln1, want_ln1) != 0)
+ {
+ printf ("mpz_lucnum2_ui(%lu) wrong\n", n);
+ mpz_trace ("want ln ", want_ln);
+ mpz_trace ("got ln ", got_ln);
+ mpz_trace ("want ln1", want_ln1);
+ mpz_trace ("got ln1", got_ln1);
+ abort ();
+ }
+
+ mpz_lucnum_ui (got_ln, n);
+ MPZ_CHECK_FORMAT (got_ln);
+ if (mpz_cmp (got_ln, want_ln) != 0)
+ {
+ printf ("mpz_lucnum_ui(%lu) wrong\n", n);
+ mpz_trace ("want ln", want_ln);
+ mpz_trace ("got ln", got_ln);
+ abort ();
+ }
+
+ mpz_add (want_ln1, want_ln1, want_ln); /* L[n+1] = L[n] + L[n-1] */
+ mpz_swap (want_ln1, want_ln);
+ }
+
+ mpz_clear (want_ln);
+ mpz_clear (want_ln1);
+ mpz_clear (got_ln);
+ mpz_clear (got_ln1);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+ mp_trace_base = -16;
+
+ check_sequence (argc, argv);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-mfac_uiui.c b/vendor/gmp-6.3.0/tests/mpz/t-mfac_uiui.c
new file mode 100644
index 0000000..8bca2d7
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-mfac_uiui.c
@@ -0,0 +1,135 @@
+/* Exercise mpz_mfac_uiui.
+
+Copyright 2000-2002, 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+/* Usage: t-mfac_uiui [x|num]
+
+ With no arguments testing goes up to the initial value of "limit" below.
+ With a number argument tests are carried that far, or with a literal "x"
+ tests are continued without limit (this being meant only for development
+ purposes). */
+
+#define MULTIFAC_WHEEL (2*3*11)
+#define MULTIFAC_WHEEL2 (5*13)
+
+int
+main (int argc, char *argv[])
+{
+ mpz_t ref[MULTIFAC_WHEEL], ref2[MULTIFAC_WHEEL2], res;
+ unsigned long n, j, m, m2;
+ unsigned long limit = 2222, step = 1;
+
+ tests_start ();
+
+ if (argc > 1 && argv[1][0] == 'x')
+ limit = ULONG_MAX;
+ else
+ TESTS_REPS (limit, argv, argc);
+
+ /* for small limb testing */
+ limit = MIN (limit, MP_LIMB_T_MAX);
+
+ for (m = 0; m < MULTIFAC_WHEEL; m++)
+ mpz_init_set_ui(ref [m],1);
+ for (m2 = 0; m2 < MULTIFAC_WHEEL2; m2++)
+ mpz_init_set_ui(ref2 [m2],1);
+
+ mpz_init (res);
+
+ m = 0;
+ m2 = 0;
+ for (n = 0; n <= limit;)
+ {
+ mpz_mfac_uiui (res, n, MULTIFAC_WHEEL);
+ MPZ_CHECK_FORMAT (res);
+ if (mpz_cmp (ref[m], res) != 0)
+ {
+ printf ("mpz_mfac_uiui(%lu,%d) wrong\n", n, MULTIFAC_WHEEL);
+ printf (" got "); mpz_out_str (stdout, 10, res); printf("\n");
+ printf (" want "); mpz_out_str (stdout, 10, ref[m]); printf("\n");
+ abort ();
+ }
+ mpz_mfac_uiui (res, n, MULTIFAC_WHEEL2);
+ MPZ_CHECK_FORMAT (res);
+ if (mpz_cmp (ref2[m2], res) != 0)
+ {
+ printf ("mpz_mfac_uiui(%lu,%d) wrong\n", n, MULTIFAC_WHEEL2);
+ printf (" got "); mpz_out_str (stdout, 10, res); printf("\n");
+ printf (" want "); mpz_out_str (stdout, 10, ref2[m2]); printf("\n");
+ abort ();
+ }
+ if (n + step <= limit)
+ for (j = 0; j < step; j++) {
+ n++; m++; m2++;
+ if (m >= MULTIFAC_WHEEL) m -= MULTIFAC_WHEEL;
+ if (m2 >= MULTIFAC_WHEEL2) m2 -= MULTIFAC_WHEEL2;
+ mpz_mul_ui (ref[m], ref[m], n); /* Compute a reference, with current library */
+ mpz_mul_ui (ref2[m2], ref2[m2], n); /* Compute a reference, with current library */
+ }
+ else n += step;
+ }
+ mpz_fac_ui (ref[0], n);
+ mpz_mfac_uiui (res, n, 1);
+ MPZ_CHECK_FORMAT (res);
+ if (mpz_cmp (ref[0], res) != 0)
+ {
+ printf ("mpz_mfac_uiui(%lu,1) wrong\n", n);
+ printf (" got "); mpz_out_str (stdout, 10, res); printf("\n");
+ printf (" want "); mpz_out_str (stdout, 10, ref[0]); printf("\n");
+ abort ();
+ }
+
+ mpz_2fac_ui (ref[0], n);
+ mpz_mfac_uiui (res, n, 2);
+ MPZ_CHECK_FORMAT (res);
+ if (mpz_cmp (ref[0], res) != 0)
+ {
+ printf ("mpz_mfac_uiui(%lu,1) wrong\n", n);
+ printf (" got "); mpz_out_str (stdout, 10, res); printf("\n");
+ printf (" want "); mpz_out_str (stdout, 10, ref[0]); printf("\n");
+ abort ();
+ }
+
+ n++;
+ mpz_2fac_ui (ref[0], n);
+ mpz_mfac_uiui (res, n, 2);
+ MPZ_CHECK_FORMAT (res);
+ if (mpz_cmp (ref[0], res) != 0)
+ {
+ printf ("mpz_mfac_uiui(%lu,2) wrong\n", n);
+ printf (" got "); mpz_out_str (stdout, 10, res); printf("\n");
+ printf (" want "); mpz_out_str (stdout, 10, ref[0]); printf("\n");
+ abort ();
+ }
+
+ for (m = 0; m < MULTIFAC_WHEEL; m++)
+ mpz_clear (ref[m]);
+ for (m2 = 0; m2 < MULTIFAC_WHEEL2; m2++)
+ mpz_clear (ref2[m2]);
+ mpz_clear (res);
+
+ tests_end ();
+
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-mul.c b/vendor/gmp-6.3.0/tests/mpz/t-mul.c
new file mode 100644
index 0000000..0dc22e9
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-mul.c
@@ -0,0 +1,221 @@
+/* Test mpz_cmp, mpz_mul.
+
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2004 Free Software Foundation,
+Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "longlong.h"
+#include "tests.h"
+
+void debug_mp (mpz_t);
+static void refmpz_mul (mpz_t, const mpz_t, const mpz_t);
+void dump_abort (int, const char *, mpz_t, mpz_t, mpz_t, mpz_t);
+
+#define FFT_MIN_BITSIZE 100000
+
+char *extra_fft;
+
+void
+one (int i, mpz_t multiplicand, mpz_t multiplier)
+{
+ mpz_t product, ref_product;
+
+ mpz_init (product);
+ mpz_init (ref_product);
+
+ /* Test plain multiplication comparing results against reference code. */
+ mpz_mul (product, multiplier, multiplicand);
+ refmpz_mul (ref_product, multiplier, multiplicand);
+ if (mpz_cmp (product, ref_product))
+ dump_abort (i, "incorrect plain product",
+ multiplier, multiplicand, product, ref_product);
+
+ /* Test squaring, comparing results against plain multiplication */
+ mpz_mul (product, multiplier, multiplier);
+ mpz_set (multiplicand, multiplier);
+ mpz_mul (ref_product, multiplier, multiplicand);
+ if (mpz_cmp (product, ref_product))
+ dump_abort (i, "incorrect square product",
+ multiplier, multiplier, product, ref_product);
+
+ mpz_clear (product);
+ mpz_clear (ref_product);
+}
+
+int
+main (int argc, char **argv)
+{
+ mpz_t op1, op2;
+ int i;
+ int fft_max_2exp;
+
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range, fsize_range;
+
+ tests_start ();
+ rands = RANDS;
+
+ extra_fft = getenv ("GMP_CHECK_FFT");
+ fft_max_2exp = 0;
+ if (extra_fft != NULL)
+ {
+ fft_max_2exp = atoi (extra_fft);
+ printf ("GMP_CHECK_FFT=%d (include this in bug reports)\n", fft_max_2exp);
+ }
+
+ if (fft_max_2exp <= 1) /* compat with old use of GMP_CHECK_FFT */
+ fft_max_2exp = 22; /* default limit, good for any machine */
+
+ mpz_init (bs);
+ mpz_init (op1);
+ mpz_init (op2);
+
+ fsize_range = 4 << 8; /* a fraction 1/256 of size_range */
+ for (i = 0;; i++)
+ {
+ size_range = fsize_range >> 8;
+ fsize_range = fsize_range * 33 / 32;
+
+ if (size_range > fft_max_2exp)
+ break;
+
+ mpz_urandomb (bs, rands, size_range);
+ mpz_rrandomb (op1, rands, mpz_get_ui (bs));
+ if (i & 1)
+ mpz_urandomb (bs, rands, size_range);
+ mpz_rrandomb (op2, rands, mpz_get_ui (bs));
+
+ mpz_urandomb (bs, rands, 4);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 0x3) == 0)
+ mpz_neg (op1, op1);
+ if ((bsi & 0xC) == 0)
+ mpz_neg (op2, op2);
+
+ /* printf ("%d %d\n", SIZ (op1), SIZ (op2)); */
+ one (i, op2, op1);
+ }
+
+ for (i = -50; i < 0; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % fft_max_2exp;
+
+ mpz_urandomb (bs, rands, size_range);
+ mpz_rrandomb (op1, rands, mpz_get_ui (bs) + FFT_MIN_BITSIZE);
+ mpz_urandomb (bs, rands, size_range);
+ mpz_rrandomb (op2, rands, mpz_get_ui (bs) + FFT_MIN_BITSIZE);
+
+ /* printf ("%d: %d %d\n", i, SIZ (op1), SIZ (op2)); */
+ fflush (stdout);
+ one (-1, op2, op1);
+ }
+
+ mpz_clear (bs);
+ mpz_clear (op1);
+ mpz_clear (op2);
+
+ tests_end ();
+ exit (0);
+}
+
+static void
+refmpz_mul (mpz_t w, const mpz_t u, const mpz_t v)
+{
+ mp_size_t usize = u->_mp_size;
+ mp_size_t vsize = v->_mp_size;
+ mp_size_t wsize;
+ mp_size_t sign_product;
+ mp_ptr up, vp;
+ mp_ptr wp;
+ mp_size_t talloc;
+
+ sign_product = usize ^ vsize;
+ usize = ABS (usize);
+ vsize = ABS (vsize);
+
+ if (usize == 0 || vsize == 0)
+ {
+ SIZ (w) = 0;
+ return;
+ }
+
+ talloc = usize + vsize;
+
+ up = u->_mp_d;
+ vp = v->_mp_d;
+
+ wp = __GMP_ALLOCATE_FUNC_LIMBS (talloc);
+
+ if (usize > vsize)
+ refmpn_mul (wp, up, usize, vp, vsize);
+ else
+ refmpn_mul (wp, vp, vsize, up, usize);
+ wsize = usize + vsize;
+ wsize -= wp[wsize - 1] == 0;
+ MPZ_REALLOC (w, wsize);
+ MPN_COPY (PTR(w), wp, wsize);
+
+ SIZ(w) = sign_product < 0 ? -wsize : wsize;
+ __GMP_FREE_FUNC_LIMBS (wp, talloc);
+}
+
+void
+dump_abort (int i, const char *s,
+ mpz_t op1, mpz_t op2, mpz_t product, mpz_t ref_product)
+{
+ mp_size_t b, e;
+ fprintf (stderr, "ERROR: %s in test %d\n", s, i);
+ fprintf (stderr, "op1 = "); debug_mp (op1);
+ fprintf (stderr, "op2 = "); debug_mp (op2);
+ fprintf (stderr, " product = "); debug_mp (product);
+ fprintf (stderr, "ref_product = "); debug_mp (ref_product);
+ for (b = 0; b < ABSIZ(ref_product); b++)
+ if (PTR(ref_product)[b] != PTR(product)[b])
+ break;
+ for (e = ABSIZ(ref_product) - 1; e >= 0; e--)
+ if (PTR(ref_product)[e] != PTR(product)[e])
+ break;
+ printf ("ERRORS in %ld--%ld\n", b, e);
+ abort();
+}
+
+void
+debug_mp (mpz_t x)
+{
+ size_t siz = mpz_sizeinbase (x, 16);
+
+ if (siz > 65)
+ {
+ mpz_t q;
+ mpz_init (q);
+ mpz_tdiv_q_2exp (q, x, 4 * (mpz_sizeinbase (x, 16) - 25));
+ gmp_fprintf (stderr, "%ZX...", q);
+ mpz_tdiv_r_2exp (q, x, 4 * 25);
+ gmp_fprintf (stderr, "%025ZX [%d]\n", q, (int) siz);
+ mpz_clear (q);
+ }
+ else
+ {
+ gmp_fprintf (stderr, "%ZX\n", x);
+ }
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-mul_i.c b/vendor/gmp-6.3.0/tests/mpz/t-mul_i.c
new file mode 100644
index 0000000..5f2dae2
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-mul_i.c
@@ -0,0 +1,134 @@
+/* Test mpz_mul_ui and mpz_mul_si.
+
+Copyright 2001, 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+mpz_t got, want, x;
+
+void
+compare_si (long y)
+{
+ if (mpz_cmp (got, want) != 0)
+ {
+ printf ("mpz_mul_si wrong\n");
+ mpz_trace (" x", x);
+ printf (" y=%ld (0x%lX)\n", y, y);
+ mpz_trace (" got ", got);
+ mpz_trace (" want", want);
+ abort ();
+ }
+}
+
+void
+compare_ui (unsigned long y)
+{
+ if (mpz_cmp (got, want) != 0)
+ {
+ printf ("mpz_mul_ui wrong\n");
+ mpz_trace (" x", x);
+ printf (" y=%lu (0x%lX)\n", y, y);
+ mpz_trace (" got ", got);
+ mpz_trace (" want", want);
+ abort ();
+ }
+}
+
+void
+check_samples (void)
+{
+ {
+ long y;
+
+ mpz_set_ui (x, 1L);
+ y = 0;
+ mpz_mul_si (got, x, y);
+ mpz_set_si (want, y);
+ compare_si (y);
+
+ mpz_set_ui (x, 1L);
+ y = 1;
+ mpz_mul_si (got, x, y);
+ mpz_set_si (want, y);
+ compare_si (y);
+
+ mpz_set_ui (x, 1L);
+ y = -1;
+ mpz_mul_si (got, x, y);
+ mpz_set_si (want, y);
+ compare_si (y);
+
+ mpz_set_ui (x, 1L);
+ y = LONG_MIN;
+ mpz_mul_si (got, x, y);
+ mpz_set_si (want, y);
+ compare_si (y);
+
+ mpz_set_ui (x, 1L);
+ y = LONG_MAX;
+ mpz_mul_si (got, x, y);
+ mpz_set_si (want, y);
+ compare_si (y);
+ }
+
+ {
+ unsigned long y;
+
+ mpz_set_ui (x, 1L);
+ y = 0;
+ mpz_mul_ui (got, x, y);
+ mpz_set_ui (want, y);
+ compare_ui (y);
+
+ mpz_set_ui (x, 1L);
+ y = 1;
+ mpz_mul_ui (got, x, y);
+ mpz_set_ui (want, y);
+ compare_ui (y);
+
+ mpz_set_ui (x, 1L);
+ y = ULONG_MAX;
+ mpz_mul_ui (got, x, y);
+ mpz_set_ui (want, y);
+ compare_ui (y);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ tests_start ();
+
+ mpz_init (x);
+ mpz_init (got);
+ mpz_init (want);
+
+ check_samples ();
+
+ mpz_clear (x);
+ mpz_clear (got);
+ mpz_clear (want);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-nextprime.c b/vendor/gmp-6.3.0/tests/mpz/t-nextprime.c
new file mode 100644
index 0000000..d2fbaef
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-nextprime.c
@@ -0,0 +1,459 @@
+/* Test mpz_nextprime.
+
+Copyright 2009, 2015, 2018, 2020 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+void
+refmpz_nextprime (mpz_ptr p, mpz_srcptr t)
+{
+ mpz_add_ui (p, t, 1L);
+ while (! mpz_probab_prime_p (p, 10))
+ mpz_add_ui (p, p, 1L);
+}
+
+void
+refmpz_prevprime (mpz_ptr p, mpz_srcptr t)
+{
+ if (mpz_cmp_ui(t, 2) <= 0)
+ return;
+
+ mpz_sub_ui (p, t, 1L);
+ while (! mpz_probab_prime_p (p, 10))
+ mpz_sub_ui (p, p, 1L);
+}
+
+void
+test_largegap (mpz_t low, const int gap)
+{
+ mpz_t t, nxt;
+ mpz_init (t);
+ mpz_init (nxt);
+
+ mpz_nextprime(nxt, low);
+ mpz_sub(t, nxt, low);
+
+ if (mpz_cmp_ui(t, gap) != 0)
+ {
+ gmp_printf ("nextprime gap %Zd => %Zd != %d\n", low, nxt, gap);
+ abort ();
+ }
+
+ mpz_prevprime(t, nxt);
+ if (mpz_cmp(t, low) != 0)
+ {
+ gmp_printf ("prevprime gap %Zd => %Zd != %d\n", nxt, t, gap);
+ abort ();
+ }
+
+ mpz_clear (t);
+ mpz_clear (nxt);
+}
+
+void
+test_largegaps ()
+{
+ mpz_t n;
+
+ mpz_init (n);
+
+ // largest gap with start < 2^32.
+ mpz_set_str (n, "3842610773", 10);
+ test_largegap (n, 336);
+
+ // largest gap with start < 2^64.
+ mpz_set_str (n, "18361375334787046697", 10);
+ test_largegap (n, 1550);
+
+ // test high merit primegap in the P30 digit range.
+ mpz_set_str (n, "3001549619028223830552751967", 10);
+ test_largegap (n, 2184);
+
+ // test high merit primegap in the P100 range.
+ mpz_primorial_ui (n, 257);
+ mpz_divexact_ui (n, n, 5610);
+ mpz_mul_ui (n, n, 4280516017UL);
+ mpz_sub_ui (n, n, 2560);
+ test_largegap (n, 9006);
+
+ // test high merit primegap in the P200 range.
+ mpz_primorial_ui (n, 409);
+ mpz_divexact_ui (n, n, 30);
+ mpz_mul_ui (n, n, 3483347771UL);
+ mpz_sub_ui (n, n, 7016);
+ test_largegap (n, 15900);
+
+ mpz_clear (n);
+}
+
+void
+test_bitboundaries ()
+{
+ mpz_t n;
+ mpz_init (n);
+
+ mpz_set_str (n, "0xfff1", 0);
+ test_largegap (n, 16);
+
+ mpz_set_str (n, "0xfffffffb", 0);
+ test_largegap (n, 20);
+
+ mpz_set_str (n, "0xffffffffffc5", 0);
+ test_largegap (n, 80);
+
+ mpz_set_str (n, "0xffffffffffffffc5", 0);
+ test_largegap (n, 72);
+
+ mpz_set_str (n, "0xffffffffffffffffffbf", 0);
+ test_largegap (n, 78);
+
+ mpz_set_str (n, "0xffffffffffffffffffffffef", 0);
+ test_largegap (n, 78);
+
+ mpz_set_str (n, "0xffffffffffffffffffffffffffb5", 0);
+ test_largegap (n, 100);
+
+ mpz_set_str (n, "0xffffffffffffffffffffffffffffff61", 0);
+ test_largegap (n, 210);
+
+ mpz_set_str (n, "0xffffffffffffffffffffffffffffffffffffffffffffff13", 0);
+ test_largegap (n, 370);
+
+ mpz_clear (n);
+}
+
+void
+run (const char *start, int reps, const char *end, short diffs[])
+{
+ mpz_t x, y;
+ int i;
+
+ mpz_init_set_str (x, start, 0);
+ mpz_init (y);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_nextprime (y, x);
+ mpz_sub (x, y, x);
+ if (diffs != NULL &&
+ (! mpz_fits_sshort_p (x) || diffs[i] != (short) mpz_get_ui (x)))
+ {
+ gmp_printf ("diff list discrepancy\n");
+ abort ();
+ }
+ mpz_swap (x, y);
+ }
+
+ mpz_set_str (y, end, 0);
+
+ if (mpz_cmp (x, y) != 0)
+ {
+ gmp_printf ("got %Zd\n", x);
+ gmp_printf ("want %Zd\n", y);
+ abort ();
+ }
+
+ mpz_clear (y);
+ mpz_clear (x);
+}
+
+void
+run_p (const char *start, int reps, const char *end, short diffs[])
+{
+ mpz_t x, y;
+ int i;
+
+ mpz_init_set_str (x, end, 0);
+ mpz_init (y);
+
+ // Last rep doesn't share same data with nextprime
+ for (i = 0; i < reps - 1; i++)
+ {
+ mpz_prevprime (y, x);
+ mpz_sub (x, x, y);
+ if (diffs != NULL &&
+ (! mpz_fits_sshort_p (x) || diffs[reps - i - 1] != (short) mpz_get_ui (x)))
+ {
+ gmp_printf ("diff list discrepancy %Zd, %d vs %d\n",
+ y, diffs[i], mpz_get_ui (x));
+ abort ();
+ }
+ mpz_swap (x, y);
+ }
+
+ // starts aren't always prime, so check that result is less than or equal
+ mpz_prevprime(x, x);
+
+ mpz_set_str(y, start, 0);
+ if (mpz_cmp (x, y) > 0)
+ {
+ gmp_printf ("got %Zd\n", x);
+ gmp_printf ("want %Zd\n", y);
+ abort ();
+ }
+
+ mpz_clear (y);
+ mpz_clear (x);
+}
+
+
+extern short diff1[];
+extern short diff3[];
+extern short diff4[];
+extern short diff5[];
+extern short diff6[];
+
+void
+test_ref (gmp_randstate_ptr rands, int reps,
+ void (*func)(mpz_t, const mpz_t),
+ void(*ref_func)(mpz_t, const mpz_t))
+{
+ int i;
+ mpz_t bs, x, test_p, ref_p;
+ unsigned long size_range;
+
+ mpz_init (bs);
+ mpz_init (x);
+ mpz_init (test_p);
+ mpz_init (ref_p);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 8 + 2; /* 0..1024 bit operands */
+
+ mpz_urandomb (bs, rands, size_range);
+ mpz_rrandomb (x, rands, mpz_get_ui (bs));
+
+ func (test_p, x);
+ ref_func (ref_p, x);
+ if (mpz_cmp (test_p, ref_p) != 0)
+ {
+ gmp_printf ("start %Zd\n", x);
+ gmp_printf ("got %Zd\n", test_p);
+ gmp_printf ("want %Zd\n", ref_p);
+ abort ();
+ }
+ }
+
+ mpz_clear (bs);
+ mpz_clear (x);
+ mpz_clear (test_p);
+ mpz_clear (ref_p);
+}
+
+void
+test_nextprime(gmp_randstate_ptr rands, int reps)
+{
+ run ("2", 1000, "0x1ef7", diff1);
+
+ run ("3", 1000 - 1, "0x1ef7", NULL);
+
+ run ("0x8a43866f5776ccd5b02186e90d28946aeb0ed914", 50,
+ "0x8a43866f5776ccd5b02186e90d28946aeb0eeec5", diff3);
+
+ run ("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6C", 50, /* 2^148 - 148 */
+ "0x100000000000000000000000000000000010ab", diff4);
+
+ run ("0x1c2c26be55317530311facb648ea06b359b969715db83292ab8cf898d8b1b", 50,
+ "0x1c2c26be55317530311facb648ea06b359b969715db83292ab8cf898da957", diff5);
+
+ run ("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80", 50, /* 2^128 - 128 */
+ "0x10000000000000000000000000000155B", diff6);
+
+ test_ref(
+ rands, reps,
+ (void (*)(mpz_t, const mpz_t)) mpz_nextprime,
+ refmpz_nextprime);
+}
+
+void
+test_prevprime (gmp_randstate_ptr rands, int reps)
+{
+ long i;
+ int retval;
+ mpz_t n, prvp;
+
+ mpz_init (n);
+ mpz_init (prvp);
+
+ /* Test mpz_prevprime(n <= 2) returns 0, leaves rop unchanged. */
+ {
+ int temp = 123;
+ mpz_set_ui (prvp, temp);
+ for (i = 0; i <= 2; i++)
+ {
+ mpz_set_si(n, i);
+ retval = mpz_prevprime (prvp, n);
+ if ( retval != 0 || mpz_cmp_ui (prvp, temp) != 0 )
+ {
+ gmp_printf ("mpz_prevprime(%Zd) return (%d) rop (%Zd)\n", n, retval, prvp);
+ abort ();
+ }
+ }
+ }
+
+ mpz_clear (n);
+ mpz_clear (prvp);
+
+ run_p ("2", 1000, "0x1ef7", diff1);
+
+ run_p ("3", 1000 - 1, "0x1ef7", NULL);
+
+ run_p ("0x8a43866f5776ccd5b02186e90d28946aeb0ed914", 50,
+ "0x8a43866f5776ccd5b02186e90d28946aeb0eeec5", diff3);
+
+ run_p ("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6C", 50, /* 2^148 - 148 */
+ "0x100000000000000000000000000000000010ab", diff4);
+
+ run_p ("0x1c2c26be55317530311facb648ea06b359b969715db83292ab8cf898d8b1b", 50,
+ "0x1c2c26be55317530311facb648ea06b359b969715db83292ab8cf898da957", diff5);
+
+ run_p ("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80", 50, /* 2^128 - 128 */
+ "0x10000000000000000000000000000155B", diff6);
+
+ // Cast away int return from mpz_prevprime for test ref.
+ test_ref(
+ rands, reps,
+ (void (*)(mpz_t, const mpz_t)) mpz_prevprime,
+ refmpz_prevprime);
+}
+
+int
+main (int argc, char **argv)
+{
+ gmp_randstate_ptr rands;
+ int reps = 20;
+
+ tests_start();
+
+ rands = RANDS;
+ TESTS_REPS (reps, argv, argc);
+
+ test_nextprime(rands, reps);
+ test_prevprime(rands, reps);
+
+ test_largegaps ();
+ test_bitboundaries ();
+
+ tests_end ();
+ return 0;
+}
+
+short diff1[] =
+{
+ 1,2,2,4,2,4,2,4,6,2,6,4,2,4,6,6,
+ 2,6,4,2,6,4,6,8,4,2,4,2,4,14,4,6,
+ 2,10,2,6,6,4,6,6,2,10,2,4,2,12,12,4,
+ 2,4,6,2,10,6,6,6,2,6,4,2,10,14,4,2,
+ 4,14,6,10,2,4,6,8,6,6,4,6,8,4,8,10,
+ 2,10,2,6,4,6,8,4,2,4,12,8,4,8,4,6,
+ 12,2,18,6,10,6,6,2,6,10,6,6,2,6,6,4,
+ 2,12,10,2,4,6,6,2,12,4,6,8,10,8,10,8,
+ 6,6,4,8,6,4,8,4,14,10,12,2,10,2,4,2,
+ 10,14,4,2,4,14,4,2,4,20,4,8,10,8,4,6,
+ 6,14,4,6,6,8,6,12,4,6,2,10,2,6,10,2,
+ 10,2,6,18,4,2,4,6,6,8,6,6,22,2,10,8,
+ 10,6,6,8,12,4,6,6,2,6,12,10,18,2,4,6,
+ 2,6,4,2,4,12,2,6,34,6,6,8,18,10,14,4,
+ 2,4,6,8,4,2,6,12,10,2,4,2,4,6,12,12,
+ 8,12,6,4,6,8,4,8,4,14,4,6,2,4,6,2,
+ 6,10,20,6,4,2,24,4,2,10,12,2,10,8,6,6,
+ 6,18,6,4,2,12,10,12,8,16,14,6,4,2,4,2,
+ 10,12,6,6,18,2,16,2,22,6,8,6,4,2,4,8,
+ 6,10,2,10,14,10,6,12,2,4,2,10,12,2,16,2,
+ 6,4,2,10,8,18,24,4,6,8,16,2,4,8,16,2,
+ 4,8,6,6,4,12,2,22,6,2,6,4,6,14,6,4,
+ 2,6,4,6,12,6,6,14,4,6,12,8,6,4,26,18,
+ 10,8,4,6,2,6,22,12,2,16,8,4,12,14,10,2,
+ 4,8,6,6,4,2,4,6,8,4,2,6,10,2,10,8,
+ 4,14,10,12,2,6,4,2,16,14,4,6,8,6,4,18,
+ 8,10,6,6,8,10,12,14,4,6,6,2,28,2,10,8,
+ 4,14,4,8,12,6,12,4,6,20,10,2,16,26,4,2,
+ 12,6,4,12,6,8,4,8,22,2,4,2,12,28,2,6,
+ 6,6,4,6,2,12,4,12,2,10,2,16,2,16,6,20,
+ 16,8,4,2,4,2,22,8,12,6,10,2,4,6,2,6,
+ 10,2,12,10,2,10,14,6,4,6,8,6,6,16,12,2,
+ 4,14,6,4,8,10,8,6,6,22,6,2,10,14,4,6,
+ 18,2,10,14,4,2,10,14,4,8,18,4,6,2,4,6,
+ 2,12,4,20,22,12,2,4,6,6,2,6,22,2,6,16,
+ 6,12,2,6,12,16,2,4,6,14,4,2,18,24,10,6,
+ 2,10,2,10,2,10,6,2,10,2,10,6,8,30,10,2,
+ 10,8,6,10,18,6,12,12,2,18,6,4,6,6,18,2,
+ 10,14,6,4,2,4,24,2,12,6,16,8,6,6,18,16,
+ 2,4,6,2,6,6,10,6,12,12,18,2,6,4,18,8,
+ 24,4,2,4,6,2,12,4,14,30,10,6,12,14,6,10,
+ 12,2,4,6,8,6,10,2,4,14,6,6,4,6,2,10,
+ 2,16,12,8,18,4,6,12,2,6,6,6,28,6,14,4,
+ 8,10,8,12,18,4,2,4,24,12,6,2,16,6,6,14,
+ 10,14,4,30,6,6,6,8,6,4,2,12,6,4,2,6,
+ 22,6,2,4,18,2,4,12,2,6,4,26,6,6,4,8,
+ 10,32,16,2,6,4,2,4,2,10,14,6,4,8,10,6,
+ 20,4,2,6,30,4,8,10,6,6,8,6,12,4,6,2,
+ 6,4,6,2,10,2,16,6,20,4,12,14,28,6,20,4,
+ 18,8,6,4,6,14,6,6,10,2,10,12,8,10,2,10,
+ 8,12,10,24,2,4,8,6,4,8,18,10,6,6,2,6,
+ 10,12,2,10,6,6,6,8,6,10,6,2,6,6,6,10,
+ 8,24,6,22,2,18,4,8,10,30,8,18,4,2,10,6,
+ 2,6,4,18,8,12,18,16,6,2,12,6,10,2,10,2,
+ 6,10,14,4,24,2,16,2,10,2,10,20,4,2,4,8,
+ 16,6,6,2,12,16,8,4,6,30,2,10,2,6,4,6,
+ 6,8,6,4,12,6,8,12,4,14,12,10,24,6,12,6,
+ 2,22,8,18,10,6,14,4,2,6,10,8,6,4,6,30,
+ 14,10,2,12,10,2,16,2,18,24,18,6,16,18,6,2,
+ 18,4,6,2,10,8,10,6,6,8,4,6,2,10,2,12,
+ 4,6,6,2,12,4,14,18,4,6,20,4,8,6,4,8,
+ 4,14,6,4,14,12,4,2,30,4,24,6,6,12,12,14,
+ 6,4,2,4,18,6,12,8
+};
+
+short diff3[] =
+{
+ 33,32,136,116,24,22,104,114,76,278,238,162,36,44,388,134,
+ 130,26,312,42,138,28,24,80,138,108,270,12,330,130,98,102,
+ 162,34,36,170,90,34,14,6,24,66,154,218,70,132,188,88,
+ 80,82
+};
+
+short diff4[] =
+{
+ 239,92,64,6,104,24,46,258,68,18,54,100,68,154,26,4,
+ 38,142,168,42,18,26,286,104,136,116,40,2,28,110,52,78,
+ 104,24,54,96,4,626,196,24,56,36,52,102,48,156,26,18,
+ 42,40
+};
+
+short diff5[] =
+{
+ 268,120,320,184,396,2,94,108,20,318,274,14,64,122,220,108,
+ 18,174,6,24,348,32,64,116,268,162,20,156,28,110,52,428,
+ 196,14,262,30,194,120,300,66,268,12,428,370,212,198,192,130,
+ 30,80
+};
+
+short diff6[] =
+{
+ 179,30,84,108,112,36,42,110,52,132,60,30,326,114,496,92,100,
+ 272,36,54,90,4,2,24,40,398,150,72,60,16,8,4,80,16,2,342,112,
+ 14,136,236,40,18,50,192,198,204,40,266,42,274
+};
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-oddeven.c b/vendor/gmp-6.3.0/tests/mpz/t-oddeven.c
new file mode 100644
index 0000000..eedad4b
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-oddeven.c
@@ -0,0 +1,87 @@
+/* Test mpz_odd_p and mpz_even_p.
+
+Copyright 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *n;
+ int odd, even;
+ } data[] = {
+ { "0", 0, 1 },
+ { "1", 1, 0 },
+ { "2", 0, 1 },
+ { "3", 1, 0 },
+ { "4", 0, 1 },
+
+ { "-4", 0, 1 },
+ { "-3", 1, 0 },
+ { "-2", 0, 1 },
+ { "-1", 1, 0 },
+
+ { "0x1000000000000000000000000000000000000000000000000000", 0, 1 },
+ { "0x1000000000000000000000000000000000000000000000000001", 1, 0 },
+ { "0x1000000000000000000000000000000000000000000000000002", 0, 1 },
+ { "0x1000000000000000000000000000000000000000000000000003", 1, 0 },
+
+ { "-0x1000000000000000000000000000000000000000000000000004", 0, 1 },
+ { "-0x1000000000000000000000000000000000000000000000000003", 1, 0 },
+ { "-0x1000000000000000000000000000000000000000000000000002", 0, 1 },
+ { "-0x1000000000000000000000000000000000000000000000000001", 1, 0 },
+ };
+
+ mpz_t n;
+ int i;
+
+ mpz_init (n);
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_str_or_abort (n, data[i].n, 0);
+
+ if ((mpz_odd_p (n) != 0) != data[i].odd)
+ {
+ printf ("mpz_odd_p wrong on data[%d]\n", i);
+ abort();
+ }
+
+ if ((mpz_even_p (n) != 0) != data[i].even)
+ {
+ printf ("mpz_even_p wrong on data[%d]\n", i);
+ abort();
+ }
+ }
+
+ mpz_clear (n);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_data ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-perfpow.c b/vendor/gmp-6.3.0/tests/mpz/t-perfpow.c
new file mode 100644
index 0000000..84f9c8e
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-perfpow.c
@@ -0,0 +1,247 @@
+/* Test mpz_perfect_power_p.
+
+ Contributed to the GNU project by Torbjorn Granlund and Martin Boij.
+
+Copyright 2008-2010, 2014 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+struct
+{
+ const char *num_as_str;
+ char want;
+} static tests[] =
+ {
+ { "0", 1},
+ { "1", 1},
+ {"-1", 1},
+ { "2", 0},
+ {"-2", 0},
+ { "3", 0},
+ {"-3", 0},
+ { "4", 1},
+ {"-4", 0},
+ { "64", 1},
+ {"-64", 1},
+ { "128", 1},
+ {"-128", 1},
+ { "256", 1},
+ {"-256", 0},
+ { "512", 1},
+ {"-512", 1},
+ { "0x4000000", 1},
+ {"-0x4000000", 1},
+ { "0x3cab640", 1},
+ {"-0x3cab640", 0},
+ { "0x3e23840", 1},
+ {"-0x3e23840", 0},
+ { "0x3d3a7ed1", 1},
+ {"-0x3d3a7ed1", 1},
+ { "0x30a7a6000", 1},
+ {"-0x30a7a6000", 1},
+ { "0xf33e5a5a59", 1},
+ {"-0xf33e5a5a59", 0},
+ { "0xed1b1182118135d", 1},
+ {"-0xed1b1182118135d", 1},
+ { "0xe71f6eb7689cc276b2f1", 1},
+ {"-0xe71f6eb7689cc276b2f1", 0},
+ { "0x12644507fe78cf563a4b342c92e7da9fe5e99cb75a01", 1},
+ {"-0x12644507fe78cf563a4b342c92e7da9fe5e99cb75a01", 0},
+ { "0x1ff2e7c581bb0951df644885bd33f50e472b0b73a204e13cbe98fdb424d66561e4000000", 1},
+ {"-0x1ff2e7c581bb0951df644885bd33f50e472b0b73a204e13cbe98fdb424d66561e4000000", 1},
+ { "0x2b9b44db2d91a6f8165c8c7339ef73633228ea29e388592e80354e4380004aad84000000", 1},
+ {"-0x2b9b44db2d91a6f8165c8c7339ef73633228ea29e388592e80354e4380004aad84000000", 1},
+ { "0x28d5a2b8f330910a9d3cda06036ae0546442e5b1a83b26a436efea5b727bf1bcbe7e12b47d81", 1},
+ {"-0x28d5a2b8f330910a9d3cda06036ae0546442e5b1a83b26a436efea5b727bf1bcbe7e12b47d81", 1},
+ {NULL, 0}
+ };
+
+
+void
+check_tests ()
+{
+ mpz_t x;
+ int i;
+ int got, want;
+
+ mpz_init (x);
+
+ for (i = 0; tests[i].num_as_str != NULL; i++)
+ {
+ mpz_set_str (x, tests[i].num_as_str, 0);
+ got = mpz_perfect_power_p (x);
+ want = tests[i].want;
+ if (got != want)
+ {
+ fprintf (stderr, "mpz_perfect_power_p returns %d when %d was expected\n", got, want);
+ fprintf (stderr, "fault operand: %s\n", tests[i].num_as_str);
+ abort ();
+ }
+ }
+
+ mpz_clear (x);
+}
+
+#define NRP 15
+
+void
+check_random (int reps)
+{
+ mpz_t n, np, temp, primes[NRP];
+ int i, j, k, unique, destroy, res;
+ unsigned long int nrprimes, primebits;
+ mp_limb_t g, exp[NRP], e;
+ gmp_randstate_ptr rands;
+
+ rands = RANDS;
+
+ mpz_init (n);
+ mpz_init (np);
+ mpz_init (temp);
+
+ for (i = 0; i < NRP; i++)
+ mpz_init (primes[i]);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (np, rands, 32);
+ nrprimes = mpz_get_ui (np) % NRP + 1; /* 1-NRP unique primes */
+
+ mpz_urandomb (np, rands, 32);
+ g = mpz_get_ui (np) % 32 + 2; /* gcd 2-33 */
+
+ for (j = 0; j < nrprimes;)
+ {
+ mpz_urandomb (np, rands, 32);
+ primebits = mpz_get_ui (np) % 100 + 3; /* 3-102 bit primes */
+ mpz_urandomb (primes[j], rands, primebits);
+ mpz_nextprime (primes[j], primes[j]);
+ unique = 1;
+ for (k = 0; k < j; k++)
+ {
+ if (mpz_cmp (primes[j], primes[k]) == 0)
+ {
+ unique = 0;
+ break;
+ }
+ }
+ if (unique)
+ {
+ mpz_urandomb (np, rands, 32);
+ e = 371 / (10 * primebits) + mpz_get_ui (np) % 11 + 1; /* Magic constants */
+ exp[j++] = g * e;
+ }
+ }
+
+ if (nrprimes > 1)
+ {
+ /* Destroy d exponents, d in [1, nrprimes - 1] */
+ if (nrprimes == 2)
+ {
+ destroy = 1;
+ }
+ else
+ {
+ mpz_urandomb (np, rands, 32);
+ destroy = mpz_get_ui (np) % (nrprimes - 2);
+ }
+
+ g = exp[destroy];
+ for (k = destroy + 1; k < nrprimes; k++)
+ g = mpn_gcd_1 (&g, 1, exp[k]);
+
+ for (j = 0; j < destroy; j++)
+ {
+ mpz_urandomb (np, rands, 32);
+ e = mpz_get_ui (np) % 50 + 1;
+ while (mpn_gcd_1 (&g, 1, e) > 1)
+ e++;
+
+ exp[j] = e;
+ }
+ }
+
+ /* Compute n */
+ mpz_pow_ui (n, primes[0], exp[0]);
+ for (j = 1; j < nrprimes; j++)
+ {
+ mpz_pow_ui (temp, primes[j], exp[j]);
+ mpz_mul (n, n, temp);
+ }
+
+ res = mpz_perfect_power_p (n);
+
+ if (nrprimes == 1)
+ {
+ if (res == 0 && exp[0] > 1)
+ {
+ printf("n is a perfect power, perfpow_p disagrees\n");
+ gmp_printf("n = %Zu\nprimes[0] = %Zu\nexp[0] = %lu\n", n, primes[0], exp[0]);
+ abort ();
+ }
+ else if (res == 1 && exp[0] == 1)
+ {
+ gmp_printf("n = %Zu\n", n);
+ printf("n is now a prime number, but perfpow_p still believes n is a perfect power\n");
+ abort ();
+ }
+ }
+ else
+ {
+ if (res == 1 && destroy != 0)
+ {
+ gmp_printf("n = %Zu\nn was destroyed, but perfpow_p still believes n is a perfect power\n", n);
+ abort ();
+ }
+ else if (res == 0 && destroy == 0)
+ {
+ gmp_printf("n = %Zu\nn is a perfect power, perfpow_p disagrees\n", n);
+ abort ();
+ }
+ }
+ }
+
+ mpz_clear (n);
+ mpz_clear (np);
+ mpz_clear (temp);
+ for (i = 0; i < NRP; i++)
+ mpz_clear (primes[i]);
+}
+
+int
+main (int argc, char **argv)
+{
+ int n_tests;
+
+ tests_start ();
+ mp_trace_base = -16;
+
+ check_tests ();
+
+ n_tests = 500;
+ if (argc == 2)
+ n_tests = atoi (argv[1]);
+ check_random (n_tests);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-perfsqr.c b/vendor/gmp-6.3.0/tests/mpz/t-perfsqr.c
new file mode 100644
index 0000000..2223593
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-perfsqr.c
@@ -0,0 +1,154 @@
+/* Test mpz_perfect_square_p.
+
+Copyright 2000-2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+#include "mpn/perfsqr.h"
+
+
+/* check_modulo() exercises mpz_perfect_square_p on squares which cover each
+ possible quadratic residue to each divisor used within
+ mpn_perfect_square_p, ensuring those residues aren't incorrectly claimed
+ to be non-residues.
+
+ Each divisor is taken separately. It's arranged that n is congruent to 0
+ modulo the other divisors, 0 of course being a quadratic residue to any
+ modulus.
+
+ The values "(j*others)^2" cover all quadratic residues mod divisor[i],
+ but in no particular order. j is run from 1<=j<=divisor[i] so that zero
+ is excluded. A literal n==0 doesn't reach the residue tests. */
+
+void
+check_modulo (void)
+{
+ static const unsigned long divisor[] = PERFSQR_DIVISORS;
+ unsigned long i, j;
+
+ mpz_t alldiv, others, n;
+
+ mpz_init (alldiv);
+ mpz_init (others);
+ mpz_init (n);
+
+ /* product of all divisors */
+ mpz_set_ui (alldiv, 1L);
+ for (i = 0; i < numberof (divisor); i++)
+ mpz_mul_ui (alldiv, alldiv, divisor[i]);
+
+ for (i = 0; i < numberof (divisor); i++)
+ {
+ /* product of all divisors except i */
+ mpz_set_ui (others, 1L);
+ for (j = 0; j < numberof (divisor); j++)
+ if (i != j)
+ mpz_mul_ui (others, others, divisor[j]);
+
+ for (j = 1; j <= divisor[i]; j++)
+ {
+ /* square */
+ mpz_mul_ui (n, others, j);
+ mpz_mul (n, n, n);
+ if (! mpz_perfect_square_p (n))
+ {
+ printf ("mpz_perfect_square_p got 0, want 1\n");
+ mpz_trace (" n", n);
+ abort ();
+ }
+ }
+ }
+
+ mpz_clear (alldiv);
+ mpz_clear (others);
+ mpz_clear (n);
+}
+
+
+/* Exercise mpz_perfect_square_p compared to what mpz_sqrt says. */
+void
+check_sqrt (int reps)
+{
+ mpz_t x2, x2t, x;
+ mp_size_t x2n;
+ int res;
+ int i;
+ /* int cnt = 0; */
+ gmp_randstate_ptr rands = RANDS;
+ mpz_t bs;
+
+ mpz_init (bs);
+
+ mpz_init (x2);
+ mpz_init (x);
+ mpz_init (x2t);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 9);
+ x2n = mpz_get_ui (bs);
+ mpz_rrandomb (x2, rands, x2n);
+ /* mpz_out_str (stdout, -16, x2); puts (""); */
+
+ res = mpz_perfect_square_p (x2);
+ mpz_sqrt (x, x2);
+ mpz_mul (x2t, x, x);
+
+ if (res != (mpz_cmp (x2, x2t) == 0))
+ {
+ printf ("mpz_perfect_square_p and mpz_sqrt differ\n");
+ mpz_trace (" x ", x);
+ mpz_trace (" x2 ", x2);
+ mpz_trace (" x2t", x2t);
+ printf (" mpz_perfect_square_p %d\n", res);
+ printf (" mpz_sqrt %d\n", mpz_cmp (x2, x2t) == 0);
+ abort ();
+ }
+
+ /* cnt += res != 0; */
+ }
+ /* printf ("%d/%d perfect squares\n", cnt, reps); */
+
+ mpz_clear (bs);
+ mpz_clear (x2);
+ mpz_clear (x);
+ mpz_clear (x2t);
+}
+
+
+int
+main (int argc, char **argv)
+{
+ int reps = 200000;
+
+ tests_start ();
+ mp_trace_base = -16;
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ check_modulo ();
+ check_sqrt (reps);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-popcount.c b/vendor/gmp-6.3.0/tests/mpz/t-popcount.c
new file mode 100644
index 0000000..8952cc2
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-popcount.c
@@ -0,0 +1,167 @@
+/* Test mpz_popcount.
+
+Copyright 2001, 2005 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+
+void
+check_onebit (void)
+{
+ mpz_t n;
+ unsigned long i, got;
+
+ mpz_init (n);
+ for (i = 0; i < 5 * GMP_LIMB_BITS; i++)
+ {
+ mpz_setbit (n, i);
+ got = mpz_popcount (n);
+ if (got != 1)
+ {
+ printf ("mpz_popcount wrong on single bit at %lu\n", i);
+ printf (" got %lu, want 1\n", got);
+ abort();
+ }
+ mpz_clrbit (n, i);
+ }
+ mpz_clear (n);
+}
+
+
+void
+check_data (void)
+{
+ static const struct {
+ const char *n;
+ unsigned long want;
+ } data[] = {
+ { "-1", ~ (unsigned long) 0 },
+ { "-12345678", ~ (unsigned long) 0 },
+ { "0", 0 },
+ { "1", 1 },
+ { "3", 2 },
+ { "5", 2 },
+ { "0xFFFF", 16 },
+ { "0xFFFFFFFF", 32 },
+ { "0xFFFFFFFFFFFFFFFF", 64 },
+ { "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", 128 },
+ };
+
+ unsigned long got;
+ int i;
+ mpz_t n;
+
+ mpz_init (n);
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_str_or_abort (n, data[i].n, 0);
+ got = mpz_popcount (n);
+ if (got != data[i].want)
+ {
+ printf ("mpz_popcount wrong at data[%d]\n", i);
+ printf (" n \"%s\"\n", data[i].n);
+ printf (" "); mpz_out_str (stdout, 10, n); printf ("\n");
+ printf (" 0x"); mpz_out_str (stdout, 16, n); printf ("\n");
+ printf (" got %lu\n", got);
+ printf (" want %lu\n", data[i].want);
+ abort ();
+ }
+ }
+ mpz_clear (n);
+}
+
+unsigned long
+refmpz_popcount (mpz_t arg)
+{
+ mp_size_t n, i;
+ unsigned long cnt;
+ mp_limb_t x;
+
+ n = SIZ(arg);
+ if (n < 0)
+ return ~(unsigned long) 0;
+
+ cnt = 0;
+ for (i = 0; i < n; i++)
+ {
+ x = PTR(arg)[i];
+ while (x != 0)
+ {
+ cnt += (x & 1);
+ x >>= 1;
+ }
+ }
+ return cnt;
+}
+
+void
+check_random (void)
+{
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ mpz_t arg;
+ unsigned long arg_size, size_range;
+ unsigned long got, ref;
+ int i;
+
+ rands = RANDS;
+
+ mpz_init (bs);
+ mpz_init (arg);
+
+ for (i = 0; i < 10000; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 11 + 2; /* 0..4096 bit operands */
+
+ mpz_urandomb (bs, rands, size_range);
+ arg_size = mpz_get_ui (bs);
+ mpz_rrandomb (arg, rands, arg_size);
+
+ got = mpz_popcount (arg);
+ ref = refmpz_popcount (arg);
+ if (got != ref)
+ {
+ printf ("mpz_popcount wrong on random\n");
+ printf (" "); mpz_out_str (stdout, 10, arg); printf ("\n");
+ printf (" 0x"); mpz_out_str (stdout, 16, arg); printf ("\n");
+ printf (" got %lu\n", got);
+ printf (" want %lu\n", ref);
+ abort ();
+ }
+ }
+ mpz_clear (arg);
+ mpz_clear (bs);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_onebit ();
+ check_data ();
+ check_random ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-pow.c b/vendor/gmp-6.3.0/tests/mpz/t-pow.c
new file mode 100644
index 0000000..ff41721
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-pow.c
@@ -0,0 +1,217 @@
+/* Test mpz_pow_ui and mpz_ui_pow_ui.
+
+Copyright 1997, 1999-2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_one (mpz_srcptr want, mpz_srcptr base, unsigned long exp)
+{
+ mpz_t got;
+
+ mpz_init (got);
+
+ MPZ_CHECK_FORMAT (want);
+
+ mpz_pow_ui (got, base, exp);
+ if (mpz_cmp (got, want))
+ {
+ printf ("mpz_pow_ui wrong\n");
+ mpz_trace (" base", base);
+ printf (" exp = %lu (0x%lX)\n", exp, exp);
+ mpz_trace (" got ", got);
+ mpz_trace (" want", want);
+ abort ();
+ }
+
+ mpz_set (got, base);
+ mpz_pow_ui (got, got, exp);
+ if (mpz_cmp (got, want))
+ {
+ printf ("mpz_pow_ui wrong\n");
+ mpz_trace (" base", base);
+ printf (" exp = %lu (0x%lX)\n", exp, exp);
+ mpz_trace (" got ", got);
+ mpz_trace (" want", want);
+ abort ();
+ }
+
+ if (mpz_fits_ulong_p (base))
+ {
+ unsigned long base_u = mpz_get_ui (base);
+ mpz_ui_pow_ui (got, base_u, exp);
+ if (mpz_cmp (got, want))
+ {
+ printf ("mpz_ui_pow_ui wrong\n");
+ printf (" base=%lu (0x%lX)\n", base_u, base_u);
+ printf (" exp = %lu (0x%lX)\n", exp, exp);
+ mpz_trace (" got ", got);
+ mpz_trace (" want", want);
+ abort ();
+ }
+ }
+
+ mpz_clear (got);
+}
+
+void
+check_base (mpz_srcptr base)
+{
+ unsigned long exp;
+ mpz_t want;
+
+ mpz_init (want);
+ mpz_set_ui (want, 1L);
+
+ for (exp = 0; exp < 20; exp++)
+ {
+ check_one (want, base, exp);
+ mpz_mul (want, want, base);
+ }
+
+ mpz_clear (want);
+}
+
+void
+check_various (void)
+{
+ static const struct {
+ const char *base;
+ } data[] = {
+ { "0" },
+ { "1" },
+ { "2" },
+ { "3" },
+ { "4" },
+ { "5" },
+ { "6" },
+ { "10" },
+ { "15" },
+ { "16" },
+
+ { "0x1F" },
+ { "0xFF" },
+ { "0x1001" },
+ { "0xFFFF" },
+ { "0x10000001" },
+ { "0x1000000000000001" },
+
+ /* actual size closest to estimate */
+ { "0xFFFFFFFF" },
+ { "0xFFFFFFFFFFFFFFFF" },
+
+ /* same after rshift */
+ { "0xFFFFFFFF0" },
+ { "0xFFFFFFFF00" },
+ { "0xFFFFFFFFFFFFFFFF0" },
+ { "0xFFFFFFFFFFFFFFFF00" },
+
+ /* change from 2 limbs to 1 after rshift */
+ { "0x180000000" },
+ { "0x18000000000000000" },
+
+ /* change from 3 limbs to 2 after rshift */
+ { "0x18000000100000000" },
+ { "0x180000000000000010000000000000000" },
+
+ /* handling of absolute value */
+ { "-0x80000000" },
+ { "-0x8000000000000000" },
+
+ /* low zero limb, and size>2, checking argument overlap detection */
+ { "0x3000000000000000300000000000000030000000000000000" },
+ };
+
+ mpz_t base;
+ int i;
+
+ mpz_init (base);
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_set_str_or_abort (base, data[i].base, 0);
+ check_base (base);
+ }
+
+ mpz_clear (base);
+}
+
+void
+check_random (int reps)
+{
+ mpz_t base, want;
+ mp_size_t base_size;
+ int i;
+ unsigned long size_range, exp;
+ gmp_randstate_ptr rands = RANDS;
+
+ mpz_init (base);
+ mpz_init (want);
+
+ for (i = 0; i < reps; i++)
+ {
+ /* exponentially random 0 to 2^13 bits for base */
+ mpz_urandomb (want, rands, 32);
+ size_range = mpz_get_ui (want) % 12 + 2;
+ mpz_urandomb (want, rands, size_range);
+ base_size = mpz_get_ui (want);
+ mpz_rrandomb (base, rands, base_size);
+
+ /* randomly signed base */
+ mpz_urandomb (want, rands, 2);
+ if ((mpz_get_ui (want) & 1) != 0)
+ mpz_neg (base, base);
+
+ /* random 5 bits for exponent */
+ mpz_urandomb (want, rands, 5L);
+ exp = mpz_get_ui (want);
+
+ refmpz_pow_ui (want, base, exp);
+ check_one (want, base, exp);
+ }
+
+ mpz_clear (base);
+ mpz_clear (want);
+}
+
+int
+main (int argc, char **argv)
+{
+ int reps = 5000;
+
+ /* dummy call to drag in refmpn.o for testing mpz/n_pow_ui.c with
+ refmpn_mul_2 */
+ refmpn_zero_p (NULL, (mp_size_t) 0);
+
+ tests_start ();
+ mp_trace_base = -16;
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ check_various ();
+ check_random (reps);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-powm.c b/vendor/gmp-6.3.0/tests/mpz/t-powm.c
new file mode 100644
index 0000000..1a25ed7
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-powm.c
@@ -0,0 +1,263 @@
+/* Test mpz_powm, mpz_mul, mpz_mod, mpz_mod_ui, mpz_div_ui.
+
+Copyright 1991, 1993, 1994, 1996, 1999-2001, 2009, 2012, 2019 Free
+Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+void debug_mp (mpz_t, int);
+
+#define SIZEM 13
+
+/* Check that all sizes up to just above MUL_TOOM22_THRESHOLD have been tested
+ a few times. FIXME: If SIZEM is set too low, this will never happen. */
+int
+allsizes_seen (unsigned int *allsizes)
+{
+ mp_size_t i;
+
+ for (i = 1; i < MUL_TOOM22_THRESHOLD + 4; i++)
+ if (allsizes[i] < 4)
+ return 0;
+ return 1;
+}
+
+void
+small_2pow (unsigned long reps)
+{
+ mpz_t du, exp, mod;
+ mpz_t r1;
+ unsigned long m, e, r;
+ mp_limb_t b0 = 2;
+
+ mpz_roinit_n (du, &b0, 1);
+ mpz_init (exp);
+ mpz_init (mod);
+ mpz_init (r1);
+
+ for (m = 3; m * m < reps; m += 2)
+ {
+ mpz_set_ui (mod, m);
+ r = 1;
+ for (e = 0; e < m; e += 1)
+ {
+ mpz_set_ui (exp, e);
+ mpz_powm (r1, du, exp, mod);
+ MPZ_CHECK_FORMAT (r1);
+ if (mpz_cmp_ui (r1, r) != 0)
+ {
+ fprintf (stderr, "\nIncorrect result for operands:\n");
+ debug_mp (du, -16);
+ debug_mp (exp, -16);
+ debug_mp (mod, -16);
+ fprintf (stderr, "mpz_powm result:\n");
+ debug_mp (r1, -16);
+ fprintf (stderr, "Should be 2 ^ 0x%lx = 0x%lx (mod 0x%lx)\n", e, r, m);
+ abort ();
+ }
+ if (r > (m >> 1))
+ r = (r << 1) - m;
+ else
+ r = r << 1;
+ }
+ }
+
+ mpz_clear (exp);
+ mpz_clear (mod);
+ mpz_clear (r1);
+}
+
+int
+main (int argc, char **argv)
+{
+ mpz_t base, exp, mod;
+ mpz_t r1, r2, t1, exp2, base2;
+ mp_size_t base_size, exp_size, mod_size;
+ int i;
+ int reps = 1000;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+ unsigned int allsizes[1 << (SIZEM + 2 - 1)];
+
+ tests_start ();
+ TESTS_REPS (reps, argv, argc);
+
+ small_2pow ((unsigned int) reps);
+ rands = RANDS;
+
+ mpz_init (bs);
+
+ mpz_init (base);
+ mpz_init (exp);
+ mpz_init (mod);
+ mpz_init (r1);
+ mpz_init (r2);
+ mpz_init (t1);
+ mpz_init (exp2);
+ mpz_init (base2);
+
+ memset (allsizes, 0, (1 << (SIZEM + 2 - 1)) * sizeof (int));
+
+ reps += reps >> 3;
+ for (i = 0; i < reps || ! allsizes_seen (allsizes); i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % SIZEM + 2;
+
+ if ((i & 7) == 0)
+ {
+ mpz_set_ui (exp, 1);
+
+ do /* Loop until mathematically well-defined. */
+ {
+ mpz_urandomb (bs, rands, size_range / 2 + 2);
+ base_size = mpz_get_ui (bs);
+ mpz_rrandomb (base, rands, base_size);
+ }
+ while (mpz_cmp_ui (base, 0) == 0);
+
+ mpz_urandomb (bs, rands, size_range / 2);
+ mod_size = mpz_get_ui (bs);
+ mod_size = MIN (mod_size, base_size);
+ mpz_rrandomb (mod, rands, mod_size);
+
+ mpz_urandomb (bs, rands, size_range);
+ mod_size = mpz_get_ui (bs) + base_size + 2;
+ if ((i & 8) == 0)
+ mod_size += GMP_NUMB_BITS - mod_size % GMP_NUMB_BITS;
+ mpz_setbit (mod, mod_size);
+
+ mpz_sub (base, base, mod);
+ }
+ else
+ {
+ do /* Loop until mathematically well-defined. */
+ {
+ if ((i & 7) == 4)
+ mpz_set_ui (base, 2);
+ else
+ {
+ mpz_urandomb (bs, rands, size_range);
+ base_size = mpz_get_ui (bs);
+ mpz_rrandomb (base, rands, base_size);
+ }
+
+ mpz_urandomb (bs, rands, 7L);
+ exp_size = mpz_get_ui (bs);
+ mpz_rrandomb (exp, rands, exp_size);
+ }
+ while (mpz_cmp_ui (base, 0) == 0 && mpz_cmp_ui (exp, 0) == 0);
+
+ do
+ {
+ mpz_urandomb (bs, rands, size_range);
+ mod_size = mpz_get_ui (bs);
+ mpz_rrandomb (mod, rands, mod_size);
+ }
+ while (mpz_cmp_ui (mod, 0) == 0);
+
+ allsizes[SIZ(mod)] += 1;
+
+ mpz_urandomb (bs, rands, 2);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 1) != 0)
+ mpz_neg (base, base);
+
+ /* printf ("%ld %ld %ld\n", SIZ (base), SIZ (exp), SIZ (mod)); */
+ }
+
+ mpz_set_ui (r2, 1);
+ mpz_mod (base2, base, mod);
+ mpz_set (exp2, exp);
+ mpz_mod (r2, r2, mod);
+
+ for (;;)
+ {
+ if (mpz_tstbit (exp2, 0))
+ {
+ mpz_mul (r2, r2, base2);
+ mpz_mod (r2, r2, mod);
+ }
+ if (mpz_cmp_ui (exp2, 1) <= 0)
+ break;
+ mpz_mul (base2, base2, base2);
+ mpz_mod (base2, base2, mod);
+ mpz_tdiv_q_2exp (exp2, exp2, 1);
+ }
+
+ mpz_powm (r1, base, exp, mod);
+ MPZ_CHECK_FORMAT (r1);
+
+ if (mpz_cmp (r1, r2) != 0)
+ {
+ fprintf (stderr, "\nIncorrect results in test %d for operands:\n", i);
+ debug_mp (base, -16);
+ debug_mp (exp, -16);
+ debug_mp (mod, -16);
+ fprintf (stderr, "mpz_powm result:\n");
+ debug_mp (r1, -16);
+ fprintf (stderr, "reference result:\n");
+ debug_mp (r2, -16);
+ abort ();
+ }
+
+ if (mpz_tdiv_ui (mod, 2) == 0)
+ continue;
+
+ mpz_powm_sec (r1, base, exp, mod);
+ MPZ_CHECK_FORMAT (r1);
+
+ if (mpz_cmp (r1, r2) != 0)
+ {
+ fprintf (stderr, "\nIncorrect results in test %d for operands:\n", i);
+ debug_mp (base, -16);
+ debug_mp (exp, -16);
+ debug_mp (mod, -16);
+ fprintf (stderr, "mpz_powm_sec result:\n");
+ debug_mp (r1, -16);
+ fprintf (stderr, "reference result:\n");
+ debug_mp (r2, -16);
+ abort ();
+ }
+ }
+
+ mpz_clear (bs);
+ mpz_clear (base);
+ mpz_clear (exp);
+ mpz_clear (mod);
+ mpz_clear (r1);
+ mpz_clear (r2);
+ mpz_clear (t1);
+ mpz_clear (exp2);
+ mpz_clear (base2);
+
+ tests_end ();
+ exit (0);
+}
+
+void
+debug_mp (mpz_t x, int base)
+{
+ mpz_out_str (stderr, base, x); fputc ('\n', stderr);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-powm_ui.c b/vendor/gmp-6.3.0/tests/mpz/t-powm_ui.c
new file mode 100644
index 0000000..5b446c5
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-powm_ui.c
@@ -0,0 +1,127 @@
+/* Test mpz_powm_ui, mpz_mul, mpz_mod.
+
+Copyright 1991, 1993, 1994, 1996, 1997, 2000-2002, 2013 Free Software
+Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+int
+main (int argc, char **argv)
+{
+ mpz_t base, exp, mod;
+ mpz_t r1, r2, base2;
+ mp_size_t base_size, exp_size, mod_size;
+ unsigned long int exp2;
+ int i;
+ int reps = 100;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+
+ tests_start ();
+ rands = RANDS;
+
+ TESTS_REPS (reps, argv, argc);
+
+ mpz_inits (bs, base, exp, mod, r1, r2, base2, NULL);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 18 + 2;
+
+ do /* Loop until mathematically well-defined. */
+ {
+ mpz_urandomb (bs, rands, size_range);
+ base_size = mpz_get_ui (bs);
+ mpz_rrandomb (base, rands, base_size);
+
+ mpz_urandomb (bs, rands, 6L);
+ exp_size = mpz_get_ui (bs);
+ mpz_rrandomb (exp, rands, exp_size);
+ exp2 = mpz_getlimbn (exp, (mp_size_t) 0);
+ }
+ while (mpz_cmp_ui (base, 0) == 0 && exp2 == 0);
+
+ do
+ {
+ mpz_urandomb (bs, rands, size_range);
+ mod_size = mpz_get_ui (bs);
+ mpz_rrandomb (mod, rands, mod_size);
+ }
+ while (mpz_cmp_ui (mod, 0) == 0);
+
+ mpz_urandomb (bs, rands, 2);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 1) != 0)
+ mpz_neg (base, base);
+
+ /* printf ("%ld %ld\n", SIZ (base), SIZ (mod)); */
+
+#if 0
+ putc ('\n', stderr);
+ gmp_fprintf (stderr, "B = 0x%Zx\n", base);
+ gmp_fprintf (stderr, "M = 0x%Zx\n", mod);
+#endif
+
+ exp2 = mpz_getlimbn (exp, (mp_size_t) 0);
+ mpz_set_ui (r2, 1);
+ mpz_set (base2, base);
+ mpz_mod (r2, r2, mod); /* needed when exp==0 and mod==1 */
+ while (exp2 != 0)
+ {
+ if (exp2 % 2 != 0)
+ {
+ mpz_mul (r2, r2, base2);
+ mpz_mod (r2, r2, mod);
+ }
+ mpz_mul (base2, base2, base2);
+ mpz_mod (base2, base2, mod);
+ exp2 = exp2 / 2;
+ }
+
+ exp2 = mpz_getlimbn (exp, (mp_size_t) 0);
+ mpz_powm_ui (r1, base, exp2, mod);
+ MPZ_CHECK_FORMAT (r1);
+
+#if 0
+ gmp_fprintf (stderr, "R = 0x%Zx\n", r1);
+ gmp_fprintf (stderr, "REF = 0x%Zx\n", r2);
+#endif
+
+ if (mpz_cmp (r1, r2) != 0)
+ {
+ fprintf (stderr, "\ntest %d: Incorrect results for operands:\n", i);
+ gmp_fprintf (stderr, "B = 0x%Zx\n", base);
+ gmp_fprintf (stderr, "E = 0x%Zx\n", exp);
+ gmp_fprintf (stderr, "M = 0x%Zx\n", mod);
+ gmp_fprintf (stderr, "R = 0x%Zx\n", r1);
+ gmp_fprintf (stderr, "REF = 0x%Zx\n", r2);
+ abort ();
+ }
+ }
+
+ mpz_clears (bs, base, exp, mod, r1, r2, base2, NULL);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-pprime_p.c b/vendor/gmp-6.3.0/tests/mpz/t-pprime_p.c
new file mode 100644
index 0000000..dffe6ea
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-pprime_p.c
@@ -0,0 +1,243 @@
+/* Exercise mpz_probab_prime_p.
+
+Copyright 2002, 2018-2019, 2022 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+/* Enhancements:
+
+ - Test some big primes don't come back claimed to be composite.
+ - Test some big composites don't come back claimed to be certainly prime.
+ - Test some big composites with small factors are identified as certainly
+ composite. */
+
+
+/* return 2 if prime, 0 if composite */
+int
+isprime (unsigned long n)
+{
+ if (n < 4)
+ return (n & 2);
+ if ((n & 1) == 0)
+ return 0;
+
+ for (unsigned long i = 3; i*i <= n; i+=2)
+ if ((n % i) == 0)
+ return 0;
+
+ return 2;
+}
+
+void
+check_one (mpz_srcptr n, int want)
+{
+ int got;
+
+ got = mpz_probab_prime_p (n, 25);
+
+ /* "definitely prime" (2) is fine if we only wanted "probably prime" (1) */
+ if ((got != want) && (got != want * 2))
+ {
+ printf ("mpz_probab_prime_p\n");
+ mpz_trace (" n ", n);
+ printf (" got =%d", got);
+ printf (" want=%d", want);
+ abort ();
+ }
+}
+
+void
+check_pn (mpz_ptr n, int want)
+{
+ check_one (n, want);
+ mpz_neg (n, n);
+ check_one (n, want);
+}
+
+/* expect certainty for small n */
+void
+check_small (void)
+{
+ mpz_t n;
+ long i;
+
+ mpz_init (n);
+
+ for (i = 0; i < 300; i++)
+ {
+ mpz_set_si (n, i);
+ check_pn (n, isprime (i));
+ }
+
+ mpz_clear (n);
+}
+
+void
+check_composites (int count)
+{
+ int i;
+ mpz_t a, b, n, bs;
+ unsigned long size_range, size;
+ gmp_randstate_ptr rands = RANDS;
+
+ mpz_init (a);
+ mpz_init (b);
+ mpz_init (n);
+ mpz_init (bs);
+
+ static const char * const composites[] = {
+ "225670644213750121", /* n=61*C16, if D < 61, (n/D) = 1. */
+ "2386342059899637841", /* n=61*C17, if D < 61, (n/D) = 1. */
+ "1194649", /* A square, but strong base-2 pseudoprime, */
+ "12327121", /* another base-2 pseudoprime square. */
+ "18446744066047760377", /* Should trigger Fibonacci's test; */
+ "10323769", /* &3==1, Lucas' test with D=37; */
+ "1397419", /* &3==3, Lucas' test with D=43; */
+ "11708069165918597341", /* &3==1, Lucas' test with large D=107; */
+ "395009109077493751", /* &3==3, Lucas' test with large D=113. */
+ NULL
+ };
+
+ for (i = 0; composites[i]; i++)
+ {
+ mpz_set_str_or_abort (n, composites[i], 0);
+ check_one (n, 0);
+ }
+
+ for (i = 0; i < count; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 13 + 1; /* 0..8192 bit operands */
+
+ mpz_urandomb (bs, rands, size_range);
+ size = mpz_get_ui (bs);
+ mpz_rrandomb (a, rands, size);
+
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 13 + 1; /* 0..8192 bit operands */
+ mpz_rrandomb (b, rands, size);
+
+ /* Exclude trivial factors */
+ if (mpz_cmp_ui (a, 1) == 0)
+ mpz_set_ui (a, 2);
+ if (mpz_cmp_ui (b, 1) == 0)
+ mpz_set_ui (b, 2);
+
+ mpz_mul (n, a, b);
+
+ check_pn (n, 0);
+ }
+ mpz_clear (a);
+ mpz_clear (b);
+ mpz_clear (n);
+ mpz_clear (bs);
+}
+
+static void
+check_primes (void)
+{
+ static const char * const primes[] = {
+ "2", "53", "1234567891",
+ "2055693949", "1125899906842597", "16412292043871650369",
+ "18446744075358702679", /* Lucas' test with large D=107. */
+ /* diffie-hellman-group1-sha1, also "Well known group 2" in RFC
+ 2412, 2^1024 - 2^960 - 1 + 2^64 * { [2^894 pi] + 129093 } */
+ "0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1"
+ "29024E088A67CC74020BBEA63B139B22514A08798E3404DD"
+ "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245"
+ "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED"
+ "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381"
+ "FFFFFFFFFFFFFFFF",
+ NULL
+ };
+
+ mpz_t n;
+ int i;
+
+ mpz_init (n);
+
+ for (i = 0; primes[i]; i++)
+ {
+ mpz_set_str_or_abort (n, primes[i], 0);
+ check_one (n, 1);
+ }
+ mpz_clear (n);
+}
+
+static void
+check_fermat_mersenne (int count)
+{
+ int fermat_exponents [] = {1, 2, 4, 8, 16};
+ int mersenne_exponents [] = {2, 3, 5, 7, 13, 17, 19, 31, 61, 89,
+ 107, 127, 521, 607, 1279, 2203, 2281,
+ 3217, 4253, 4423, 9689, 9941, 11213,
+ 19937, 21701, 23209, 44497, 86243};
+ mpz_t pp;
+ int i, j, want;
+
+ mpz_init (pp);
+ count = MIN (110000, count);
+
+ for (i=1; i<count; ++i)
+ {
+ mpz_set_ui (pp, 1);
+ mpz_setbit (pp, i); /* 2^i + 1 */
+ want = 0;
+ for (j = 0; j < numberof (fermat_exponents); j++)
+ if (fermat_exponents[j] == i)
+ {
+ /* Fermat's primes are small enough for a definite answer. */
+ want = 2;
+ break;
+ }
+ check_one (pp, want);
+
+ mpz_sub_ui (pp, pp, 2); /* 2^i - 1 */
+ want = 0;
+ for (j = 0; j < numberof (mersenne_exponents); j++)
+ if (mersenne_exponents[j] == i)
+ {
+ want = 1 << (i < 50);
+ break;
+ }
+ check_one (pp, want);
+ }
+ mpz_clear (pp);
+}
+
+int
+main (int argc, char **argv)
+{
+ int count = 1000;
+
+ TESTS_REPS (count, argv, argc);
+
+ tests_start ();
+
+ check_small ();
+ check_fermat_mersenne (count >> 3);
+ check_composites (count);
+ check_primes ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-primorial_ui.c b/vendor/gmp-6.3.0/tests/mpz/t-primorial_ui.c
new file mode 100644
index 0000000..b4d2bfe
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-primorial_ui.c
@@ -0,0 +1,145 @@
+/* Exercise mpz_primorial_ui.
+
+Copyright 2000-2002, 2012, 2015 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+/* Usage: t-primorial_ui [x|num]
+
+ With no arguments testing goes up to the initial value of "limit" below.
+ With a number argument tests are carried that far, or with a literal "x"
+ tests are continued without limit (this being meant only for development
+ purposes). */
+
+static int isprime (unsigned long int t);
+
+int
+main (int argc, char *argv[])
+{
+ unsigned long n;
+ unsigned long limit = 2222;
+ gmp_randstate_ptr rands;
+ mpz_t f, r, bs;
+
+ tests_start ();
+ rands = RANDS;
+
+ if (argc > 1 && argv[1][0] == 'x')
+ limit = ULONG_MAX;
+ else
+ TESTS_REPS (limit, argv, argc);
+
+ /* for small limb testing */
+ limit = MIN (limit, MP_LIMB_T_MAX);
+
+ mpz_init_set_ui (f, 1); /* 0# = 1 */
+ mpz_init (r);
+
+ n = 0;
+ do
+ {
+ mpz_primorial_ui (r, n);
+ MPZ_CHECK_FORMAT (r);
+
+ if (mpz_cmp (f, r) != 0)
+ {
+ printf ("mpz_primorial_ui(%lu) wrong\n", n);
+ printf (" got "); mpz_out_str (stdout, 10, r); printf("\n");
+ printf (" want "); mpz_out_str (stdout, 10, f); printf("\n");
+ abort ();
+ }
+
+ if (isprime (++n))
+ mpz_mul_ui (f, f, n); /* p# = (p-1)# * (p) */
+ if (n%16 == 0) { mpz_clear (r); mpz_init (r); }
+ } while (n < limit);
+
+ n = 0; limit =1;
+ mpz_init (bs);
+ do
+ {
+ unsigned long i, d;
+
+ mpz_urandomb (bs, rands, 21);
+ i = mpz_get_ui (bs);
+ mpz_urandomb (bs, rands, 9);
+ d = mpz_get_ui (bs) + 3*64;
+ mpz_primorial_ui (f, i);
+ MPZ_CHECK_FORMAT (f);
+ mpz_primorial_ui (r, i+d);
+ MPZ_CHECK_FORMAT (r);
+
+ do {
+ if (isprime (++i))
+ mpz_mul_ui (f, f, i);
+ } while (--d != 0);
+
+ if (mpz_cmp (f, r) != 0)
+ {
+ printf ("mpz_primorial_ui(%lu) wrong\n", i);
+ printf (" got "); mpz_out_str (stdout, 10, r); printf("\n");
+ printf (" want "); mpz_out_str (stdout, 10, f); printf("\n");
+ abort ();
+ }
+ } while (++n < limit);
+ /* Chech a single "big" value, modulo a larger prime */
+ n = 2095637;
+ mpz_primorial_ui (r, n);
+ mpz_set_ui (f, 13);
+ mpz_setbit (f, 64); /* f = 2^64 + 13 */
+ mpz_tdiv_r (r, r, f);
+ mpz_set_str (f, "BAFCBF3C95B217D5", 16);
+
+ if (mpz_cmp (f, r) != 0)
+ {
+ printf ("mpz_primorial_ui(%lu) wrong\n", n);
+ printf (" got "); mpz_out_str (stdout, 10, r); printf("\n");
+ printf (" want "); mpz_out_str (stdout, 10, f); printf("\n");
+ abort ();
+ }
+
+ mpz_clear (bs);
+ mpz_clear (f);
+ mpz_clear (r);
+
+ tests_end ();
+
+ exit (0);
+}
+
+static int
+isprime (unsigned long int t)
+{
+ unsigned long int q, r, d;
+
+ if (t < 3 || (t & 1) == 0)
+ return t == 2;
+
+ for (d = 3, r = 1; r != 0; d += 2)
+ {
+ q = t / d;
+ r = t - q * d;
+ if (q < d)
+ return 1;
+ }
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-remove.c b/vendor/gmp-6.3.0/tests/mpz/t-remove.c
new file mode 100644
index 0000000..07ba918
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-remove.c
@@ -0,0 +1,146 @@
+/* Test mpz_remove.
+
+Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2009, 2012, 2013 Free
+Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+void debug_mp (mpz_t);
+unsigned long int mpz_refremove (mpz_t, const mpz_t, const mpz_t);
+
+int
+main (int argc, char **argv)
+{
+ unsigned long int exp;
+ mpz_t t, dest, refdest, dividend, divisor;
+ mp_size_t dividend_size, divisor_size;
+ int i;
+ int reps = 1000;
+ unsigned long int pwr, refpwr;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long size_range;
+
+ tests_start ();
+ rands = RANDS;
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpz_inits (bs, t, dest, refdest, dividend, divisor, NULL);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 18 + 1; /* 1..524288 bit operands */
+
+ do
+ {
+ mpz_urandomb (bs, rands, size_range);
+ divisor_size = mpz_get_ui (bs);
+ mpz_rrandomb (divisor, rands, divisor_size);
+ }
+ while (mpz_sgn (divisor) == 0);
+
+ mpz_urandomb (bs, rands, size_range);
+ dividend_size = mpz_get_ui (bs) + divisor_size;
+ mpz_rrandomb (dividend, rands, dividend_size);
+
+ mpz_urandomb (bs, rands, 32);
+ exp = mpz_get_ui (bs) % (5 + 10000 / mpz_sizeinbase (divisor, 2));
+ if (mpz_get_ui (bs) & 2)
+ mpz_neg (divisor, divisor);
+ mpz_pow_ui (t, divisor, exp);
+ mpz_mul (dividend, dividend, t);
+
+ refpwr = mpz_refremove (refdest, dividend, divisor);
+ pwr = mpz_remove (dest, dividend, divisor);
+
+ if (refpwr != pwr || mpz_cmp (refdest, dest) != 0)
+ {
+ fprintf (stderr, "ERROR after %d tests\n", i);
+ fprintf (stderr, "refpower = %lu\n", refpwr);
+ fprintf (stderr, " power = %lu\n", pwr);
+ fprintf (stderr, " op1 = "); debug_mp (dividend);
+ fprintf (stderr, " op2 = "); debug_mp (divisor);
+ fprintf (stderr, "refdest = "); debug_mp (refdest);
+ fprintf (stderr, " dest = "); debug_mp (dest);
+ abort ();
+ }
+ }
+
+ mpz_clears (bs, t, dest, refdest, dividend, divisor, NULL);
+
+ tests_end ();
+ exit (0);
+}
+
+unsigned long int
+mpz_refremove (mpz_t dest, const mpz_t src, const mpz_t f)
+{
+ unsigned long int pwr;
+
+ pwr = 0;
+
+ mpz_set (dest, src);
+ if (mpz_cmpabs_ui (f, 1) > 0)
+ {
+ mpz_t rem, x;
+
+ mpz_init (x);
+ mpz_init (rem);
+
+ for (;; pwr++)
+ {
+ mpz_tdiv_qr (x, rem, dest, f);
+ if (mpz_cmp_ui (rem, 0) != 0)
+ break;
+ mpz_swap (dest, x);
+ }
+
+ mpz_clear (x);
+ mpz_clear (rem);
+ }
+
+ return pwr;
+}
+
+void
+debug_mp (mpz_t x)
+{
+ size_t siz = mpz_sizeinbase (x, 16);
+
+ if (siz > 65)
+ {
+ mpz_t q;
+ mpz_init (q);
+ mpz_tdiv_q_2exp (q, x, 4 * (mpz_sizeinbase (x, 16) - 25));
+ gmp_fprintf (stderr, "%ZX...", q);
+ mpz_tdiv_r_2exp (q, x, 4 * 25);
+ gmp_fprintf (stderr, "%025ZX [%d]\n", q, (int) siz);
+ mpz_clear (q);
+ }
+ else
+ {
+ gmp_fprintf (stderr, "%ZX\n", x);
+ }
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-root.c b/vendor/gmp-6.3.0/tests/mpz/t-root.c
new file mode 100644
index 0000000..e1ce159
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-root.c
@@ -0,0 +1,174 @@
+/* Test mpz_root, mpz_rootrem, and mpz_perfect_power_p.
+
+Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2009, 2015 Free Software
+Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+void debug_mp (mpz_t, int);
+
+void
+check_one (mpz_t root1, mpz_t x2, unsigned long nth, int res, int i)
+{
+ mpz_t temp, temp2;
+ mpz_t root2, rem2;
+
+ mpz_init (root2);
+ mpz_init (rem2);
+ mpz_init (temp);
+ mpz_init (temp2);
+
+ MPZ_CHECK_FORMAT (root1);
+
+ mpz_rootrem (root2, rem2, x2, nth);
+ MPZ_CHECK_FORMAT (root2);
+ MPZ_CHECK_FORMAT (rem2);
+
+ mpz_pow_ui (temp, root1, nth);
+ MPZ_CHECK_FORMAT (temp);
+
+ mpz_add (temp2, temp, rem2);
+
+ /* Is power of result > argument? */
+ if (mpz_cmp (root1, root2) != 0 || mpz_cmp (x2, temp2) != 0 || mpz_cmpabs (temp, x2) > 0 || res == mpz_cmp_ui (rem2, 0))
+ {
+ fprintf (stderr, "ERROR after test %d\n", i);
+ debug_mp (x2, 10);
+ debug_mp (root1, 10);
+ debug_mp (root2, 10);
+ fprintf (stderr, "nth: %lu ,res: %i\n", nth, res);
+ abort ();
+ }
+
+ if (nth > 1 && mpz_cmp_ui (temp, 1L) > 0 && ! mpz_perfect_power_p (temp))
+ {
+ fprintf (stderr, "ERROR in mpz_perfect_power_p after test %d\n", i);
+ debug_mp (temp, 10);
+ debug_mp (root1, 10);
+ fprintf (stderr, "nth: %lu\n", nth);
+ abort ();
+ }
+
+ if (nth <= 10000 && mpz_sgn(x2) > 0) /* skip too expensive test */
+ {
+ mpz_add_ui (temp2, root1, 1L);
+ mpz_pow_ui (temp2, temp2, nth);
+ MPZ_CHECK_FORMAT (temp2);
+
+ /* Is square of (result + 1) <= argument? */
+ if (mpz_cmp (temp2, x2) <= 0)
+ {
+ fprintf (stderr, "ERROR after test %d\n", i);
+ debug_mp (x2, 10);
+ debug_mp (root1, 10);
+ fprintf (stderr, "nth: %lu\n", nth);
+ abort ();
+ }
+ }
+
+ mpz_clear (root2);
+ mpz_clear (rem2);
+ mpz_clear (temp);
+ mpz_clear (temp2);
+}
+
+int
+main (int argc, char **argv)
+{
+ mpz_t x2;
+ mpz_t root1;
+ mp_size_t x2_size;
+ int i, res;
+ int reps = 500;
+ unsigned long nth;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+
+ tests_start ();
+ TESTS_REPS (reps, argv, argc);
+
+ rands = RANDS;
+
+ mpz_init (bs);
+
+ mpz_init (x2);
+ mpz_init (root1);
+
+ /* This triggers a gcc 4.3.2 bug */
+ mpz_set_str (x2, "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80000000000000000000000000000000000000000000000000000000000000002", 16);
+ res = mpz_root (root1, x2, 2);
+ check_one (root1, x2, 2, res, -1);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 17 + 2;
+
+ mpz_urandomb (bs, rands, size_range);
+ x2_size = mpz_get_ui (bs) + 10;
+ mpz_rrandomb (x2, rands, x2_size);
+
+ mpz_urandomb (bs, rands, 15);
+ nth = mpz_getlimbn (bs, 0) % mpz_sizeinbase (x2, 2) + 2;
+
+ res = mpz_root (root1, x2, nth);
+
+ mpz_urandomb (bs, rands, 4);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 1) != 0)
+ {
+ /* With 50% probability, set x2 near a perfect power. */
+ mpz_pow_ui (x2, root1, nth);
+ if ((bsi & 2) != 0)
+ {
+ mpz_sub_ui (x2, x2, bsi >> 2);
+ mpz_abs (x2, x2);
+ }
+ else
+ mpz_add_ui (x2, x2, bsi >> 2);
+ res = mpz_root (root1, x2, nth);
+ }
+
+ check_one (root1, x2, nth, res, i);
+
+ if (((nth & 1) != 0) && ((bsi & 2) != 0))
+ {
+ mpz_neg (x2, x2);
+ mpz_neg (root1, root1);
+ check_one (root1, x2, nth, res, i);
+ }
+ }
+
+ mpz_clear (bs);
+ mpz_clear (x2);
+ mpz_clear (root1);
+
+ tests_end ();
+ exit (0);
+}
+
+void
+debug_mp (mpz_t x, int base)
+{
+ mpz_out_str (stderr, base, x); fputc ('\n', stderr);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-scan.c b/vendor/gmp-6.3.0/tests/mpz/t-scan.c
new file mode 100644
index 0000000..ababcfa
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-scan.c
@@ -0,0 +1,131 @@
+/* Tests of mpz_scan0 and mpz_scan1.
+
+Copyright 2000-2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+unsigned long
+refmpz_scan (mpz_srcptr z, unsigned long i, int sought)
+{
+ unsigned long z_bits = (unsigned long) ABSIZ(z) * GMP_NUMB_BITS;
+
+ do
+ {
+ if (mpz_tstbit (z, i) == sought)
+ return i;
+ i++;
+ }
+ while (i <= z_bits);
+
+ return ULONG_MAX;
+}
+
+unsigned long
+refmpz_scan0 (mpz_srcptr z, unsigned long starting_bit)
+{
+ return refmpz_scan (z, starting_bit, 0);
+}
+
+unsigned long
+refmpz_scan1 (mpz_srcptr z, unsigned long starting_bit)
+{
+ return refmpz_scan (z, starting_bit, 1);
+}
+
+
+void
+check_ref (void)
+{
+ static const int offset[] = {
+ -2, -1, 0, 1, 2, 3
+ };
+
+ mpz_t z;
+ int test, neg, sought, oindex, o;
+ mp_size_t size, isize;
+ unsigned long start, got, want;
+
+ mpz_init (z);
+ for (test = 0; test < 5; test++)
+ {
+ for (size = 0; size < 5; size++)
+ {
+ mpz_random2 (z, size);
+
+ for (neg = 0; neg <= 1; neg++)
+ {
+ if (neg)
+ mpz_neg (z, z);
+
+ for (isize = 0; isize <= size; isize++)
+ {
+ for (oindex = 0; oindex < numberof (offset); oindex++)
+ {
+ o = offset[oindex];
+ if ((int) isize*GMP_NUMB_BITS < -o)
+ continue; /* start would be negative */
+
+ start = isize*GMP_NUMB_BITS + o;
+
+ for (sought = 0; sought <= 1; sought++)
+ {
+ if (sought == 0)
+ {
+ got = mpz_scan0 (z, start);
+ want = refmpz_scan0 (z, start);
+ }
+ else
+ {
+ got = mpz_scan1 (z, start);
+ want = refmpz_scan1 (z, start);
+ }
+
+ if (got != want)
+ {
+ printf ("wrong at test=%d, size=%ld, neg=%d, start=%lu, sought=%d\n",
+ test, size, neg, start, sought);
+ printf (" z 0x");
+ mpz_out_str (stdout, -16, z);
+ printf ("\n");
+ printf (" got=%lu, want=%lu\n", got, want);
+ exit (1);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ mpz_clear (z);
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+
+ check_ref ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-set_d.c b/vendor/gmp-6.3.0/tests/mpz/t-set_d.c
new file mode 100644
index 0000000..1fdfc02
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-set_d.c
@@ -0,0 +1,139 @@
+/* Test mpz_set_d and mpz_init_set_d.
+
+Copyright 2000-2003, 2006 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_data (void)
+{
+ static const struct {
+ double d;
+ mp_size_t want_size;
+ mp_limb_t want_data[2];
+ } data[] = {
+
+ { 0.0, 0 },
+ { 1.0, 1, { 1 } },
+ { -1.0, -1, { 1 } },
+
+ { 123.0, 1, { 123 } },
+ { -123.0, -1, { 123 } },
+
+ { 1e-1, 0, { 0 } },
+ { -1e-1, 0, { 0 } },
+ { 2.328306436538696e-10, 0, { 0 } },
+ { -2.328306436538696e-10, 0, { 0 } },
+ { 5.421010862427522e-20, 0, { 0 } },
+ { -5.421010862427522e-20, 0, { 0 } },
+ { 2.938735877055719e-39, 0, { 0 } },
+ { -2.938735877055719e-39, 0, { 0 } },
+ };
+
+ mpz_t z;
+ int i;
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_init (z);
+ mpz_set_d (z, data[i].d);
+ MPZ_CHECK_FORMAT (z);
+ if (z->_mp_size != data[i].want_size
+ || refmpn_cmp_allowzero (z->_mp_d, data[i].want_data,
+ ABS (data[i].want_size)) != 0)
+ {
+ printf ("mpz_set_d wrong on data[%d]\n", i);
+ bad:
+ d_trace (" d ", data[i].d);
+ printf (" got size %ld\n", (long) z->_mp_size);
+ printf (" want size %ld\n", (long) data[i].want_size);
+ mpn_trace (" got z", z->_mp_d, z->_mp_size);
+ mpn_trace (" want z", data[i].want_data, data[i].want_size);
+ abort();
+ }
+ mpz_clear (z);
+
+ mpz_init_set_d (z, data[i].d);
+ MPZ_CHECK_FORMAT (z);
+ if (z->_mp_size != data[i].want_size
+ || refmpn_cmp_allowzero (z->_mp_d, data[i].want_data,
+ ABS (data[i].want_size)) != 0)
+ {
+ printf ("mpz_init_set_d wrong on data[%d]\n", i);
+ goto bad;
+ }
+ mpz_clear (z);
+ }
+}
+
+/* Try mpz_set_d on values 2^i+1, while such a value fits a double. */
+void
+check_2n_plus_1 (void)
+{
+ volatile double p, d, diff;
+ mpz_t want, got;
+ int i;
+
+ mpz_init (want);
+ mpz_init (got);
+
+ p = 1.0;
+ mpz_set_ui (want, 2L); /* gives 3 on first step */
+
+ for (i = 1; i < 500; i++)
+ {
+ mpz_mul_2exp (want, want, 1L);
+ mpz_sub_ui (want, want, 1L); /* want = 2^i+1 */
+
+ p *= 2.0; /* p = 2^i */
+ d = p + 1.0;
+ diff = d - p;
+ if (diff != 1.0)
+ break; /* rounding occurred, stop now */
+
+ mpz_set_d (got, d);
+ MPZ_CHECK_FORMAT (got);
+ if (mpz_cmp (got, want) != 0)
+ {
+ printf ("mpz_set_d wrong on 2^%d+1\n", i);
+ d_trace (" d ", d);
+ mpz_trace (" got ", got);
+ mpz_trace (" want ", want);
+ abort ();
+ }
+ }
+
+ mpz_clear (want);
+ mpz_clear (got);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_data ();
+ check_2n_plus_1 ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-set_f.c b/vendor/gmp-6.3.0/tests/mpz/t-set_f.c
new file mode 100644
index 0000000..2671a86
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-set_f.c
@@ -0,0 +1,125 @@
+/* Test mpz_set_f.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_one (mpz_srcptr z)
+{
+ static const int shift[] = {
+ 0, 1, GMP_LIMB_BITS, 2*GMP_LIMB_BITS, 5*GMP_LIMB_BITS
+ };
+
+ int sh, shneg, neg;
+ mpf_t f;
+ mpz_t got, want;
+
+ mpf_init2 (f, mpz_sizeinbase(z,2));
+ mpz_init (got);
+ mpz_init (want);
+
+ for (sh = 0; sh < numberof(shift); sh++)
+ {
+ for (shneg = 0; shneg <= 1; shneg++)
+ {
+ for (neg = 0; neg <= 1; neg++)
+ {
+ mpf_set_z (f, z);
+ mpz_set (want, z);
+
+ if (neg)
+ {
+ mpf_neg (f, f);
+ mpz_neg (want, want);
+ }
+
+ if (shneg)
+ {
+ mpz_tdiv_q_2exp (want, want, shift[sh]);
+ mpf_div_2exp (f, f, shift[sh]);
+ }
+ else
+ {
+ mpz_mul_2exp (want, want, shift[sh]);
+ mpf_mul_2exp (f, f, shift[sh]);
+ }
+
+ mpz_set_f (got, f);
+ MPZ_CHECK_FORMAT (got);
+
+ if (mpz_cmp (got, want) != 0)
+ {
+ printf ("wrong result\n");
+ printf (" shift %d\n", shneg ? -shift[sh] : shift[sh]);
+ printf (" neg %d\n", neg);
+ mpf_trace (" f", f);
+ mpz_trace (" got", got);
+ mpz_trace (" want", want);
+ abort ();
+ }
+ }
+ }
+ }
+
+ mpf_clear (f);
+ mpz_clear (got);
+ mpz_clear (want);
+}
+
+
+void
+check_various (void)
+{
+ mpz_t z;
+
+ mpz_init (z);
+
+ mpz_set_ui (z, 0L);
+ check_one (z);
+
+ mpz_set_si (z, 123L);
+ check_one (z);
+
+ mpz_rrandomb (z, RANDS, 2*GMP_LIMB_BITS);
+ check_one (z);
+
+ mpz_rrandomb (z, RANDS, 5*GMP_LIMB_BITS);
+ check_one (z);
+
+ mpz_clear (z);
+}
+
+
+int
+main (int argc, char *argv[])
+{
+#if GMP_NAIL_BITS == 0
+ tests_start ();
+ mp_trace_base = 16;
+
+ check_various ();
+
+ tests_end ();
+#endif
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-set_si.c b/vendor/gmp-6.3.0/tests/mpz/t-set_si.c
new file mode 100644
index 0000000..4e8ed7a
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-set_si.c
@@ -0,0 +1,96 @@
+/* Test mpz_set_si and mpz_init_set_si.
+
+Copyright 2000-2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_data (void)
+{
+#if GMP_NUMB_BITS <= BITS_PER_ULONG
+#define ENTRY(n) { n, { n, 0 } }
+#else
+#define ENTRY(n) { n, { (n) & GMP_NUMB_MASK, (n) >> GMP_NUMB_BITS } }
+#endif
+
+ static const struct {
+ long n;
+ mp_size_t want_size;
+ mp_limb_t want_data[2];
+ } data[] = {
+
+ { 0L, 0 },
+ { 1L, 1, { 1 } },
+ { -1L, -1, { 1 } },
+
+#if GMP_NUMB_BITS >= BITS_PER_ULONG
+ { LONG_MAX, 1, { LONG_MAX, 0 } },
+ { -LONG_MAX, -1, { LONG_MAX, 0 } },
+ { LONG_HIGHBIT, -1, { ULONG_HIGHBIT, 0 } },
+#else
+ { LONG_MAX, 2, { LONG_MAX & GMP_NUMB_MASK, LONG_MAX >> GMP_NUMB_BITS } },
+ { -LONG_MAX, -2, { LONG_MAX & GMP_NUMB_MASK, LONG_MAX >> GMP_NUMB_BITS }},
+ { LONG_HIGHBIT, -2, { 0, ULONG_HIGHBIT >> GMP_NUMB_BITS } },
+#endif
+ };
+
+ mpz_t n;
+ int i;
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ mpz_init (n);
+ mpz_set_si (n, data[i].n);
+ MPZ_CHECK_FORMAT (n);
+ if (n->_mp_size != data[i].want_size
+ || refmpn_cmp_allowzero (n->_mp_d, data[i].want_data,
+ ABS (data[i].want_size)) != 0)
+ {
+ printf ("mpz_set_si wrong on data[%d]\n", i);
+ abort();
+ }
+ mpz_clear (n);
+
+ mpz_init_set_si (n, data[i].n);
+ MPZ_CHECK_FORMAT (n);
+ if (n->_mp_size != data[i].want_size
+ || refmpn_cmp_allowzero (n->_mp_d, data[i].want_data,
+ ABS (data[i].want_size)) != 0)
+ {
+ printf ("mpz_init_set_si wrong on data[%d]\n", i);
+ abort();
+ }
+ mpz_clear (n);
+ }
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_data ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-set_str.c b/vendor/gmp-6.3.0/tests/mpz/t-set_str.c
new file mode 100644
index 0000000..22d36d3
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-set_str.c
@@ -0,0 +1,108 @@
+/* Test mpz_set_str.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+check_one (mpz_srcptr want, int fail, int base, const char *str)
+{
+ mpz_t got;
+
+ MPZ_CHECK_FORMAT (want);
+ mp_trace_base = (base == 0 ? 16 : base);
+
+ mpz_init (got);
+
+ if (mpz_set_str (got, str, base) != fail)
+ {
+ printf ("mpz_set_str unexpectedly failed\n");
+ printf (" base %d\n", base);
+ printf (" str \"%s\"\n", str);
+ abort ();
+ }
+ MPZ_CHECK_FORMAT (got);
+
+ if (fail == 0 && mpz_cmp (got, want) != 0)
+ {
+ printf ("mpz_set_str wrong\n");
+ printf (" base %d\n", base);
+ printf (" str \"%s\"\n", str);
+ mpz_trace ("got ", got);
+ mpz_trace ("want", want);
+ abort ();
+ }
+
+ mpz_clear (got);
+}
+
+void
+check_samples (void)
+{
+ mpz_t z;
+
+ mpz_init (z);
+
+ mpz_set_ui (z, 0L);
+ check_one (z, 0, 0, "0 ");
+ check_one (z, 0, 0, " 0 0 0 ");
+ check_one (z, 0, 0, " -0B 0 ");
+ check_one (z, 0, 0, " 0X 0 ");
+ check_one (z, 0, 10, "0 ");
+ check_one (z, 0, 10, "-0 ");
+ check_one (z, 0, 10, " 0 000 000 ");
+
+ mpz_set_ui (z, 123L);
+ check_one (z, 0, 0, "123 ");
+ check_one (z, 0, 0, "123 ");
+ check_one (z, 0, 0, "0173 ");
+ check_one (z, 0, 0, " 0b 1 11 10 11 ");
+ check_one (z, 0, 0, " 0x 7b ");
+ check_one (z, 0, 0, "0x7B");
+ check_one (z, 0, 10, "123 ");
+ check_one (z, 0, 10, "123 ");
+ check_one (z, 0, 0, " 123 ");
+ check_one (z, 0, 0, " 123 ");
+ check_one (z, 0, 10, " 0000123 ");
+ check_one (z, 0, 10, " 123 ");
+ check_one (z,-1, 10, "1%");
+ check_one (z,-1, 0, "3!");
+ check_one (z,-1, 0, "0123456789");
+ check_one (z,-1, 0, "13579BDF");
+ check_one (z,-1, 0, "0b0102");
+ check_one (z,-1, 0, "0x010G");
+ check_one (z,-1, 37,"0x010G");
+ check_one (z,-1, 99,"0x010G");
+
+ mpz_clear (z);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_samples ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-sizeinbase.c b/vendor/gmp-6.3.0/tests/mpz/t-sizeinbase.c
new file mode 100644
index 0000000..936f2bd
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-sizeinbase.c
@@ -0,0 +1,89 @@
+/* Test mpz_sizeinbase.
+
+Copyright 2001, 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+#if 0
+ /* Disabled due to the bogosity of trying to fake an _mp_d pointer to
+ below an object. Has been seen to fail on a hppa system and on ia64. */
+
+
+/* Create a fake mpz consisting of just a single 1 bit, with totbits being
+ the total number of bits, inclusive of that 1 bit. */
+void
+mpz_fake_bits (mpz_ptr z, unsigned long totbits)
+{
+ static mp_limb_t n;
+ unsigned long zero_bits, zero_limbs;
+
+ zero_bits = totbits - 1;
+ zero_limbs = zero_bits / GMP_NUMB_BITS;
+ zero_bits %= GMP_NUMB_BITS;
+
+ SIZ(z) = zero_limbs + 1;
+ PTR(z) = (&n) - (SIZ(z) - 1);
+ n = CNST_LIMB(1) << zero_bits;
+
+ ASSERT_ALWAYS (mpz_sizeinbase (z, 2) == totbits);
+}
+
+
+/* This was seen to fail on a GNU/Linux powerpc32 with gcc 2.95.2,
+ apparently due to a doubtful value of mp_bases[10].chars_per_bit_exactly
+ (0X1.34413509F79FDP-2 whereas 0X1.34413509F79FFP-2 is believed correct).
+ Presumably this is a glibc problem when gcc converts the decimal string
+ in mp_bases.c, or maybe it's only a function of the rounding mode during
+ compilation. */
+void
+check_sample (void)
+{
+ unsigned long totbits = 198096465;
+ int base = 10;
+ size_t want = 59632979;
+ size_t got;
+ mpz_t z;
+
+ mpz_fake_bits (z, totbits);
+ got = mpz_sizeinbase (z, base);
+ if (got != want)
+ {
+ printf ("mpz_sizeinbase\n");
+ printf (" base %d\n", base);
+ printf (" totbits %lu\n", totbits);
+ printf (" got %u\n", got);
+ printf (" want %u\n", want);
+ abort ();
+ }
+}
+#endif
+
+int
+main (void)
+{
+ tests_start ();
+
+ /* check_sample (); */
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-sqrtrem.c b/vendor/gmp-6.3.0/tests/mpz/t-sqrtrem.c
new file mode 100644
index 0000000..9db8a61
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-sqrtrem.c
@@ -0,0 +1,122 @@
+/* Test mpz_add, mpz_add_ui, mpz_cmp, mpz_cmp, mpz_mul, mpz_sqrtrem.
+
+Copyright 1991, 1993, 1994, 1996, 2000-2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+void dump_abort (mpz_t, mpz_t, mpz_t);
+void debug_mp (mpz_t, int);
+
+int
+main (int argc, char **argv)
+{
+ mpz_t x2;
+ mpz_t x, rem;
+ mpz_t temp, temp2;
+ mp_size_t x2_size;
+ int i;
+ int reps = 1000;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long size_range;
+
+ tests_start ();
+ TESTS_REPS (reps, argv, argc);
+
+ rands = RANDS;
+
+ mpz_init (bs);
+
+ mpz_init (x2);
+ mpz_init (x);
+ mpz_init (rem);
+ mpz_init (temp);
+ mpz_init (temp2);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 17 + 2; /* 0..262144 bit operands */
+
+ mpz_urandomb (bs, rands, size_range);
+ x2_size = mpz_get_ui (bs);
+ mpz_rrandomb (x2, rands, x2_size);
+
+ /* printf ("%ld\n", SIZ (x2)); */
+
+ mpz_sqrt (temp, x2);
+ MPZ_CHECK_FORMAT (temp);
+
+ mpz_sqrtrem (x, rem, x2);
+ MPZ_CHECK_FORMAT (x);
+ MPZ_CHECK_FORMAT (rem);
+
+ /* Are results different? */
+ if (mpz_cmp (temp, x) != 0)
+ dump_abort (x2, x, rem);
+
+ mpz_mul (temp, x, x);
+
+ /* Is square of result > argument? */
+ if (mpz_cmp (temp, x2) > 0)
+ dump_abort (x2, x, rem);
+
+ mpz_add_ui (temp2, x, 1);
+ mpz_mul (temp2, temp2, temp2);
+
+ /* Is square of (result + 1) <= argument? */
+ if (mpz_cmp (temp2, x2) <= 0)
+ dump_abort (x2, x, rem);
+
+ mpz_add (temp2, temp, rem);
+
+ /* Is the remainder wrong? */
+ if (mpz_cmp (x2, temp2) != 0)
+ dump_abort (x2, x, rem);
+ }
+
+ mpz_clear (bs);
+ mpz_clear (x2);
+ mpz_clear (x);
+ mpz_clear (rem);
+ mpz_clear (temp);
+ mpz_clear (temp2);
+
+ tests_end ();
+ exit (0);
+}
+
+void
+dump_abort (mpz_t x2, mpz_t x, mpz_t rem)
+{
+ fprintf (stderr, "ERROR\n");
+ fprintf (stderr, "x2 = "); debug_mp (x2, -16);
+ fprintf (stderr, "x = "); debug_mp (x, -16);
+ fprintf (stderr, "remainder = "); debug_mp (rem, -16);
+ abort();
+}
+
+void
+debug_mp (mpz_t x, int base)
+{
+ mpz_out_str (stderr, base, x); fputc ('\n', stderr);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-tdiv.c b/vendor/gmp-6.3.0/tests/mpz/t-tdiv.c
new file mode 100644
index 0000000..3d2eb36
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-tdiv.c
@@ -0,0 +1,145 @@
+/* Test mpz_abs, mpz_add, mpz_cmp, mpz_cmp_ui, mpz_tdiv_qr, mpz_tdiv_q,
+ mpz_tdiv_r, mpz_mul.
+
+Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+void dump_abort (mpz_t, mpz_t);
+void debug_mp (mpz_t, int);
+
+int
+main (int argc, char **argv)
+{
+ mpz_t dividend, divisor;
+ mpz_t quotient, remainder;
+ mpz_t quotient2, remainder2;
+ mpz_t temp;
+ mp_size_t dividend_size, divisor_size;
+ int i;
+ int reps = 1000;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+
+ tests_start ();
+ TESTS_REPS (reps, argv, argc);
+
+ rands = RANDS;
+
+ mpz_init (bs);
+
+ mpz_init (dividend);
+ mpz_init (divisor);
+ mpz_init (quotient);
+ mpz_init (remainder);
+ mpz_init (quotient2);
+ mpz_init (remainder2);
+ mpz_init (temp);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 18 + 2; /* 0..524288 bit operands */
+
+ do
+ {
+ mpz_urandomb (bs, rands, size_range);
+ divisor_size = mpz_get_ui (bs);
+ mpz_rrandomb (divisor, rands, divisor_size);
+ }
+ while (mpz_sgn (divisor) == 0);
+
+ mpz_urandomb (bs, rands, size_range);
+ dividend_size = mpz_get_ui (bs) + divisor_size;
+ mpz_rrandomb (dividend, rands, dividend_size);
+
+ mpz_urandomb (bs, rands, 2);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 1) != 0)
+ mpz_neg (dividend, dividend);
+ if ((bsi & 2) != 0)
+ mpz_neg (divisor, divisor);
+
+ /* printf ("%ld %ld\n", SIZ (dividend), SIZ (divisor)); */
+
+ mpz_tdiv_qr (quotient, remainder, dividend, divisor);
+ mpz_tdiv_q (quotient2, dividend, divisor);
+ mpz_tdiv_r (remainder2, dividend, divisor);
+
+ /* First determine that the quotients and remainders computed
+ with different functions are equal. */
+ if (mpz_cmp (quotient, quotient2) != 0)
+ dump_abort (dividend, divisor);
+ if (mpz_cmp (remainder, remainder2) != 0)
+ dump_abort (dividend, divisor);
+
+ /* Check if the sign of the quotient is correct. */
+ if (mpz_cmp_ui (quotient, 0) != 0)
+ if ((mpz_cmp_ui (quotient, 0) < 0)
+ != ((mpz_cmp_ui (dividend, 0) ^ mpz_cmp_ui (divisor, 0)) < 0))
+ dump_abort (dividend, divisor);
+
+ /* Check if the remainder has the same sign as the dividend
+ (quotient rounded towards 0). */
+ if (mpz_cmp_ui (remainder, 0) != 0)
+ if ((mpz_cmp_ui (remainder, 0) < 0) != (mpz_cmp_ui (dividend, 0) < 0))
+ dump_abort (dividend, divisor);
+
+ mpz_mul (temp, quotient, divisor);
+ mpz_add (temp, temp, remainder);
+ if (mpz_cmp (temp, dividend) != 0)
+ dump_abort (dividend, divisor);
+
+ mpz_abs (temp, divisor);
+ mpz_abs (remainder, remainder);
+ if (mpz_cmp (remainder, temp) >= 0)
+ dump_abort (dividend, divisor);
+ }
+
+ mpz_clear (bs);
+ mpz_clear (dividend);
+ mpz_clear (divisor);
+ mpz_clear (quotient);
+ mpz_clear (remainder);
+ mpz_clear (quotient2);
+ mpz_clear (remainder2);
+ mpz_clear (temp);
+
+ tests_end ();
+ exit (0);
+}
+
+void
+dump_abort (mpz_t dividend, mpz_t divisor)
+{
+ fprintf (stderr, "ERROR\n");
+ fprintf (stderr, "dividend = "); debug_mp (dividend, -16);
+ fprintf (stderr, "divisor = "); debug_mp (divisor, -16);
+ abort();
+}
+
+void
+debug_mp (mpz_t x, int base)
+{
+ mpz_out_str (stderr, base, x); fputc ('\n', stderr);
+}
diff --git a/vendor/gmp-6.3.0/tests/mpz/t-tdiv_ui.c b/vendor/gmp-6.3.0/tests/mpz/t-tdiv_ui.c
new file mode 100644
index 0000000..6bbb947
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/mpz/t-tdiv_ui.c
@@ -0,0 +1,158 @@
+/* Test mpz_abs, mpz_add, mpz_cmp, mpz_cmp_ui, mpz_tdiv_qr_ui, mpz_tdiv_q_ui,
+ mpz_tdiv_r_ui, mpz_tdiv_ui, mpz_mul_ui.
+
+Copyright 1993, 1994, 1996, 2000-2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+void dump_abort (const char *, mpz_t, unsigned long);
+void debug_mp (mpz_t, int);
+
+int
+main (int argc, char **argv)
+{
+ mpz_t dividend;
+ mpz_t quotient, remainder;
+ mpz_t quotient2, remainder2;
+ mpz_t temp;
+ mp_size_t dividend_size;
+ unsigned long divisor;
+ int i;
+ int reps = 200000;
+ gmp_randstate_ptr rands;
+ mpz_t bs;
+ unsigned long bsi, size_range;
+ unsigned long r_rq, r_q, r_r, r;
+
+ tests_start ();
+ rands = RANDS;
+
+ mpz_init (bs);
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
+ mpz_init (dividend);
+ mpz_init (quotient);
+ mpz_init (remainder);
+ mpz_init (quotient2);
+ mpz_init (remainder2);
+ mpz_init (temp);
+
+ for (i = 0; i < reps; i++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ size_range = mpz_get_ui (bs) % 10 + 2; /* 0..2047 bit operands */
+
+ do
+ {
+ mpz_rrandomb (bs, rands, 64);
+ divisor = mpz_get_ui (bs);
+ }
+ while (divisor == 0);
+
+ mpz_urandomb (bs, rands, size_range);
+ dividend_size = mpz_get_ui (bs);
+ mpz_rrandomb (dividend, rands, dividend_size);
+
+ mpz_urandomb (bs, rands, 2);
+ bsi = mpz_get_ui (bs);
+ if ((bsi & 1) != 0)
+ mpz_neg (dividend, dividend);
+
+ /* printf ("%ld\n", SIZ (dividend)); */
+
+ r_rq = mpz_tdiv_qr_ui (quotient, remainder, dividend, divisor);
+ r_q = mpz_tdiv_q_ui (quotient2, dividend, divisor);
+ r_r = mpz_tdiv_r_ui (remainder2, dividend, divisor);
+ r = mpz_tdiv_ui (dividend, divisor);
+
+ /* First determine that the quotients and remainders computed
+ with different functions are equal. */
+ if (mpz_cmp (quotient, quotient2) != 0)
+ dump_abort ("quotients from mpz_tdiv_qr_ui and mpz_tdiv_q_ui differ",
+ dividend, divisor);
+ if (mpz_cmp (remainder, remainder2) != 0)
+ dump_abort ("remainders from mpz_tdiv_qr_ui and mpz_tdiv_r_ui differ",
+ dividend, divisor);
+
+ /* Check if the sign of the quotient is correct. */
+ if (mpz_cmp_ui (quotient, 0) != 0)
+ if ((mpz_cmp_ui (quotient, 0) < 0)
+ != (mpz_cmp_ui (dividend, 0) < 0))
+ dump_abort ("quotient sign wrong", dividend, divisor);
+
+ /* Check if the remainder has the same sign as the dividend
+ (quotient rounded towards 0). */
+ if (mpz_cmp_ui (remainder, 0) != 0)
+ if ((mpz_cmp_ui (remainder, 0) < 0) != (mpz_cmp_ui (dividend, 0) < 0))
+ dump_abort ("remainder sign wrong", dividend, divisor);
+
+ mpz_mul_ui (temp, quotient, divisor);
+ mpz_add (temp, temp, remainder);
+ if (mpz_cmp (temp, dividend) != 0)
+ dump_abort ("n mod d != n - [n/d]*d", dividend, divisor);
+
+ mpz_abs (remainder, remainder);
+ if (mpz_cmp_ui (remainder, divisor) >= 0)
+ dump_abort ("remainder greater than divisor", dividend, divisor);
+
+ if (mpz_cmp_ui (remainder, r_rq) != 0)
+ dump_abort ("remainder returned from mpz_tdiv_qr_ui is wrong",
+ dividend, divisor);
+ if (mpz_cmp_ui (remainder, r_q) != 0)
+ dump_abort ("remainder returned from mpz_tdiv_q_ui is wrong",
+ dividend, divisor);
+ if (mpz_cmp_ui (remainder, r_r) != 0)
+ dump_abort ("remainder returned from mpz_tdiv_r_ui is wrong",
+ dividend, divisor);
+ if (mpz_cmp_ui (remainder, r) != 0)
+ dump_abort ("remainder returned from mpz_tdiv_ui is wrong",
+ dividend, divisor);
+ }
+
+ mpz_clear (bs);
+ mpz_clear (dividend);
+ mpz_clear (quotient);
+ mpz_clear (remainder);
+ mpz_clear (quotient2);
+ mpz_clear (remainder2);
+ mpz_clear (temp);
+
+ tests_end ();
+ exit (0);
+}
+
+void
+dump_abort (const char *str, mpz_t dividend, unsigned long divisor)
+{
+ fprintf (stderr, "ERROR: %s\n", str);
+ fprintf (stderr, "dividend = "); debug_mp (dividend, -16);
+ fprintf (stderr, "divisor = %lX\n", divisor);
+ abort();
+}
+
+void
+debug_mp (mpz_t x, int base)
+{
+ mpz_out_str (stderr, base, x); fputc ('\n', stderr);
+}
diff --git a/vendor/gmp-6.3.0/tests/rand/Makefile.am b/vendor/gmp-6.3.0/tests/rand/Makefile.am
new file mode 100644
index 0000000..71bb7a9
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/rand/Makefile.am
@@ -0,0 +1,90 @@
+## Process this file with automake to generate Makefile.in
+
+# Copyright 2000-2003 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+
+
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
+AM_LDFLAGS = -no-install
+LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
+
+check_PROGRAMS = t-iset t-lc2exp t-mt t-rand t-urbui t-urmui t-urndmm
+TESTS = $(check_PROGRAMS)
+
+EXTRA_PROGRAMS = findlc gen gen.static spect stat
+gen_static_SOURCES = gen.c
+gen_static_LDFLAGS = -static
+findlc_LDADD = libstat.la
+spect_LDADD = libstat.la
+stat_LDADD = libstat.la
+
+EXTRA_LTLIBRARIES = libstat.la
+libstat_la_SOURCES = gmpstat.h statlib.c zdiv_round.c
+libstat_la_LIBADD = $(top_builddir)/libgmp.la $(LIBM)
+
+CLEANFILES = $(EXTRA_PROGRAMS) $(EXTRA_LTLIBRARIES)
+
+allprogs: $(EXTRA_PROGRAMS)
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
+
+manual-test: gen$(EXEEXT) stat$(EXEEXT)
+ @(echo -n '16i: '; ./gen -f mpz_urandomb -z 16 1000 \
+ | ./stat -i 0xffff | grep '^[0-9]')
+ @(echo -n '32i: '; ./gen -f mpz_urandomb -z 32 1000 \
+ | ./stat -i 0xffffffff | grep '^[0-9]')
+ @(echo -n '33i: '; ./gen -f mpz_urandomb -z 33 1000 \
+ | ./stat -i 0x1ffffffff | grep '^[0-9]')
+ @(echo -n '64i: '; ./gen -f mpz_urandomb -z 64 1000 \
+ | ./stat -i 0xffffffffffffffff | grep '^[0-9]')
+ @(echo -n '128i: '; ./gen -f mpz_urandomb -z 128 1000 \
+ | ./stat -i 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF | grep '^[0-9]')
+
+ @(echo -n '16f: '; ./gen -f mpf_urandomb -z 16 1000 \
+ | ./stat | grep '^[0-9]')
+ @(echo -n '32f: '; ./gen -f mpf_urandomb -z 32 1000 \
+ | ./stat | grep '^[0-9]')
+ @(echo -n '33f: '; ./gen -f mpf_urandomb -z 33 1000 \
+ | ./stat | grep '^[0-9]')
+ @(echo -n '64f: '; ./gen -f mpf_urandomb -z 64 1000 \
+ | ./stat | grep '^[0-9]')
+ @(echo -n '128f: '; ./gen -f mpf_urandomb -z 128 1000 \
+ | ./stat | grep '^[0-9]')
+
+manual-bigtest: gen$(EXEEXT) stat$(EXEEXT)
+ @(echo '16i: '; ./gen -f mpz_urandomb -z 16 50000 \
+ | ./stat -2 1000 -i 0xffff | grep '^K[mp]')
+ @(echo '32i: '; ./gen -f mpz_urandomb -z 32 50000 \
+ | ./stat -2 1000 -i 0xffffffff | grep '^K[mp]')
+ @(echo '33i: '; ./gen -f mpz_urandomb -z 33 50000 \
+ | ./stat -2 1000 -i 0x1ffffffff | grep '^K[mp]')
+ @(echo '64i: '; ./gen -f mpz_urandomb -z 64 50000 \
+ | ./stat -2 1000 -i 0xffffffffffffffff | grep '^K[mp]')
+ @(echo '128i: '; ./gen -f mpz_urandomb -z 128 50000 \
+ | ./stat -2 1000 -i 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF | grep '^K[mp]')
+
+ @(echo '16f: '; ./gen -f mpf_urandomb -z 16 50000 \
+ | ./stat -2 1000 | grep '^K[mp]')
+ @(echo '32f: '; ./gen -f mpf_urandomb -z 32 50000 \
+ | ./stat -2 1000 | grep '^K[mp]')
+ @(echo '33f: '; ./gen -f mpf_urandomb -z 33 50000 \
+ | ./stat -2 1000 | grep '^K[mp]')
+ @(echo '64f: '; ./gen -f mpf_urandomb -z 64 50000 \
+ | ./stat -2 1000 | grep '^K[mp]')
+ @(echo '128f: '; ./gen -f mpf_urandomb -z 128 50000 \
+ | ./stat -2 1000 | grep '^K[mp]')
diff --git a/vendor/gmp-6.3.0/tests/rand/Makefile.in b/vendor/gmp-6.3.0/tests/rand/Makefile.in
new file mode 100644
index 0000000..ee61406
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/rand/Makefile.in
@@ -0,0 +1,1215 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 2000-2003 Free Software Foundation, Inc.
+#
+# This file is part of the GNU MP Library test suite.
+#
+# The GNU MP Library test suite is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# The GNU MP Library test suite is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+check_PROGRAMS = t-iset$(EXEEXT) t-lc2exp$(EXEEXT) t-mt$(EXEEXT) \
+ t-rand$(EXEEXT) t-urbui$(EXEEXT) t-urmui$(EXEEXT) \
+ t-urndmm$(EXEEXT)
+EXTRA_PROGRAMS = findlc$(EXEEXT) gen$(EXEEXT) gen.static$(EXEEXT) \
+ spect$(EXEEXT) stat$(EXEEXT)
+subdir = tests/rand
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__DEPENDENCIES_1 =
+libstat_la_DEPENDENCIES = $(top_builddir)/libgmp.la \
+ $(am__DEPENDENCIES_1)
+am_libstat_la_OBJECTS = statlib.lo zdiv_round.lo
+libstat_la_OBJECTS = $(am_libstat_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+findlc_SOURCES = findlc.c
+findlc_OBJECTS = findlc.$(OBJEXT)
+findlc_DEPENDENCIES = libstat.la
+gen_SOURCES = gen.c
+gen_OBJECTS = gen.$(OBJEXT)
+gen_LDADD = $(LDADD)
+gen_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+am_gen_static_OBJECTS = gen.$(OBJEXT)
+gen_static_OBJECTS = $(am_gen_static_OBJECTS)
+gen_static_LDADD = $(LDADD)
+gen_static_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+gen_static_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(gen_static_LDFLAGS) $(LDFLAGS) -o $@
+spect_SOURCES = spect.c
+spect_OBJECTS = spect.$(OBJEXT)
+spect_DEPENDENCIES = libstat.la
+stat_SOURCES = stat.c
+stat_OBJECTS = stat.$(OBJEXT)
+stat_DEPENDENCIES = libstat.la
+t_iset_SOURCES = t-iset.c
+t_iset_OBJECTS = t-iset.$(OBJEXT)
+t_iset_LDADD = $(LDADD)
+t_iset_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_lc2exp_SOURCES = t-lc2exp.c
+t_lc2exp_OBJECTS = t-lc2exp.$(OBJEXT)
+t_lc2exp_LDADD = $(LDADD)
+t_lc2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_mt_SOURCES = t-mt.c
+t_mt_OBJECTS = t-mt.$(OBJEXT)
+t_mt_LDADD = $(LDADD)
+t_mt_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_rand_SOURCES = t-rand.c
+t_rand_OBJECTS = t-rand.$(OBJEXT)
+t_rand_LDADD = $(LDADD)
+t_rand_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_urbui_SOURCES = t-urbui.c
+t_urbui_OBJECTS = t-urbui.$(OBJEXT)
+t_urbui_LDADD = $(LDADD)
+t_urbui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_urmui_SOURCES = t-urmui.c
+t_urmui_OBJECTS = t-urmui.$(OBJEXT)
+t_urmui_LDADD = $(LDADD)
+t_urmui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+t_urndmm_SOURCES = t-urndmm.c
+t_urndmm_OBJECTS = t-urndmm.$(OBJEXT)
+t_urndmm_LDADD = $(LDADD)
+t_urndmm_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libgmp.la
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(libstat_la_SOURCES) findlc.c gen.c $(gen_static_SOURCES) \
+ spect.c stat.c t-iset.c t-lc2exp.c t-mt.c t-rand.c t-urbui.c \
+ t-urmui.c t-urndmm.c
+DIST_SOURCES = $(libstat_la_SOURCES) findlc.c gen.c \
+ $(gen_static_SOURCES) spect.c stat.c t-iset.c t-lc2exp.c \
+ t-mt.c t-rand.c t-urbui.c t-urmui.c t-urndmm.c
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = { \
+ $(am__tty_colors_dummy); \
+ if test "X$(AM_COLOR_TESTS)" = Xno; then \
+ am__color_tests=no; \
+ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+ am__color_tests=yes; \
+ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+ am__color_tests=yes; \
+ fi; \
+ if test $$am__color_tests = yes; then \
+ red=''; \
+ grn=''; \
+ lgn=''; \
+ blu=''; \
+ mgn=''; \
+ brg=''; \
+ std=''; \
+ fi; \
+}
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__recheck_rx = ^[ ]*:recheck:[ ]*
+am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
+am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+ recheck = 1; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ { \
+ if ((getline line2 < ($$0 ".log")) < 0) \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+ { \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+ { \
+ break; \
+ } \
+ }; \
+ if (recheck) \
+ print $$0; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+ print "fatal: making $@: " msg | "cat >&2"; \
+ exit 1; \
+} \
+function rst_section(header) \
+{ \
+ print header; \
+ len = length(header); \
+ for (i = 1; i <= len; i = i + 1) \
+ printf "="; \
+ printf "\n\n"; \
+} \
+{ \
+ copy_in_global_log = 1; \
+ global_test_result = "RUN"; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".trs"); \
+ if (line ~ /$(am__global_test_result_rx)/) \
+ { \
+ sub("$(am__global_test_result_rx)", "", line); \
+ sub("[ ]*$$", "", line); \
+ global_test_result = line; \
+ } \
+ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+ copy_in_global_log = 0; \
+ }; \
+ if (copy_in_global_log) \
+ { \
+ rst_section(global_test_result ": " $$0); \
+ while ((rc = (getline line < ($$0 ".log"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".log"); \
+ print line; \
+ }; \
+ printf "\n"; \
+ }; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+ --color-tests "$$am__color_tests" \
+ --enable-hard-errors "$$am__enable_hard_errors" \
+ --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test. Creates the
+# directory for the log if needed. Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log. Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT. Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup); \
+$(am__vpath_adj_setup) $(am__vpath_adj) \
+$(am__tty_colors); \
+srcdir=$(srcdir); export srcdir; \
+case "$@" in \
+ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \
+ *) am__odir=.;; \
+esac; \
+test "x$$am__odir" = x"." || test -d "$$am__odir" \
+ || $(MKDIR_P) "$$am__odir" || exit $$?; \
+if test -f "./$$f"; then dir=./; \
+elif test -f "$$f"; then dir=; \
+else dir="$(srcdir)/"; fi; \
+tst=$$dir$$f; log='$@'; \
+if test -n '$(DISABLE_HARD_ERRORS)'; then \
+ am__enable_hard_errors=no; \
+else \
+ am__enable_hard_errors=yes; \
+fi; \
+case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
+ am__expect_failure=yes;; \
+ *) \
+ am__expect_failure=no;; \
+esac; \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed). The result is saved in the shell variable
+# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+ bases='$(TEST_LOGS)'; \
+ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+ bases=`echo $$bases`
+RECHECK_LOGS = $(TEST_LOGS)
+AM_RECURSIVE_TARGETS = check recheck
+TEST_SUITE_LOG = test-suite.log
+TEST_EXTENSIONS = @EXEEXT@ .test
+LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
+am__set_b = \
+ case '$@' in \
+ */*) \
+ case '$*' in \
+ */*) b='$*';; \
+ *) b=`echo '$@' | sed 's/\.log$$//'`; \
+ esac;; \
+ *) \
+ b='$*';; \
+ esac
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+ $(TEST_LOG_FLAGS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/test-driver
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ABI = @ABI@
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+ASMFLAGS = @ASMFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
+CC = @CC@
+CCAS = @CCAS@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPP_FOR_BUILD = @CPP_FOR_BUILD@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
+DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
+FGREP = @FGREP@
+GMP_LDFLAGS = @GMP_LDFLAGS@
+GMP_LIMB_BITS = @GMP_LIMB_BITS@
+GMP_NAIL_BITS = @GMP_NAIL_BITS@
+GREP = @GREP@
+HAVE_CLOCK_01 = @HAVE_CLOCK_01@
+HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@
+HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@
+HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@
+HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@
+HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@
+HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@
+HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
+HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
+HAVE_STACK_T_01 = @HAVE_STACK_T_01@
+HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBCURSES = @LIBCURSES@
+LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@
+LIBGMP_DLL = @LIBGMP_DLL@
+LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@
+LIBM = @LIBM@
+LIBM_FOR_BUILD = @LIBM_FOR_BUILD@
+LIBOBJS = @LIBOBJS@
+LIBREADLINE = @LIBREADLINE@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+M4 = @M4@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
+STRIP = @STRIP@
+TAL_OBJECT = @TAL_OBJECT@
+TUNE_LIBS = @TUNE_LIBS@
+TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U_FOR_BUILD = @U_FOR_BUILD@
+VERSION = @VERSION@
+WITH_READLINE_01 = @WITH_READLINE_01@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gmp_srclinks = @gmp_srclinks@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mpn_objects = @mpn_objects@
+mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
+AM_LDFLAGS = -no-install
+LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
+TESTS = $(check_PROGRAMS)
+gen_static_SOURCES = gen.c
+gen_static_LDFLAGS = -static
+findlc_LDADD = libstat.la
+spect_LDADD = libstat.la
+stat_LDADD = libstat.la
+EXTRA_LTLIBRARIES = libstat.la
+libstat_la_SOURCES = gmpstat.h statlib.c zdiv_round.c
+libstat_la_LIBADD = $(top_builddir)/libgmp.la $(LIBM)
+CLEANFILES = $(EXTRA_PROGRAMS) $(EXTRA_LTLIBRARIES)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/rand/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/rand/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+libstat.la: $(libstat_la_OBJECTS) $(libstat_la_DEPENDENCIES) $(EXTRA_libstat_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(libstat_la_OBJECTS) $(libstat_la_LIBADD) $(LIBS)
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+findlc$(EXEEXT): $(findlc_OBJECTS) $(findlc_DEPENDENCIES) $(EXTRA_findlc_DEPENDENCIES)
+ @rm -f findlc$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(findlc_OBJECTS) $(findlc_LDADD) $(LIBS)
+
+gen$(EXEEXT): $(gen_OBJECTS) $(gen_DEPENDENCIES) $(EXTRA_gen_DEPENDENCIES)
+ @rm -f gen$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(gen_OBJECTS) $(gen_LDADD) $(LIBS)
+
+gen.static$(EXEEXT): $(gen_static_OBJECTS) $(gen_static_DEPENDENCIES) $(EXTRA_gen_static_DEPENDENCIES)
+ @rm -f gen.static$(EXEEXT)
+ $(AM_V_CCLD)$(gen_static_LINK) $(gen_static_OBJECTS) $(gen_static_LDADD) $(LIBS)
+
+spect$(EXEEXT): $(spect_OBJECTS) $(spect_DEPENDENCIES) $(EXTRA_spect_DEPENDENCIES)
+ @rm -f spect$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(spect_OBJECTS) $(spect_LDADD) $(LIBS)
+
+stat$(EXEEXT): $(stat_OBJECTS) $(stat_DEPENDENCIES) $(EXTRA_stat_DEPENDENCIES)
+ @rm -f stat$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(stat_OBJECTS) $(stat_LDADD) $(LIBS)
+
+t-iset$(EXEEXT): $(t_iset_OBJECTS) $(t_iset_DEPENDENCIES) $(EXTRA_t_iset_DEPENDENCIES)
+ @rm -f t-iset$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_iset_OBJECTS) $(t_iset_LDADD) $(LIBS)
+
+t-lc2exp$(EXEEXT): $(t_lc2exp_OBJECTS) $(t_lc2exp_DEPENDENCIES) $(EXTRA_t_lc2exp_DEPENDENCIES)
+ @rm -f t-lc2exp$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_lc2exp_OBJECTS) $(t_lc2exp_LDADD) $(LIBS)
+
+t-mt$(EXEEXT): $(t_mt_OBJECTS) $(t_mt_DEPENDENCIES) $(EXTRA_t_mt_DEPENDENCIES)
+ @rm -f t-mt$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_mt_OBJECTS) $(t_mt_LDADD) $(LIBS)
+
+t-rand$(EXEEXT): $(t_rand_OBJECTS) $(t_rand_DEPENDENCIES) $(EXTRA_t_rand_DEPENDENCIES)
+ @rm -f t-rand$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_rand_OBJECTS) $(t_rand_LDADD) $(LIBS)
+
+t-urbui$(EXEEXT): $(t_urbui_OBJECTS) $(t_urbui_DEPENDENCIES) $(EXTRA_t_urbui_DEPENDENCIES)
+ @rm -f t-urbui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_urbui_OBJECTS) $(t_urbui_LDADD) $(LIBS)
+
+t-urmui$(EXEEXT): $(t_urmui_OBJECTS) $(t_urmui_DEPENDENCIES) $(EXTRA_t_urmui_DEPENDENCIES)
+ @rm -f t-urmui$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_urmui_OBJECTS) $(t_urmui_LDADD) $(LIBS)
+
+t-urndmm$(EXEEXT): $(t_urndmm_OBJECTS) $(t_urndmm_DEPENDENCIES) $(EXTRA_t_urndmm_DEPENDENCIES)
+ @rm -f t-urndmm$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_urndmm_OBJECTS) $(t_urndmm_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+.c.o:
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+ $(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+ rm -f $< $@
+ $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+ @:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+ @$(am__set_TESTS_bases); \
+ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+ redo_bases=`for i in $$bases; do \
+ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+ done`; \
+ if test -n "$$redo_bases"; then \
+ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+ if $(am__make_dryrun); then :; else \
+ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+ fi; \
+ fi; \
+ if test -n "$$am__remaking_logs"; then \
+ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+ "recursion detected" >&2; \
+ elif test -n "$$redo_logs"; then \
+ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+ fi; \
+ if $(am__make_dryrun); then :; else \
+ st=0; \
+ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+ for i in $$redo_bases; do \
+ test -f $$i.trs && test -r $$i.trs \
+ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+ test -f $$i.log && test -r $$i.log \
+ || { echo "$$errmsg $$i.log" >&2; st=1; }; \
+ done; \
+ test $$st -eq 0 || exit 1; \
+ fi
+ @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+ ws='[ ]'; \
+ results=`for b in $$bases; do echo $$b.trs; done`; \
+ test -n "$$results" || results=/dev/null; \
+ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
+ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \
+ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \
+ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \
+ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+ if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+ success=true; \
+ else \
+ success=false; \
+ fi; \
+ br='==================='; br=$$br$$br$$br$$br; \
+ result_count () \
+ { \
+ if test x"$$1" = x"--maybe-color"; then \
+ maybe_colorize=yes; \
+ elif test x"$$1" = x"--no-color"; then \
+ maybe_colorize=no; \
+ else \
+ echo "$@: invalid 'result_count' usage" >&2; exit 4; \
+ fi; \
+ shift; \
+ desc=$$1 count=$$2; \
+ if test $$maybe_colorize = yes && test $$count -gt 0; then \
+ color_start=$$3 color_end=$$std; \
+ else \
+ color_start= color_end=; \
+ fi; \
+ echo "$${color_start}# $$desc $$count$${color_end}"; \
+ }; \
+ create_testsuite_report () \
+ { \
+ result_count $$1 "TOTAL:" $$all "$$brg"; \
+ result_count $$1 "PASS: " $$pass "$$grn"; \
+ result_count $$1 "SKIP: " $$skip "$$blu"; \
+ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+ result_count $$1 "FAIL: " $$fail "$$red"; \
+ result_count $$1 "XPASS:" $$xpass "$$red"; \
+ result_count $$1 "ERROR:" $$error "$$mgn"; \
+ }; \
+ { \
+ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
+ $(am__rst_title); \
+ create_testsuite_report --no-color; \
+ echo; \
+ echo ".. contents:: :depth: 2"; \
+ echo; \
+ for b in $$bases; do echo $$b; done \
+ | $(am__create_global_log); \
+ } >$(TEST_SUITE_LOG).tmp || exit 1; \
+ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
+ if $$success; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
+ fi; \
+ echo "$${col}$$br$${std}"; \
+ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \
+ echo "$${col}$$br$${std}"; \
+ create_testsuite_report --maybe-color; \
+ echo "$$col$$br$$std"; \
+ if $$success; then :; else \
+ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \
+ if test -n "$(PACKAGE_BUGREPORT)"; then \
+ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+ fi; \
+ echo "$$col$$br$$std"; \
+ fi; \
+ $$success || exit 1
+
+check-TESTS:
+ @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
+ @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+ exit $$?;
+recheck: all $(check_PROGRAMS)
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ bases=`for i in $$bases; do echo $$i; done \
+ | $(am__list_recheck_tests)` || exit 1; \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ log_list=`echo $$log_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+ am__force_recheck=am--force-recheck \
+ TEST_LOGS="$$log_list"; \
+ exit $$?
+t-iset.log: t-iset$(EXEEXT)
+ @p='t-iset$(EXEEXT)'; \
+ b='t-iset'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-lc2exp.log: t-lc2exp$(EXEEXT)
+ @p='t-lc2exp$(EXEEXT)'; \
+ b='t-lc2exp'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-mt.log: t-mt$(EXEEXT)
+ @p='t-mt$(EXEEXT)'; \
+ b='t-mt'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-rand.log: t-rand$(EXEEXT)
+ @p='t-rand$(EXEEXT)'; \
+ b='t-rand'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-urbui.log: t-urbui$(EXEEXT)
+ @p='t-urbui$(EXEEXT)'; \
+ b='t-urbui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-urmui.log: t-urmui$(EXEEXT)
+ @p='t-urmui$(EXEEXT)'; \
+ b='t-urmui'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+t-urndmm.log: t-urndmm$(EXEEXT)
+ @p='t-urndmm$(EXEEXT)'; \
+ b='t-urndmm'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+.test.log:
+ @p='$<'; \
+ $(am__set_b); \
+ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+@am__EXEEXT_TRUE@.test$(EXEEXT).log:
+@am__EXEEXT_TRUE@ @p='$<'; \
+@am__EXEEXT_TRUE@ $(am__set_b); \
+@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
+@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+ -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+ -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+ -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
+ ctags ctags-am distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ recheck tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+allprogs: $(EXTRA_PROGRAMS)
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
+
+manual-test: gen$(EXEEXT) stat$(EXEEXT)
+ @(echo -n '16i: '; ./gen -f mpz_urandomb -z 16 1000 \
+ | ./stat -i 0xffff | grep '^[0-9]')
+ @(echo -n '32i: '; ./gen -f mpz_urandomb -z 32 1000 \
+ | ./stat -i 0xffffffff | grep '^[0-9]')
+ @(echo -n '33i: '; ./gen -f mpz_urandomb -z 33 1000 \
+ | ./stat -i 0x1ffffffff | grep '^[0-9]')
+ @(echo -n '64i: '; ./gen -f mpz_urandomb -z 64 1000 \
+ | ./stat -i 0xffffffffffffffff | grep '^[0-9]')
+ @(echo -n '128i: '; ./gen -f mpz_urandomb -z 128 1000 \
+ | ./stat -i 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF | grep '^[0-9]')
+
+ @(echo -n '16f: '; ./gen -f mpf_urandomb -z 16 1000 \
+ | ./stat | grep '^[0-9]')
+ @(echo -n '32f: '; ./gen -f mpf_urandomb -z 32 1000 \
+ | ./stat | grep '^[0-9]')
+ @(echo -n '33f: '; ./gen -f mpf_urandomb -z 33 1000 \
+ | ./stat | grep '^[0-9]')
+ @(echo -n '64f: '; ./gen -f mpf_urandomb -z 64 1000 \
+ | ./stat | grep '^[0-9]')
+ @(echo -n '128f: '; ./gen -f mpf_urandomb -z 128 1000 \
+ | ./stat | grep '^[0-9]')
+
+manual-bigtest: gen$(EXEEXT) stat$(EXEEXT)
+ @(echo '16i: '; ./gen -f mpz_urandomb -z 16 50000 \
+ | ./stat -2 1000 -i 0xffff | grep '^K[mp]')
+ @(echo '32i: '; ./gen -f mpz_urandomb -z 32 50000 \
+ | ./stat -2 1000 -i 0xffffffff | grep '^K[mp]')
+ @(echo '33i: '; ./gen -f mpz_urandomb -z 33 50000 \
+ | ./stat -2 1000 -i 0x1ffffffff | grep '^K[mp]')
+ @(echo '64i: '; ./gen -f mpz_urandomb -z 64 50000 \
+ | ./stat -2 1000 -i 0xffffffffffffffff | grep '^K[mp]')
+ @(echo '128i: '; ./gen -f mpz_urandomb -z 128 50000 \
+ | ./stat -2 1000 -i 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF | grep '^K[mp]')
+
+ @(echo '16f: '; ./gen -f mpf_urandomb -z 16 50000 \
+ | ./stat -2 1000 | grep '^K[mp]')
+ @(echo '32f: '; ./gen -f mpf_urandomb -z 32 50000 \
+ | ./stat -2 1000 | grep '^K[mp]')
+ @(echo '33f: '; ./gen -f mpf_urandomb -z 33 50000 \
+ | ./stat -2 1000 | grep '^K[mp]')
+ @(echo '64f: '; ./gen -f mpf_urandomb -z 64 50000 \
+ | ./stat -2 1000 | grep '^K[mp]')
+ @(echo '128f: '; ./gen -f mpf_urandomb -z 128 50000 \
+ | ./stat -2 1000 | grep '^K[mp]')
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/vendor/gmp-6.3.0/tests/rand/findlc.c b/vendor/gmp-6.3.0/tests/rand/findlc.c
new file mode 100644
index 0000000..72fb12c
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/rand/findlc.c
@@ -0,0 +1,251 @@
+/*
+Copyright 2000 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+#include <math.h>
+#include "gmpstat.h"
+
+#define RCSID(msg) \
+static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
+
+RCSID("$Id$");
+
+int g_debug = 0;
+
+static mpz_t a;
+
+static void
+sh_status (int sig)
+{
+ printf ("sh_status: signal %d caught. dumping status.\n", sig);
+
+ printf (" a = ");
+ mpz_out_str (stdout, 10, a);
+ printf ("\n");
+ fflush (stdout);
+
+ if (SIGSEGV == sig) /* remove SEGV handler */
+ signal (SIGSEGV, SIG_DFL);
+}
+
+/* Input is a modulus (m). We shall find multiplier (a) and adder (c)
+ conforming to the rules found in the first comment block in file
+ mpz/urandom.c.
+
+ Then run a spectral test on the generator and discard any
+ multipliers not passing. */
+
+/* TODO:
+
+ . find a better algorithm than a+=8; bigger jumps perhaps?
+
+*/
+
+void
+mpz_true_random (mpz_t s, unsigned long int nbits)
+{
+#if __FreeBSD__
+ FILE *fs;
+ char c[1];
+ int i;
+
+ mpz_set_ui (s, 0);
+ for (i = 0; i < nbits; i += 8)
+ {
+ for (;;)
+ {
+ int nread;
+ fs = fopen ("/dev/random", "r");
+ nread = fread (c, 1, 1, fs);
+ fclose (fs);
+ if (nread != 0)
+ break;
+ sleep (1);
+ }
+ mpz_mul_2exp (s, s, 8);
+ mpz_add_ui (s, s, ((unsigned long int) c[0]) & 0xff);
+ printf ("%d random bits\n", i + 8);
+ }
+ if (nbits % 8 != 0)
+ mpz_mod_2exp (s, s, nbits);
+#endif
+}
+
+int
+main (int argc, char *argv[])
+{
+ const char usage[] = "usage: findlc [-dv] m2exp [low_merit [high_merit]]\n";
+ int f;
+ int v_lose, m_lose, v_best, m_best;
+ int c;
+ int debug = 1;
+ int cnt_high_merit;
+ mpz_t m;
+ unsigned long int m2exp;
+#define DIMS 6 /* dimensions run in spectral test */
+ mpf_t v[DIMS-1]; /* spectral test result (there's no v
+ for 1st dimension */
+ mpf_t f_merit, low_merit, high_merit;
+ mpz_t acc, minus8;
+ mpz_t min, max;
+ mpz_t s;
+
+
+ mpz_init (m);
+ mpz_init (a);
+ for (f = 0; f < DIMS-1; f++)
+ mpf_init (v[f]);
+ mpf_init (f_merit);
+ mpf_init_set_d (low_merit, .1);
+ mpf_init_set_d (high_merit, .1);
+
+ while ((c = getopt (argc, argv, "a:di:hv")) != -1)
+ switch (c)
+ {
+ case 'd': /* debug */
+ g_debug++;
+ break;
+
+ case 'v': /* print version */
+ puts (rcsid[1]);
+ exit (0);
+
+ case 'h':
+ case '?':
+ default:
+ fputs (usage, stderr);
+ exit (1);
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc < 1)
+ {
+ fputs (usage, stderr);
+ exit (1);
+ }
+
+ /* Install signal handler. */
+ if (SIG_ERR == signal (SIGSEGV, sh_status))
+ {
+ perror ("signal (SIGSEGV)");
+ exit (1);
+ }
+ if (SIG_ERR == signal (SIGHUP, sh_status))
+ {
+ perror ("signal (SIGHUP)");
+ exit (1);
+ }
+
+ printf ("findlc: version: %s\n", rcsid[1]);
+ m2exp = atol (argv[0]);
+ mpz_init_set_ui (m, 1);
+ mpz_mul_2exp (m, m, m2exp);
+ printf ("m = 0x");
+ mpz_out_str (stdout, 16, m);
+ puts ("");
+
+ if (argc > 1) /* have low_merit */
+ mpf_set_str (low_merit, argv[1], 0);
+ if (argc > 2) /* have high_merit */
+ mpf_set_str (high_merit, argv[2], 0);
+
+ if (debug)
+ {
+ fprintf (stderr, "low_merit = ");
+ mpf_out_str (stderr, 10, 2, low_merit);
+ fprintf (stderr, "; high_merit = ");
+ mpf_out_str (stderr, 10, 2, high_merit);
+ fputs ("\n", stderr);
+ }
+
+ mpz_init (minus8);
+ mpz_set_si (minus8, -8L);
+ mpz_init_set_ui (acc, 0);
+ mpz_init (s);
+ mpz_init_set_d (min, 0.01 * pow (2.0, (double) m2exp));
+ mpz_init_set_d (max, 0.99 * pow (2.0, (double) m2exp));
+
+ mpz_true_random (s, m2exp); /* Start. */
+ mpz_setbit (s, 0); /* Make it odd. */
+
+ v_best = m_best = 2*(DIMS-1);
+ for (;;)
+ {
+ mpz_add (acc, acc, s);
+ mpz_mod_2exp (acc, acc, m2exp);
+#if later
+ mpz_and_si (a, acc, -8L);
+#else
+ mpz_and (a, acc, minus8);
+#endif
+ mpz_add_ui (a, a, 5);
+ if (mpz_cmp (a, min) <= 0 || mpz_cmp (a, max) >= 0)
+ continue;
+
+ spectral_test (v, DIMS, a, m);
+ for (f = 0, v_lose = m_lose = 0, cnt_high_merit = DIMS-1;
+ f < DIMS-1; f++)
+ {
+ merit (f_merit, f + 2, v[f], m);
+
+ if (mpf_cmp_ui (v[f], 1 << (30 / (f + 2) + (f == 2))) < 0)
+ v_lose++;
+
+ if (mpf_cmp (f_merit, low_merit) < 0)
+ m_lose++;
+
+ if (mpf_cmp (f_merit, high_merit) >= 0)
+ cnt_high_merit--;
+ }
+
+ if (0 == v_lose && 0 == m_lose)
+ {
+ mpz_out_str (stdout, 10, a); puts (""); fflush (stdout);
+ if (0 == cnt_high_merit)
+ break; /* leave loop */
+ }
+ if (v_lose < v_best)
+ {
+ v_best = v_lose;
+ printf ("best (v_lose=%d; m_lose=%d): ", v_lose, m_lose);
+ mpz_out_str (stdout, 10, a); puts (""); fflush (stdout);
+ }
+ if (m_lose < m_best)
+ {
+ m_best = m_lose;
+ printf ("best (v_lose=%d; m_lose=%d): ", v_lose, m_lose);
+ mpz_out_str (stdout, 10, a); puts (""); fflush (stdout);
+ }
+ }
+
+ mpz_clear (m);
+ mpz_clear (a);
+ for (f = 0; f < DIMS-1; f++)
+ mpf_clear (v[f]);
+ mpf_clear (f_merit);
+ mpf_clear (low_merit);
+ mpf_clear (high_merit);
+
+ printf ("done.\n");
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/rand/gen.c b/vendor/gmp-6.3.0/tests/rand/gen.c
new file mode 100644
index 0000000..c8e6c67
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/rand/gen.c
@@ -0,0 +1,480 @@
+/* gen.c -- Generate pseudorandom numbers.
+
+Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+/* Examples:
+
+ $ gen 10
+10 integers 0 <= X < 2^32 generated by mpz_urandomb()
+
+ $ gen -f mpf_urandomb 10
+10 real numbers 0 <= X < 1
+
+ $ gen -z 127 10
+10 integers 0 <= X < 2^127
+
+ $ gen -f mpf_urandomb -x .9,1 10
+10 real numbers 0 <= X < .9
+
+ $ gen -s 1 10
+10 integers, sequence seeded with 1
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <limits.h>
+#include <errno.h>
+#include <time.h>
+#include <string.h>
+
+#if !HAVE_DECL_OPTARG
+extern char *optarg;
+extern int optind, opterr;
+#endif
+
+#include "gmp-impl.h"
+
+int main (argc, argv)
+ int argc;
+ char *argv[];
+{
+ const char usage[] =
+ "usage: gen [-bhpq] [-a n] [-c a,c,m2exp] [-C a,c,m] [-f func] [-g alg] [-m n] [-s n] " \
+ "[-x f,t] [-z n] [n]\n" \
+ " n number of random numbers to generate\n" \
+ " -a n ASCII output in radix n (default, with n=10)\n" \
+ " -b binary output\n" \
+ " -c a,c,m2exp use supplied LC scheme\n" \
+ " -f func random function, one of\n" \
+ " mpz_urandomb (default), mpz_urandomm, mpf_urandomb, rand, random\n" \
+ " -g alg algorithm, one of mt (default), lc\n" \
+ " -h print this text and exit\n" \
+ " -m n maximum size of generated number plus 1 (0<= X < n) for mpz_urandomm\n" \
+ " -p print used seed on stderr\n" \
+ " -q quiet, no output\n" \
+ " -s n initial seed (default: output from time(3))\n" \
+ " -x f,t exclude all numbers f <= x <= t\n" \
+ " -z n size in bits of generated numbers (0<= X <2^n) (default 32)\n" \
+ "";
+
+ unsigned long int f;
+ unsigned long int n = 0;
+ unsigned long int seed;
+ unsigned long int m2exp = 0;
+ unsigned int size = 32;
+ int seed_from_user = 0;
+ int ascout = 1, binout = 0, printseed = 0;
+ int output_radix = 10;
+ int lc_scheme_from_user = 0;
+ int quiet_flag = 0;
+ mpz_t z_seed;
+ mpz_t z1;
+ mpf_t f1;
+ gmp_randstate_t rstate;
+ int c, i;
+ double drand;
+ long lrand;
+ int do_exclude = 0;
+ mpf_t f_xf, f_xt; /* numbers to exclude from sequence */
+ char *str_xf, *str_xt; /* numbers to exclude from sequence */
+ char *str_a, *str_adder, *str_m;
+ mpz_t z_a, z_m, z_mmax;
+ unsigned long int ul_adder;
+
+ enum
+ {
+ RFUNC_mpz_urandomb = 0,
+ RFUNC_mpz_urandomm,
+ RFUNC_mpf_urandomb,
+ RFUNC_rand,
+ RFUNC_random,
+ } rfunc = RFUNC_mpz_urandomb;
+ char *rfunc_str[] = { "mpz_urandomb", "mpz_urandomm", "mpf_urandomb",
+ "rand", "random" };
+ enum
+ {
+ RNG_MT = 0,
+ RNG_LC
+ };
+ gmp_randalg_t ralg = RNG_MT;
+ /* Texts for the algorithms. The index of each must match the
+ corresponding algorithm in the enum above. */
+ char *ralg_str[] = { "mt", "lc" };
+
+ mpf_init (f_xf);
+ mpf_init (f_xt);
+ mpf_init (f1);
+ mpz_init (z1);
+ mpz_init (z_seed);
+ mpz_init_set_ui (z_mmax, 0);
+
+
+ while ((c = getopt (argc, argv, "a:bc:f:g:hm:n:pqs:z:x:")) != -1)
+ switch (c)
+ {
+ case 'a':
+ ascout = 1;
+ binout = 0;
+ output_radix = atoi (optarg);
+ break;
+
+ case 'b':
+ ascout = 0;
+ binout = 1;
+ break;
+
+ case 'c': /* User supplied LC scheme: a,c,m2exp */
+ if (NULL == (str_a = strtok (optarg, ","))
+ || NULL == (str_adder = strtok (NULL, ","))
+ || NULL == (str_m = strtok (NULL, ",")))
+ {
+ fprintf (stderr, "gen: bad LC scheme parameters: %s\n", optarg);
+ exit (1);
+ }
+#ifdef HAVE_STRTOUL
+ ul_adder = strtoul (str_adder, NULL, 0);
+#elif HAVE_STRTOL
+ ul_adder = (unsigned long int) strtol (str_adder, NULL, 0);
+#else
+ ul_adder = (unsigned long int) atoi (str_adder);
+#endif
+
+ if (mpz_init_set_str (z_a, str_a, 0))
+ {
+ fprintf (stderr, "gen: bad LC scheme parameter `a': %s\n", str_a);
+ exit (1);
+ }
+ if (ULONG_MAX == ul_adder)
+ {
+ fprintf (stderr, "gen: bad LC scheme parameter `c': %s\n",
+ str_adder);
+ exit (1);
+ }
+ m2exp = atol (str_m);
+
+ lc_scheme_from_user = 1;
+ break;
+
+
+ case 'f':
+ rfunc = -1;
+ for (f = 0; f < sizeof (rfunc_str) / sizeof (*rfunc_str); f++)
+ if (!strcmp (optarg, rfunc_str[f]))
+ {
+ rfunc = f;
+ break;
+ }
+ if (rfunc == -1)
+ {
+ fputs (usage, stderr);
+ exit (1);
+ }
+ break;
+
+ case 'g': /* algorithm */
+ ralg = -1;
+ for (f = 0; f < sizeof (ralg_str) / sizeof (*ralg_str); f++)
+ if (!strcmp (optarg, ralg_str[f]))
+ {
+ ralg = f;
+ break;
+ }
+ if (ralg == -1)
+ {
+ fputs (usage, stderr);
+ exit (1);
+ }
+ break;
+
+ case 'm': /* max for mpz_urandomm() */
+ if (mpz_set_str (z_mmax, optarg, 0))
+ {
+ fprintf (stderr, "gen: bad max value: %s\n", optarg);
+ exit (1);
+ }
+ break;
+
+ case 'p': /* print seed on stderr */
+ printseed = 1;
+ break;
+
+ case 'q': /* quiet */
+ quiet_flag = 1;
+ break;
+
+ case 's': /* user provided seed */
+ if (mpz_set_str (z_seed, optarg, 0))
+ {
+ fprintf (stderr, "gen: bad seed argument %s\n", optarg);
+ exit (1);
+ }
+ seed_from_user = 1;
+ break;
+
+ case 'z':
+ size = atoi (optarg);
+ if (size < 1)
+ {
+ fprintf (stderr, "gen: bad size argument (-z %u)\n", size);
+ exit (1);
+ }
+ break;
+
+ case 'x': /* Exclude. from,to */
+ str_xf = optarg;
+ str_xt = strchr (optarg, ',');
+ if (NULL == str_xt)
+ {
+ fprintf (stderr, "gen: bad exclusion parameters: %s\n", optarg);
+ exit (1);
+ }
+ *str_xt++ = '\0';
+ do_exclude = 1;
+ break;
+
+ case 'h':
+ case '?':
+ default:
+ fputs (usage, stderr);
+ exit (1);
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (! seed_from_user)
+ mpz_set_ui (z_seed, (unsigned long int) time (NULL));
+ seed = mpz_get_ui (z_seed);
+ if (printseed)
+ {
+ fprintf (stderr, "gen: seed used: ");
+ mpz_out_str (stderr, output_radix, z_seed);
+ fprintf (stderr, "\n");
+ }
+
+ mpf_set_prec (f1, size);
+
+ /* init random state and plant seed */
+ switch (rfunc)
+ {
+ case RFUNC_mpf_urandomb:
+#if 0
+ /* Don't init a too small generator. */
+ size = PREC (f1) * GMP_LIMB_BITS;
+ /* Fall through. */
+#endif
+ case RFUNC_mpz_urandomb:
+ case RFUNC_mpz_urandomm:
+ switch (ralg)
+ {
+ case RNG_MT:
+ gmp_randinit_mt (rstate);
+ break;
+
+ case RNG_LC:
+ if (! lc_scheme_from_user)
+ gmp_randinit_lc_2exp_size (rstate, MIN (128, size));
+ else
+ gmp_randinit_lc_2exp (rstate, z_a, ul_adder, m2exp);
+ break;
+
+ default:
+ fprintf (stderr, "gen: unsupported algorithm\n");
+ exit (1);
+ }
+
+ gmp_randseed (rstate, z_seed);
+ break;
+
+ case RFUNC_rand:
+ srand (seed);
+ break;
+
+ case RFUNC_random:
+#ifdef __FreeBSD__ /* FIXME */
+ if (seed_from_user)
+ srandom (seed);
+ else
+ srandomdev ();
+#else
+ fprintf (stderr, "gen: unsupported algorithm\n");
+#endif
+ break;
+
+ default:
+ fprintf (stderr, "gen: random function not implemented\n");
+ exit (1);
+ }
+
+ /* set up excludes */
+ if (do_exclude)
+ switch (rfunc)
+ {
+ case RFUNC_mpf_urandomb:
+
+ if (mpf_set_str (f_xf, str_xf, 10) ||
+ mpf_set_str (f_xt, str_xt, 10))
+ {
+ fprintf (stderr, "gen: bad exclusion-from (\"%s\") " \
+ "or exclusion-to (\"%s\") string. no exclusion done.\n",
+ str_xf, str_xt);
+ do_exclude = 0;
+ }
+ break;
+
+ default:
+ fprintf (stderr, "gen: exclusion not implemented for chosen " \
+ "randomization function. all numbers included in sequence.\n");
+ }
+
+ /* generate and print */
+ if (argc > 0)
+ {
+#if HAVE_STRTOUL
+ n = strtoul (argv[0], (char **) NULL, 10);
+#elif HAVE_STRTOL
+ n = (unsigned long int) strtol (argv[0], (char **) NULL, 10);
+#else
+ n = (unsigned long int) atoi (argv[0]);
+#endif
+ }
+
+ for (f = 0; n == 0 || f < n; f++)
+ {
+ switch (rfunc)
+ {
+ case RFUNC_mpz_urandomb:
+ mpz_urandomb (z1, rstate, size);
+ if (quiet_flag)
+ break;
+ if (binout)
+ {
+ /*fwrite ((unsigned int *) z1->_mp_d, 4, 1, stdout);*/
+ fprintf (stderr, "gen: binary output for mpz_urandom* is broken\n");
+ exit (1);
+ }
+ else
+ {
+ mpz_out_str (stdout, output_radix, z1);
+ puts ("");
+ }
+ break;
+
+ case RFUNC_mpz_urandomm:
+ mpz_urandomm (z1, rstate, z_mmax);
+ if (quiet_flag)
+ break;
+ if (binout)
+ {
+ /*fwrite ((unsigned int *) z1->_mp_d, 4, 1, stdout);*/
+ fprintf (stderr, "gen: binary output for mpz_urandom* is broken\n");
+ exit (1);
+ }
+ else
+ {
+ mpz_out_str (stdout, output_radix, z1);
+ puts ("");
+ }
+ break;
+
+ case RFUNC_mpf_urandomb:
+ mpf_urandomb (f1, rstate, size);
+ if (do_exclude)
+ if (mpf_cmp (f1, f_xf) >= 0 && mpf_cmp (f1, f_xt) <= 0)
+ break;
+ if (quiet_flag)
+ break;
+ if (binout)
+ {
+ fprintf (stderr, "gen: binary output for floating point numbers "\
+ "not implemented\n");
+ exit (1);
+ }
+ else
+ {
+ mpf_out_str (stdout, output_radix, 0, f1);
+ puts ("");
+ }
+ break;
+
+ case RFUNC_rand:
+ i = rand ();
+#ifdef FLOAT_OUTPUT
+ if (i)
+ drand = (double) i / (double) RAND_MAX;
+ else
+ drand = 0.0;
+ if (quiet_flag)
+ break;
+ if (binout)
+ fwrite (&drand, sizeof (drand), 1, stdout);
+ else
+ printf ("%e\n", drand);
+#else
+ if (quiet_flag)
+ break;
+ if (binout)
+ fwrite (&i, sizeof (i), 1, stdout);
+ else
+ printf ("%d\n", i);
+#endif
+ break;
+
+ case RFUNC_random:
+ lrand = random ();
+ if (lrand)
+ drand = (double) lrand / (double) 0x7fffffff;
+ else
+ drand = 0;
+ if (quiet_flag)
+ break;
+ if (binout)
+ fwrite (&drand, sizeof (drand), 1, stdout);
+ else
+ printf ("%e\n", drand);
+ break;
+
+ default:
+ fprintf (stderr, "gen: random function not implemented\n");
+ exit (1);
+ }
+
+ }
+
+ /* clean up */
+ switch (rfunc)
+ {
+ case RFUNC_mpz_urandomb:
+ case RFUNC_mpf_urandomb:
+ gmp_randclear (rstate);
+ break;
+ default:
+ break;
+ }
+ mpf_clear (f1);
+ mpf_clear (f_xf);
+ mpf_clear (f_xt);
+ mpz_clear (z1);
+ mpz_clear (z_seed);
+
+ return 0;
+}
+
+static void *debug_dummyz = mpz_dump;
+static void *debug_dummyf = mpf_dump;
diff --git a/vendor/gmp-6.3.0/tests/rand/gmpstat.h b/vendor/gmp-6.3.0/tests/rand/gmpstat.h
new file mode 100644
index 0000000..99c5cca
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/rand/gmpstat.h
@@ -0,0 +1,75 @@
+/* gmpstat.h */
+
+/*
+Copyright 1999 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+/* This file requires the following header files: gmp.h */
+
+#ifndef __GMPSTAT_H__
+#define __GMPSTAT_H__
+
+/* Global debug flag. FIXME: Remove. */
+extern int g_debug;
+#define DEBUG_1 0
+#define DEBUG_2 1
+
+/* Max number of dimensions in spectral test. FIXME: Makw dynamic. */
+#define GMP_SPECT_MAXT 10
+
+void
+mpf_freqt (mpf_t Kp,
+ mpf_t Km,
+ mpf_t X[],
+ const unsigned long int n);
+unsigned long int
+mpz_freqt (mpf_t V,
+ mpz_t X[],
+ unsigned int imax,
+ const unsigned long int n);
+
+/* Low level functions. */
+void
+ks (mpf_t Kp,
+ mpf_t Km,
+ mpf_t X[],
+ void (P) (mpf_t, mpf_t),
+ const unsigned long int n);
+
+void
+ks_table (mpf_t p, mpf_t val, const unsigned int n);
+
+void
+x2_table (double t[],
+ unsigned int v);
+
+void
+spectral_test (mpf_t rop[], unsigned int T, mpz_t a, mpz_t m);
+void
+vz_dot (mpz_t rop, mpz_t V1[], mpz_t V2[], unsigned int n);
+void
+f_floor (mpf_t rop, mpf_t op);
+
+void
+merit (mpf_t rop, unsigned int t, mpf_t v, mpz_t m);
+double
+merit_u (unsigned int t, mpf_t v, mpz_t m);
+
+/* From separate source files: */
+void zdiv_round (mpz_t rop, mpz_t n, mpz_t d);
+
+#endif /* !__GMPSTAT_H__ */
diff --git a/vendor/gmp-6.3.0/tests/rand/spect.c b/vendor/gmp-6.3.0/tests/rand/spect.c
new file mode 100644
index 0000000..64de5a0
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/rand/spect.c
@@ -0,0 +1,136 @@
+/* spect.c -- the spectral test */
+
+/*
+Copyright 1999 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+/* T is upper dimension. Z_A is the LC multiplier, which is
+ relatively prime to Z_M, the LC modulus. The result is put in
+ rop[] with v[t] in rop[t-2]. */
+
+/* BUGS: Due to lazy allocation scheme, maximum T is hard coded to MAXT. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <math.h>
+
+#include "gmpstat.h"
+
+int g_debug = 0;
+
+int
+main (int argc, char *argv[])
+{
+ const char usage[] = "usage: spect [-d] a m n\n";
+ int c;
+ unsigned int n;
+ mpz_t a, m;
+ mpf_t res[GMP_SPECT_MAXT], res_min[GMP_SPECT_MAXT], f_tmp;
+ int f;
+
+
+ mpz_init (a);
+ mpz_init (m);
+ for (f = 0; f < GMP_SPECT_MAXT; f++)
+ {
+ mpf_init (res[f]);
+ mpf_init (res_min[f]);
+ }
+ mpf_init (f_tmp);
+ mpf_set_ui (res_min[0], 32768); /* 2^15 */
+ mpf_set_ui (res_min[1], 1024); /* 2^10 */
+ mpf_set_ui (res_min[2], 256); /* 2^8 */
+ mpf_set_ui (res_min[3], 64); /* 2^6 */
+ mpf_set_ui (res_min[4], 32); /* 2^5 */
+
+ while ((c = getopt (argc, argv, "dh")) != -1)
+ switch (c)
+ {
+ case 'd': /* debug */
+ g_debug++;
+ break;
+ case 'h':
+ default:
+ fputs (usage, stderr);
+ exit (1);
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc < 3)
+ {
+ fputs (usage, stderr);
+ exit (1);
+ }
+
+ mpz_set_str (a, argv[0], 0);
+ mpz_set_str (m, argv[1], 0);
+ n = (unsigned int) atoi (argv[2]);
+ if (n + 1 > GMP_SPECT_MAXT)
+ n = GMP_SPECT_MAXT + 1;
+
+ spectral_test (res, n, a, m);
+
+ for (f = 0; f < n - 1; f++)
+ {
+ /* print v */
+ printf ("%d: v = ", f + 2);
+ mpf_out_str (stdout, 10, 4, res[f]);
+
+#ifdef PRINT_RAISED_BY_TWO_AS_WELL
+ printf (" (^2 = ");
+ mpf_mul (f_tmp, res[f], res[f]);
+ mpf_out_str (stdout, 10, 4, f_tmp);
+ printf (")");
+#endif /* PRINT_RAISED_BY_TWO_AS_WELL */
+
+ /* print merit */
+ printf (" m = ");
+ merit (f_tmp, f + 2, res[f], m);
+ mpf_out_str (stdout, 10, 4, f_tmp);
+
+ if (mpf_cmp (res[f], res_min[f]) < 0)
+ printf ("\t*** v too low ***");
+ if (mpf_get_d (f_tmp) < .1)
+ printf ("\t*** merit too low ***");
+
+ puts ("");
+ }
+
+ mpz_clear (a);
+ mpz_clear (m);
+ for (f = 0; f < GMP_SPECT_MAXT; f++)
+ {
+ mpf_clear (res[f]);
+ mpf_clear (res_min[f]);
+ }
+ mpf_clear (f_tmp);
+
+ return 0;
+}
+
+
+void
+debug_foo()
+{
+ if (0)
+ {
+ mpz_dump (0);
+ mpf_dump (0);
+ }
+}
diff --git a/vendor/gmp-6.3.0/tests/rand/stat.c b/vendor/gmp-6.3.0/tests/rand/stat.c
new file mode 100644
index 0000000..fa06f4c
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/rand/stat.c
@@ -0,0 +1,406 @@
+/* stat.c -- statistical tests of random number sequences. */
+
+/*
+Copyright 1999, 2000 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+/* Examples:
+
+ $ gen 1000 | stat
+Test 1000 real numbers.
+
+ $ gen 30000 | stat -2 1000
+Test 1000 real numbers 30 times and then test the 30 results in a
+``second level''.
+
+ $ gen -f mpz_urandomb 1000 | stat -i 0xffffffff
+Test 1000 integers 0 <= X <= 2^32-1.
+
+ $ gen -f mpz_urandomb -z 34 1000 | stat -i 0x3ffffffff
+Test 1000 integers 0 <= X <= 2^34-1.
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <math.h>
+#include "gmpstat.h"
+
+#if !HAVE_DECL_OPTARG
+extern char *optarg;
+extern int optind, opterr;
+#endif
+
+#define FVECSIZ (100000L)
+
+int g_debug = 0;
+
+static void
+print_ks_results (mpf_t f_p, mpf_t f_p_prob,
+ mpf_t f_m, mpf_t f_m_prob,
+ FILE *fp)
+{
+ double p, pp, m, mp;
+
+ p = mpf_get_d (f_p);
+ m = mpf_get_d (f_m);
+ pp = mpf_get_d (f_p_prob);
+ mp = mpf_get_d (f_m_prob);
+
+ fprintf (fp, "%.4f (%.0f%%)\t", p, pp * 100.0);
+ fprintf (fp, "%.4f (%.0f%%)\n", m, mp * 100.0);
+}
+
+static void
+print_x2_table (unsigned int v, FILE *fp)
+{
+ double t[7];
+ int f;
+
+
+ fprintf (fp, "Chi-square table for v=%u\n", v);
+ fprintf (fp, "1%%\t5%%\t25%%\t50%%\t75%%\t95%%\t99%%\n");
+ x2_table (t, v);
+ for (f = 0; f < 7; f++)
+ fprintf (fp, "%.2f\t", t[f]);
+ fputs ("\n", fp);
+}
+
+
+
+/* Pks () -- Distribution function for KS results with a big n (like 1000
+ or so): F(x) = 1 - pow(e, -2*x^2) [Knuth, vol 2, p.51]. */
+/* gnuplot: plot [0:1] Pks(x), Pks(x) = 1-exp(-2*x**2) */
+
+static void
+Pks (mpf_t p, mpf_t x)
+{
+ double dt; /* temp double */
+
+ mpf_set (p, x);
+ mpf_mul (p, p, p); /* p = x^2 */
+ mpf_mul_ui (p, p, 2); /* p = 2*x^2 */
+ mpf_neg (p, p); /* p = -2*x^2 */
+ /* No pow() in gmp. Use doubles. */
+ /* FIXME: Use exp()? */
+ dt = pow (M_E, mpf_get_d (p));
+ mpf_set_d (p, dt);
+ mpf_ui_sub (p, 1, p);
+}
+
+/* f_freq() -- frequency test on real numbers 0<=f<1*/
+static void
+f_freq (const unsigned l1runs, const unsigned l2runs,
+ mpf_t fvec[], const unsigned long n)
+{
+ unsigned f;
+ mpf_t f_p, f_p_prob;
+ mpf_t f_m, f_m_prob;
+ mpf_t *l1res; /* level 1 result array */
+
+ mpf_init (f_p); mpf_init (f_m);
+ mpf_init (f_p_prob); mpf_init (f_m_prob);
+
+
+ /* Allocate space for 1st level results. */
+ l1res = (mpf_t *) malloc (l2runs * 2 * sizeof (mpf_t));
+ if (NULL == l1res)
+ {
+ fprintf (stderr, "stat: malloc failure\n");
+ exit (1);
+ }
+
+ printf ("\nEquidistribution/Frequency test on real numbers (0<=X<1):\n");
+ printf ("\tKp\t\tKm\n");
+
+ for (f = 0; f < l2runs; f++)
+ {
+ /* f_printvec (fvec, n); */
+ mpf_freqt (f_p, f_m, fvec + f * n, n);
+
+ /* what's the probability of getting these results? */
+ ks_table (f_p_prob, f_p, n);
+ ks_table (f_m_prob, f_m, n);
+
+ if (l1runs == 0)
+ {
+ /*printf ("%u:\t", f + 1);*/
+ print_ks_results (f_p, f_p_prob, f_m, f_m_prob, stdout);
+ }
+ else
+ {
+ /* save result */
+ mpf_init_set (l1res[f], f_p);
+ mpf_init_set (l1res[f + l2runs], f_m);
+ }
+ }
+
+ /* Now, apply the KS test on the results from the 1st level rounds
+ with the distribution
+ F(x) = 1 - pow(e, -2*x^2) [Knuth, vol 2, p.51] */
+
+ if (l1runs != 0)
+ {
+ /*printf ("-------------------------------------\n");*/
+
+ /* The Kp's. */
+ ks (f_p, f_m, l1res, Pks, l2runs);
+ ks_table (f_p_prob, f_p, l2runs);
+ ks_table (f_m_prob, f_m, l2runs);
+ printf ("Kp:\t");
+ print_ks_results (f_p, f_p_prob, f_m, f_m_prob, stdout);
+
+ /* The Km's. */
+ ks (f_p, f_m, l1res + l2runs, Pks, l2runs);
+ ks_table (f_p_prob, f_p, l2runs);
+ ks_table (f_m_prob, f_m, l2runs);
+ printf ("Km:\t");
+ print_ks_results (f_p, f_p_prob, f_m, f_m_prob, stdout);
+ }
+
+ mpf_clear (f_p); mpf_clear (f_m);
+ mpf_clear (f_p_prob); mpf_clear (f_m_prob);
+ free (l1res);
+}
+
+/* z_freq(l1runs, l2runs, zvec, n, max) -- frequency test on integers
+ 0<=z<=MAX */
+static void
+z_freq (const unsigned l1runs,
+ const unsigned l2runs,
+ mpz_t zvec[],
+ const unsigned long n,
+ unsigned int max)
+{
+ mpf_t V; /* result */
+ double d_V; /* result as a double */
+
+ mpf_init (V);
+
+
+ printf ("\nEquidistribution/Frequency test on integers (0<=X<=%u):\n", max);
+ print_x2_table (max, stdout);
+
+ mpz_freqt (V, zvec, max, n);
+
+ d_V = mpf_get_d (V);
+ printf ("V = %.2f (n = %lu)\n", d_V, n);
+
+ mpf_clear (V);
+}
+
+unsigned int stat_debug = 0;
+
+int
+main (argc, argv)
+ int argc;
+ char *argv[];
+{
+ const char usage[] =
+ "usage: stat [-d] [-2 runs] [-i max | -r max] [file]\n" \
+ " file filename\n" \
+ " -2 runs perform 2-level test with RUNS runs on 1st level\n" \
+ " -d increase debugging level\n" \
+ " -i max input is integers 0 <= Z <= MAX\n" \
+ " -r max input is real numbers 0 <= R < 1 and use MAX as\n" \
+ " maximum value when converting real numbers to integers\n" \
+ "";
+
+ mpf_t fvec[FVECSIZ];
+ mpz_t zvec[FVECSIZ];
+ unsigned long int f, n, vecentries;
+ char *filen;
+ FILE *fp;
+ int c;
+ int omitoutput = 0;
+ int realinput = -1; /* 1: input is real numbers 0<=R<1;
+ 0: input is integers 0 <= Z <= MAX. */
+ long l1runs = 0, /* 1st level runs */
+ l2runs = 1; /* 2nd level runs */
+ mpf_t f_temp;
+ mpz_t z_imax; /* max value when converting between
+ real number and integer. */
+ mpf_t f_imax_plus1; /* f_imax + 1 stored in an mpf_t for
+ convenience */
+ mpf_t f_imax_minus1; /* f_imax - 1 stored in an mpf_t for
+ convenience */
+
+
+ mpf_init (f_temp);
+ mpz_init_set_ui (z_imax, 0x7fffffff);
+ mpf_init (f_imax_plus1);
+ mpf_init (f_imax_minus1);
+
+ while ((c = getopt (argc, argv, "d2:i:r:")) != -1)
+ switch (c)
+ {
+ case '2':
+ l1runs = atol (optarg);
+ l2runs = -1; /* set later on */
+ break;
+ case 'd': /* increase debug level */
+ stat_debug++;
+ break;
+ case 'i':
+ if (1 == realinput)
+ {
+ fputs ("stat: options -i and -r are mutually exclusive\n", stderr);
+ exit (1);
+ }
+ if (mpz_set_str (z_imax, optarg, 0))
+ {
+ fprintf (stderr, "stat: bad max value %s\n", optarg);
+ exit (1);
+ }
+ realinput = 0;
+ break;
+ case 'r':
+ if (0 == realinput)
+ {
+ fputs ("stat: options -i and -r are mutually exclusive\n", stderr);
+ exit (1);
+ }
+ if (mpz_set_str (z_imax, optarg, 0))
+ {
+ fprintf (stderr, "stat: bad max value %s\n", optarg);
+ exit (1);
+ }
+ realinput = 1;
+ break;
+ case 'o':
+ omitoutput = atoi (optarg);
+ break;
+ case '?':
+ default:
+ fputs (usage, stderr);
+ exit (1);
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc < 1)
+ fp = stdin;
+ else
+ filen = argv[0];
+
+ if (fp != stdin)
+ if (NULL == (fp = fopen (filen, "r")))
+ {
+ perror (filen);
+ exit (1);
+ }
+
+ if (-1 == realinput)
+ realinput = 1; /* default is real numbers */
+
+ /* read file and fill appropriate vec */
+ if (1 == realinput) /* real input */
+ {
+ for (f = 0; f < FVECSIZ ; f++)
+ {
+ mpf_init (fvec[f]);
+ if (!mpf_inp_str (fvec[f], fp, 10))
+ break;
+ }
+ }
+ else /* integer input */
+ {
+ for (f = 0; f < FVECSIZ ; f++)
+ {
+ mpz_init (zvec[f]);
+ if (!mpz_inp_str (zvec[f], fp, 10))
+ break;
+ }
+ }
+ vecentries = n = f; /* number of entries read */
+ fclose (fp);
+
+ if (FVECSIZ == f)
+ fprintf (stderr, "stat: warning: discarding input due to lazy allocation "\
+ "of only %ld entries. sorry.\n", FVECSIZ);
+
+ printf ("Got %lu numbers.\n", n);
+
+ /* convert and fill the other vec */
+ /* since fvec[] contains 0<=f<1 and we want ivec[] to contain
+ 0<=z<=imax and we are truncating all fractions when
+ converting float to int, we have to add 1 to imax.*/
+ mpf_set_z (f_imax_plus1, z_imax);
+ mpf_add_ui (f_imax_plus1, f_imax_plus1, 1);
+ if (1 == realinput) /* fill zvec[] */
+ {
+ for (f = 0; f < n; f++)
+ {
+ mpf_mul (f_temp, fvec[f], f_imax_plus1);
+ mpz_init (zvec[f]);
+ mpz_set_f (zvec[f], f_temp); /* truncating fraction */
+ if (stat_debug > 1)
+ {
+ mpz_out_str (stderr, 10, zvec[f]);
+ fputs ("\n", stderr);
+ }
+ }
+ }
+ else /* integer input; fill fvec[] */
+ {
+ /* mpf_set_z (f_imax_minus1, z_imax);
+ mpf_sub_ui (f_imax_minus1, f_imax_minus1, 1);*/
+ for (f = 0; f < n; f++)
+ {
+ mpf_init (fvec[f]);
+ mpf_set_z (fvec[f], zvec[f]);
+ mpf_div (fvec[f], fvec[f], f_imax_plus1);
+ if (stat_debug > 1)
+ {
+ mpf_out_str (stderr, 10, 0, fvec[f]);
+ fputs ("\n", stderr);
+ }
+ }
+ }
+
+ /* 2 levels? */
+ if (1 != l2runs)
+ {
+ l2runs = n / l1runs;
+ printf ("Doing %ld second level rounds "\
+ "with %ld entries in each round", l2runs, l1runs);
+ if (n % l1runs)
+ printf (" (discarding %ld entr%s)", n % l1runs,
+ n % l1runs == 1 ? "y" : "ies");
+ puts (".");
+ n = l1runs;
+ }
+
+#ifndef DONT_FFREQ
+ f_freq (l1runs, l2runs, fvec, n);
+#endif
+#ifdef DO_ZFREQ
+ z_freq (l1runs, l2runs, zvec, n, mpz_get_ui (z_imax));
+#endif
+
+ mpf_clear (f_temp); mpz_clear (z_imax);
+ mpf_clear (f_imax_plus1);
+ mpf_clear (f_imax_minus1);
+ for (f = 0; f < vecentries; f++)
+ {
+ mpf_clear (fvec[f]);
+ mpz_clear (zvec[f]);
+ }
+
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/rand/statlib.c b/vendor/gmp-6.3.0/tests/rand/statlib.c
new file mode 100644
index 0000000..db05380
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/rand/statlib.c
@@ -0,0 +1,836 @@
+/* statlib.c -- Statistical functions for testing the randomness of
+ number sequences. */
+
+/*
+Copyright 1999, 2000 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+/* The theories for these functions are taken from D. Knuth's "The Art
+of Computer Programming: Volume 2, Seminumerical Algorithms", Third
+Edition, Addison Wesley, 1998. */
+
+/* Implementation notes.
+
+The Kolmogorov-Smirnov test.
+
+Eq. (13) in Knuth, p. 50, says that if X1, X2, ..., Xn are independent
+observations arranged into ascending order
+
+ Kp = sqr(n) * max(j/n - F(Xj)) for all 1<=j<=n
+ Km = sqr(n) * max(F(Xj) - (j-1)/n)) for all 1<=j<=n
+
+where F(x) = Pr(X <= x) = probability that (X <= x), which for a
+uniformly distributed random real number between zero and one is
+exactly the number itself (x).
+
+
+The answer to exercise 23 gives the following implementation, which
+doesn't need the observations to be sorted in ascending order:
+
+for (k = 0; k < m; k++)
+ a[k] = 1.0
+ b[k] = 0.0
+ c[k] = 0
+
+for (each observation Xj)
+ Y = F(Xj)
+ k = floor (m * Y)
+ a[k] = min (a[k], Y)
+ b[k] = max (b[k], Y)
+ c[k] += 1
+
+ j = 0
+ rp = rm = 0
+ for (k = 0; k < m; k++)
+ if (c[k] > 0)
+ rm = max (rm, a[k] - j/n)
+ j += c[k]
+ rp = max (rp, j/n - b[k])
+
+Kp = sqr (n) * rp
+Km = sqr (n) * rm
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include "gmpstat.h"
+
+/* ks (Kp, Km, X, P, n) -- Perform a Kolmogorov-Smirnov test on the N
+ real numbers between zero and one in vector X. P is the
+ distribution function, called for each entry in X, which should
+ calculate the probability of X being greater than or equal to any
+ number in the sequence. (For a uniformly distributed sequence of
+ real numbers between zero and one, this is simply equal to X.) The
+ result is put in Kp and Km. */
+
+void
+ks (mpf_t Kp,
+ mpf_t Km,
+ mpf_t X[],
+ void (P) (mpf_t, mpf_t),
+ unsigned long int n)
+{
+ mpf_t Kt; /* temp */
+ mpf_t f_x;
+ mpf_t f_j; /* j */
+ mpf_t f_jnq; /* j/n or (j-1)/n */
+ unsigned long int j;
+
+ /* Sort the vector in ascending order. */
+ qsort (X, n, sizeof (__mpf_struct), mpf_cmp);
+
+ /* K-S test. */
+ /* Kp = sqr(n) * max(j/n - F(Xj)) for all 1<=j<=n
+ Km = sqr(n) * max(F(Xj) - (j-1)/n)) for all 1<=j<=n
+ */
+
+ mpf_init (Kt); mpf_init (f_x); mpf_init (f_j); mpf_init (f_jnq);
+ mpf_set_ui (Kp, 0); mpf_set_ui (Km, 0);
+ for (j = 1; j <= n; j++)
+ {
+ P (f_x, X[j-1]);
+ mpf_set_ui (f_j, j);
+
+ mpf_div_ui (f_jnq, f_j, n);
+ mpf_sub (Kt, f_jnq, f_x);
+ if (mpf_cmp (Kt, Kp) > 0)
+ mpf_set (Kp, Kt);
+ if (g_debug > DEBUG_2)
+ {
+ printf ("j=%lu ", j);
+ printf ("P()="); mpf_out_str (stdout, 10, 2, f_x); printf ("\t");
+
+ printf ("jnq="); mpf_out_str (stdout, 10, 2, f_jnq); printf (" ");
+ printf ("diff="); mpf_out_str (stdout, 10, 2, Kt); printf (" ");
+ printf ("Kp="); mpf_out_str (stdout, 10, 2, Kp); printf ("\t");
+ }
+ mpf_sub_ui (f_j, f_j, 1);
+ mpf_div_ui (f_jnq, f_j, n);
+ mpf_sub (Kt, f_x, f_jnq);
+ if (mpf_cmp (Kt, Km) > 0)
+ mpf_set (Km, Kt);
+
+ if (g_debug > DEBUG_2)
+ {
+ printf ("jnq="); mpf_out_str (stdout, 10, 2, f_jnq); printf (" ");
+ printf ("diff="); mpf_out_str (stdout, 10, 2, Kt); printf (" ");
+ printf ("Km="); mpf_out_str (stdout, 10, 2, Km); printf (" ");
+ printf ("\n");
+ }
+ }
+ mpf_sqrt_ui (Kt, n);
+ mpf_mul (Kp, Kp, Kt);
+ mpf_mul (Km, Km, Kt);
+
+ mpf_clear (Kt); mpf_clear (f_x); mpf_clear (f_j); mpf_clear (f_jnq);
+}
+
+/* ks_table(val, n) -- calculate probability for Kp/Km less than or
+ equal to VAL with N observations. See [Knuth section 3.3.1] */
+
+void
+ks_table (mpf_t p, mpf_t val, const unsigned int n)
+{
+ /* We use Eq. (27), Knuth p.58, skipping O(1/n) for simplicity.
+ This shortcut will result in too high probabilities, especially
+ when n is small.
+
+ Pr(Kp(n) <= s) = 1 - pow(e, -2*s^2) * (1 - 2/3*s/sqrt(n) + O(1/n)) */
+
+ /* We have 's' in variable VAL and store the result in P. */
+
+ mpf_t t1, t2;
+
+ mpf_init (t1); mpf_init (t2);
+
+ /* t1 = 1 - 2/3 * s/sqrt(n) */
+ mpf_sqrt_ui (t1, n);
+ mpf_div (t1, val, t1);
+ mpf_mul_ui (t1, t1, 2);
+ mpf_div_ui (t1, t1, 3);
+ mpf_ui_sub (t1, 1, t1);
+
+ /* t2 = pow(e, -2*s^2) */
+#ifndef OLDGMP
+ mpf_pow_ui (t2, val, 2); /* t2 = s^2 */
+ mpf_set_d (t2, exp (-(2.0 * mpf_get_d (t2))));
+#else
+ /* hmmm, gmp doesn't have pow() for floats. use doubles. */
+ mpf_set_d (t2, pow (M_E, -(2 * pow (mpf_get_d (val), 2))));
+#endif
+
+ /* p = 1 - t1 * t2 */
+ mpf_mul (t1, t1, t2);
+ mpf_ui_sub (p, 1, t1);
+
+ mpf_clear (t1); mpf_clear (t2);
+}
+
+static double x2_table_X[][7] = {
+ { -2.33, -1.64, -.674, 0.0, 0.674, 1.64, 2.33 }, /* x */
+ { 5.4289, 2.6896, .454276, 0.0, .454276, 2.6896, 5.4289} /* x^2 */
+};
+
+#define _2D3 ((double) .6666666666)
+
+/* x2_table (t, v, n) -- return chi-square table row for V in T[]. */
+void
+x2_table (double t[],
+ unsigned int v)
+{
+ int f;
+
+
+ /* FIXME: Do a table lookup for v <= 30 since the following formula
+ [Knuth, vol 2, 3.3.1] is only good for v > 30. */
+
+ /* value = v + sqrt(2*v) * X[p] + (2/3) * X[p]^2 - 2/3 + O(1/sqrt(t) */
+ /* NOTE: The O() term is ignored for simplicity. */
+
+ for (f = 0; f < 7; f++)
+ t[f] =
+ v +
+ sqrt (2 * v) * x2_table_X[0][f] +
+ _2D3 * x2_table_X[1][f] - _2D3;
+}
+
+
+/* P(p, x) -- Distribution function. Calculate the probability of X
+being greater than or equal to any number in the sequence. For a
+random real number between zero and one given by a uniformly
+distributed random number generator, this is simply equal to X. */
+
+static void
+P (mpf_t p, mpf_t x)
+{
+ mpf_set (p, x);
+}
+
+/* mpf_freqt() -- Frequency test using KS on N real numbers between zero
+ and one. See [Knuth vol 2, p.61]. */
+void
+mpf_freqt (mpf_t Kp,
+ mpf_t Km,
+ mpf_t X[],
+ const unsigned long int n)
+{
+ ks (Kp, Km, X, P, n);
+}
+
+
+/* The Chi-square test. Eq. (8) in Knuth vol. 2 says that if Y[]
+ holds the observations and p[] is the probability for.. (to be
+ continued!)
+
+ V = 1/n * sum((s=1 to k) Y[s]^2 / p[s]) - n */
+
+void
+x2 (mpf_t V, /* result */
+ unsigned long int X[], /* data */
+ unsigned int k, /* #of categories */
+ void (P) (mpf_t, unsigned long int, void *), /* probability func */
+ void *x, /* extra user data passed to P() */
+ unsigned long int n) /* #of samples */
+{
+ unsigned int f;
+ mpf_t f_t, f_t2; /* temp floats */
+
+ mpf_init (f_t); mpf_init (f_t2);
+
+
+ mpf_set_ui (V, 0);
+ for (f = 0; f < k; f++)
+ {
+ if (g_debug > DEBUG_2)
+ fprintf (stderr, "%u: P()=", f);
+ mpf_set_ui (f_t, X[f]);
+ mpf_mul (f_t, f_t, f_t); /* f_t = X[f]^2 */
+ P (f_t2, f, x); /* f_t2 = Pr(f) */
+ if (g_debug > DEBUG_2)
+ mpf_out_str (stderr, 10, 2, f_t2);
+ mpf_div (f_t, f_t, f_t2);
+ mpf_add (V, V, f_t);
+ if (g_debug > DEBUG_2)
+ {
+ fprintf (stderr, "\tV=");
+ mpf_out_str (stderr, 10, 2, V);
+ fprintf (stderr, "\t");
+ }
+ }
+ if (g_debug > DEBUG_2)
+ fprintf (stderr, "\n");
+ mpf_div_ui (V, V, n);
+ mpf_sub_ui (V, V, n);
+
+ mpf_clear (f_t); mpf_clear (f_t2);
+}
+
+/* Pzf(p, s, x) -- Probability for category S in mpz_freqt(). It's
+ 1/d for all S. X is a pointer to an unsigned int holding 'd'. */
+static void
+Pzf (mpf_t p, unsigned long int s, void *x)
+{
+ mpf_set_ui (p, 1);
+ mpf_div_ui (p, p, *((unsigned int *) x));
+}
+
+/* mpz_freqt(V, X, imax, n) -- Frequency test on integers. [Knuth,
+ vol 2, 3.3.2]. Keep IMAX low on this one, since we loop from 0 to
+ IMAX. 128 or 256 could be nice.
+
+ X[] must not contain numbers outside the range 0 <= X <= IMAX.
+
+ Return value is number of observations actually used, after
+ discarding entries out of range.
+
+ Since X[] contains integers between zero and IMAX, inclusive, we
+ have IMAX+1 categories.
+
+ Note that N should be at least 5*IMAX. Result is put in V and can
+ be compared to output from x2_table (v=IMAX). */
+
+unsigned long int
+mpz_freqt (mpf_t V,
+ mpz_t X[],
+ unsigned int imax,
+ const unsigned long int n)
+{
+ unsigned long int *v; /* result */
+ unsigned int f;
+ unsigned int d; /* number of categories = imax+1 */
+ unsigned int uitemp;
+ unsigned long int usedn;
+
+
+ d = imax + 1;
+
+ v = (unsigned long int *) calloc (imax + 1, sizeof (unsigned long int));
+ if (NULL == v)
+ {
+ fprintf (stderr, "mpz_freqt(): out of memory\n");
+ exit (1);
+ }
+
+ /* count */
+ usedn = n; /* actual number of observations */
+ for (f = 0; f < n; f++)
+ {
+ uitemp = mpz_get_ui(X[f]);
+ if (uitemp > imax) /* sanity check */
+ {
+ if (g_debug)
+ fprintf (stderr, "mpz_freqt(): warning: input insanity: %u, "\
+ "ignored.\n", uitemp);
+ usedn--;
+ continue;
+ }
+ v[uitemp]++;
+ }
+
+ if (g_debug > DEBUG_2)
+ {
+ fprintf (stderr, "counts:\n");
+ for (f = 0; f <= imax; f++)
+ fprintf (stderr, "%u:\t%lu\n", f, v[f]);
+ }
+
+ /* chi-square with k=imax+1 and P(x)=1/(imax+1) for all x.*/
+ x2 (V, v, d, Pzf, (void *) &d, usedn);
+
+ free (v);
+ return (usedn);
+}
+
+/* debug dummy to drag in dump funcs */
+void
+foo_debug ()
+{
+ if (0)
+ {
+ mpf_dump (0);
+#ifndef OLDGMP
+ mpz_dump (0);
+#endif
+ }
+}
+
+/* merit (rop, t, v, m) -- calculate merit for spectral test result in
+ dimension T, see Knuth p. 105. BUGS: Only valid for 2 <= T <=
+ 6. */
+void
+merit (mpf_t rop, unsigned int t, mpf_t v, mpz_t m)
+{
+ int f;
+ mpf_t f_m, f_const, f_pi;
+
+ mpf_init (f_m);
+ mpf_set_z (f_m, m);
+ mpf_init_set_d (f_const, M_PI);
+ mpf_init_set_d (f_pi, M_PI);
+
+ switch (t)
+ {
+ case 2: /* PI */
+ break;
+ case 3: /* PI * 4/3 */
+ mpf_mul_ui (f_const, f_const, 4);
+ mpf_div_ui (f_const, f_const, 3);
+ break;
+ case 4: /* PI^2 * 1/2 */
+ mpf_mul (f_const, f_const, f_pi);
+ mpf_div_ui (f_const, f_const, 2);
+ break;
+ case 5: /* PI^2 * 8/15 */
+ mpf_mul (f_const, f_const, f_pi);
+ mpf_mul_ui (f_const, f_const, 8);
+ mpf_div_ui (f_const, f_const, 15);
+ break;
+ case 6: /* PI^3 * 1/6 */
+ mpf_mul (f_const, f_const, f_pi);
+ mpf_mul (f_const, f_const, f_pi);
+ mpf_div_ui (f_const, f_const, 6);
+ break;
+ default:
+ fprintf (stderr,
+ "spect (merit): can't calculate merit for dimensions > 6\n");
+ mpf_set_ui (f_const, 0);
+ break;
+ }
+
+ /* rop = v^t */
+ mpf_set (rop, v);
+ for (f = 1; f < t; f++)
+ mpf_mul (rop, rop, v);
+ mpf_mul (rop, rop, f_const);
+ mpf_div (rop, rop, f_m);
+
+ mpf_clear (f_m);
+ mpf_clear (f_const);
+ mpf_clear (f_pi);
+}
+
+double
+merit_u (unsigned int t, mpf_t v, mpz_t m)
+{
+ mpf_t rop;
+ double res;
+
+ mpf_init (rop);
+ merit (rop, t, v, m);
+ res = mpf_get_d (rop);
+ mpf_clear (rop);
+ return res;
+}
+
+/* f_floor (rop, op) -- Set rop = floor (op). */
+void
+f_floor (mpf_t rop, mpf_t op)
+{
+ mpz_t z;
+
+ mpz_init (z);
+
+ /* No mpf_floor(). Convert to mpz and back. */
+ mpz_set_f (z, op);
+ mpf_set_z (rop, z);
+
+ mpz_clear (z);
+}
+
+
+/* vz_dot (rop, v1, v2, nelem) -- compute dot product of z-vectors V1,
+ V2. N is number of elements in vectors V1 and V2. */
+
+void
+vz_dot (mpz_t rop, mpz_t V1[], mpz_t V2[], unsigned int n)
+{
+ mpz_t t;
+
+ mpz_init (t);
+ mpz_set_ui (rop, 0);
+ while (n--)
+ {
+ mpz_mul (t, V1[n], V2[n]);
+ mpz_add (rop, rop, t);
+ }
+
+ mpz_clear (t);
+}
+
+void
+spectral_test (mpf_t rop[], unsigned int T, mpz_t a, mpz_t m)
+{
+ /* Knuth "Seminumerical Algorithms, Third Edition", section 3.3.4
+ (pp. 101-103). */
+
+ /* v[t] = min { sqrt (x[1]^2 + ... + x[t]^2) |
+ x[1] + a*x[2] + ... + pow (a, t-1) * x[t] is congruent to 0 (mod m) } */
+
+
+ /* Variables. */
+ unsigned int ui_t;
+ unsigned int ui_i, ui_j, ui_k, ui_l;
+ mpf_t f_tmp1, f_tmp2;
+ mpz_t tmp1, tmp2, tmp3;
+ mpz_t U[GMP_SPECT_MAXT][GMP_SPECT_MAXT],
+ V[GMP_SPECT_MAXT][GMP_SPECT_MAXT],
+ X[GMP_SPECT_MAXT],
+ Y[GMP_SPECT_MAXT],
+ Z[GMP_SPECT_MAXT];
+ mpz_t h, hp, r, s, p, pp, q, u, v;
+
+ /* GMP inits. */
+ mpf_init (f_tmp1);
+ mpf_init (f_tmp2);
+ for (ui_i = 0; ui_i < GMP_SPECT_MAXT; ui_i++)
+ {
+ for (ui_j = 0; ui_j < GMP_SPECT_MAXT; ui_j++)
+ {
+ mpz_init_set_ui (U[ui_i][ui_j], 0);
+ mpz_init_set_ui (V[ui_i][ui_j], 0);
+ }
+ mpz_init_set_ui (X[ui_i], 0);
+ mpz_init_set_ui (Y[ui_i], 0);
+ mpz_init (Z[ui_i]);
+ }
+ mpz_init (tmp1);
+ mpz_init (tmp2);
+ mpz_init (tmp3);
+ mpz_init (h);
+ mpz_init (hp);
+ mpz_init (r);
+ mpz_init (s);
+ mpz_init (p);
+ mpz_init (pp);
+ mpz_init (q);
+ mpz_init (u);
+ mpz_init (v);
+
+ /* Implementation inits. */
+ if (T > GMP_SPECT_MAXT)
+ T = GMP_SPECT_MAXT; /* FIXME: Lazy. */
+
+ /* S1 [Initialize.] */
+ ui_t = 2 - 1; /* NOTE: `t' in description == ui_t + 1
+ for easy indexing */
+ mpz_set (h, a);
+ mpz_set (hp, m);
+ mpz_set_ui (p, 1);
+ mpz_set_ui (pp, 0);
+ mpz_set (r, a);
+ mpz_pow_ui (s, a, 2);
+ mpz_add_ui (s, s, 1); /* s = 1 + a^2 */
+
+ /* S2 [Euclidean step.] */
+ while (1)
+ {
+ if (g_debug > DEBUG_1)
+ {
+ mpz_mul (tmp1, h, pp);
+ mpz_mul (tmp2, hp, p);
+ mpz_sub (tmp1, tmp1, tmp2);
+ if (mpz_cmpabs (m, tmp1))
+ {
+ printf ("***BUG***: h*pp - hp*p = ");
+ mpz_out_str (stdout, 10, tmp1);
+ printf ("\n");
+ }
+ }
+ if (g_debug > DEBUG_2)
+ {
+ printf ("hp = ");
+ mpz_out_str (stdout, 10, hp);
+ printf ("\nh = ");
+ mpz_out_str (stdout, 10, h);
+ printf ("\n");
+ fflush (stdout);
+ }
+
+ if (mpz_sgn (h))
+ mpz_tdiv_q (q, hp, h); /* q = floor(hp/h) */
+ else
+ mpz_set_ui (q, 1);
+
+ if (g_debug > DEBUG_2)
+ {
+ printf ("q = ");
+ mpz_out_str (stdout, 10, q);
+ printf ("\n");
+ fflush (stdout);
+ }
+
+ mpz_mul (tmp1, q, h);
+ mpz_sub (u, hp, tmp1); /* u = hp - q*h */
+
+ mpz_mul (tmp1, q, p);
+ mpz_sub (v, pp, tmp1); /* v = pp - q*p */
+
+ mpz_pow_ui (tmp1, u, 2);
+ mpz_pow_ui (tmp2, v, 2);
+ mpz_add (tmp1, tmp1, tmp2);
+ if (mpz_cmp (tmp1, s) < 0)
+ {
+ mpz_set (s, tmp1); /* s = u^2 + v^2 */
+ mpz_set (hp, h); /* hp = h */
+ mpz_set (h, u); /* h = u */
+ mpz_set (pp, p); /* pp = p */
+ mpz_set (p, v); /* p = v */
+ }
+ else
+ break;
+ }
+
+ /* S3 [Compute v2.] */
+ mpz_sub (u, u, h);
+ mpz_sub (v, v, p);
+
+ mpz_pow_ui (tmp1, u, 2);
+ mpz_pow_ui (tmp2, v, 2);
+ mpz_add (tmp1, tmp1, tmp2);
+ if (mpz_cmp (tmp1, s) < 0)
+ {
+ mpz_set (s, tmp1); /* s = u^2 + v^2 */
+ mpz_set (hp, u);
+ mpz_set (pp, v);
+ }
+ mpf_set_z (f_tmp1, s);
+ mpf_sqrt (rop[ui_t - 1], f_tmp1);
+
+ /* S4 [Advance t.] */
+ mpz_neg (U[0][0], h);
+ mpz_set (U[0][1], p);
+ mpz_neg (U[1][0], hp);
+ mpz_set (U[1][1], pp);
+
+ mpz_set (V[0][0], pp);
+ mpz_set (V[0][1], hp);
+ mpz_neg (V[1][0], p);
+ mpz_neg (V[1][1], h);
+ if (mpz_cmp_ui (pp, 0) > 0)
+ {
+ mpz_neg (V[0][0], V[0][0]);
+ mpz_neg (V[0][1], V[0][1]);
+ mpz_neg (V[1][0], V[1][0]);
+ mpz_neg (V[1][1], V[1][1]);
+ }
+
+ while (ui_t + 1 != T) /* S4 loop */
+ {
+ ui_t++;
+ mpz_mul (r, a, r);
+ mpz_mod (r, r, m);
+
+ /* Add new row and column to U and V. They are initialized with
+ all elements set to zero, so clearing is not necessary. */
+
+ mpz_neg (U[ui_t][0], r); /* U: First col in new row. */
+ mpz_set_ui (U[ui_t][ui_t], 1); /* U: Last col in new row. */
+
+ mpz_set (V[ui_t][ui_t], m); /* V: Last col in new row. */
+
+ /* "Finally, for 1 <= i < t,
+ set q = round (vi1 * r / m),
+ vit = vi1*r - q*m,
+ and Ut=Ut+q*Ui */
+
+ for (ui_i = 0; ui_i < ui_t; ui_i++)
+ {
+ mpz_mul (tmp1, V[ui_i][0], r); /* tmp1=vi1*r */
+ zdiv_round (q, tmp1, m); /* q=round(vi1*r/m) */
+ mpz_mul (tmp2, q, m); /* tmp2=q*m */
+ mpz_sub (V[ui_i][ui_t], tmp1, tmp2);
+
+ for (ui_j = 0; ui_j <= ui_t; ui_j++) /* U[t] = U[t] + q*U[i] */
+ {
+ mpz_mul (tmp1, q, U[ui_i][ui_j]); /* tmp=q*uij */
+ mpz_add (U[ui_t][ui_j], U[ui_t][ui_j], tmp1); /* utj = utj + q*uij */
+ }
+ }
+
+ /* s = min (s, zdot (U[t], U[t]) */
+ vz_dot (tmp1, U[ui_t], U[ui_t], ui_t + 1);
+ if (mpz_cmp (tmp1, s) < 0)
+ mpz_set (s, tmp1);
+
+ ui_k = ui_t;
+ ui_j = 0; /* WARNING: ui_j no longer a temp. */
+
+ /* S5 [Transform.] */
+ if (g_debug > DEBUG_2)
+ printf ("(t, k, j, q1, q2, ...)\n");
+ do
+ {
+ if (g_debug > DEBUG_2)
+ printf ("(%u, %u, %u", ui_t + 1, ui_k + 1, ui_j + 1);
+
+ for (ui_i = 0; ui_i <= ui_t; ui_i++)
+ {
+ if (ui_i != ui_j)
+ {
+ vz_dot (tmp1, V[ui_i], V[ui_j], ui_t + 1); /* tmp1=dot(Vi,Vj). */
+ mpz_abs (tmp2, tmp1);
+ mpz_mul_ui (tmp2, tmp2, 2); /* tmp2 = 2*abs(dot(Vi,Vj) */
+ vz_dot (tmp3, V[ui_j], V[ui_j], ui_t + 1); /* tmp3=dot(Vj,Vj). */
+
+ if (mpz_cmp (tmp2, tmp3) > 0)
+ {
+ zdiv_round (q, tmp1, tmp3); /* q=round(Vi.Vj/Vj.Vj) */
+ if (g_debug > DEBUG_2)
+ {
+ printf (", ");
+ mpz_out_str (stdout, 10, q);
+ }
+
+ for (ui_l = 0; ui_l <= ui_t; ui_l++)
+ {
+ mpz_mul (tmp1, q, V[ui_j][ui_l]);
+ mpz_sub (V[ui_i][ui_l], V[ui_i][ui_l], tmp1); /* Vi=Vi-q*Vj */
+ mpz_mul (tmp1, q, U[ui_i][ui_l]);
+ mpz_add (U[ui_j][ui_l], U[ui_j][ui_l], tmp1); /* Uj=Uj+q*Ui */
+ }
+
+ vz_dot (tmp1, U[ui_j], U[ui_j], ui_t + 1); /* tmp1=dot(Uj,Uj) */
+ if (mpz_cmp (tmp1, s) < 0) /* s = min(s,dot(Uj,Uj)) */
+ mpz_set (s, tmp1);
+ ui_k = ui_j;
+ }
+ else if (g_debug > DEBUG_2)
+ printf (", #"); /* 2|Vi.Vj| <= Vj.Vj */
+ }
+ else if (g_debug > DEBUG_2)
+ printf (", *"); /* i == j */
+ }
+
+ if (g_debug > DEBUG_2)
+ printf (")\n");
+
+ /* S6 [Advance j.] */
+ if (ui_j == ui_t)
+ ui_j = 0;
+ else
+ ui_j++;
+ }
+ while (ui_j != ui_k); /* S5 */
+
+ /* From Knuth p. 104: "The exhaustive search in steps S8-S10
+ reduces the value of s only rarely." */
+#ifdef DO_SEARCH
+ /* S7 [Prepare for search.] */
+ /* Find minimum in (x[1], ..., x[t]) satisfying condition
+ x[k]^2 <= f(y[1], ...,y[t]) * dot(V[k],V[k]) */
+
+ ui_k = ui_t;
+ if (g_debug > DEBUG_2)
+ {
+ printf ("searching...");
+ /*for (f = 0; f < ui_t*/
+ fflush (stdout);
+ }
+
+ /* Z[i] = floor (sqrt (floor (dot(V[i],V[i]) * s / m^2))); */
+ mpz_pow_ui (tmp1, m, 2);
+ mpf_set_z (f_tmp1, tmp1);
+ mpf_set_z (f_tmp2, s);
+ mpf_div (f_tmp1, f_tmp2, f_tmp1); /* f_tmp1 = s/m^2 */
+ for (ui_i = 0; ui_i <= ui_t; ui_i++)
+ {
+ vz_dot (tmp1, V[ui_i], V[ui_i], ui_t + 1);
+ mpf_set_z (f_tmp2, tmp1);
+ mpf_mul (f_tmp2, f_tmp2, f_tmp1);
+ f_floor (f_tmp2, f_tmp2);
+ mpf_sqrt (f_tmp2, f_tmp2);
+ mpz_set_f (Z[ui_i], f_tmp2);
+ }
+
+ /* S8 [Advance X[k].] */
+ do
+ {
+ if (g_debug > DEBUG_2)
+ {
+ printf ("X[%u] = ", ui_k);
+ mpz_out_str (stdout, 10, X[ui_k]);
+ printf ("\tZ[%u] = ", ui_k);
+ mpz_out_str (stdout, 10, Z[ui_k]);
+ printf ("\n");
+ fflush (stdout);
+ }
+
+ if (mpz_cmp (X[ui_k], Z[ui_k]))
+ {
+ mpz_add_ui (X[ui_k], X[ui_k], 1);
+ for (ui_i = 0; ui_i <= ui_t; ui_i++)
+ mpz_add (Y[ui_i], Y[ui_i], U[ui_k][ui_i]);
+
+ /* S9 [Advance k.] */
+ while (++ui_k <= ui_t)
+ {
+ mpz_neg (X[ui_k], Z[ui_k]);
+ mpz_mul_ui (tmp1, Z[ui_k], 2);
+ for (ui_i = 0; ui_i <= ui_t; ui_i++)
+ {
+ mpz_mul (tmp2, tmp1, U[ui_k][ui_i]);
+ mpz_sub (Y[ui_i], Y[ui_i], tmp2);
+ }
+ }
+ vz_dot (tmp1, Y, Y, ui_t + 1);
+ if (mpz_cmp (tmp1, s) < 0)
+ mpz_set (s, tmp1);
+ }
+ }
+ while (--ui_k);
+#endif /* DO_SEARCH */
+ mpf_set_z (f_tmp1, s);
+ mpf_sqrt (rop[ui_t - 1], f_tmp1);
+#ifdef DO_SEARCH
+ if (g_debug > DEBUG_2)
+ printf ("done.\n");
+#endif /* DO_SEARCH */
+ } /* S4 loop */
+
+ /* Clear GMP variables. */
+
+ mpf_clear (f_tmp1);
+ mpf_clear (f_tmp2);
+ for (ui_i = 0; ui_i < GMP_SPECT_MAXT; ui_i++)
+ {
+ for (ui_j = 0; ui_j < GMP_SPECT_MAXT; ui_j++)
+ {
+ mpz_clear (U[ui_i][ui_j]);
+ mpz_clear (V[ui_i][ui_j]);
+ }
+ mpz_clear (X[ui_i]);
+ mpz_clear (Y[ui_i]);
+ mpz_clear (Z[ui_i]);
+ }
+ mpz_clear (tmp1);
+ mpz_clear (tmp2);
+ mpz_clear (tmp3);
+ mpz_clear (h);
+ mpz_clear (hp);
+ mpz_clear (r);
+ mpz_clear (s);
+ mpz_clear (p);
+ mpz_clear (pp);
+ mpz_clear (q);
+ mpz_clear (u);
+ mpz_clear (v);
+
+ return;
+}
diff --git a/vendor/gmp-6.3.0/tests/rand/t-iset.c b/vendor/gmp-6.3.0/tests/rand/t-iset.c
new file mode 100644
index 0000000..884220f
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/rand/t-iset.c
@@ -0,0 +1,67 @@
+/* Test gmp_randinit_set.
+
+Copyright 2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+/* expect after a gmp_randinit_set that the new and old generators will
+ produce the same sequence of numbers */
+void
+check_one (const char *name, gmp_randstate_ptr src)
+{
+ gmp_randstate_t dst;
+ mpz_t sz, dz;
+ int i;
+
+ gmp_randinit_set (dst, src);
+ mpz_init (sz);
+ mpz_init (dz);
+
+ for (i = 0; i < 20; i++)
+ {
+ mpz_urandomb (sz, src, 123);
+ mpz_urandomb (dz, dst, 123);
+
+ if (mpz_cmp (sz, dz) != 0)
+ {
+ printf ("gmp_randinit_set didn't duplicate randstate\n");
+ printf (" algorithm: %s\n", name);
+ gmp_printf (" from src: %#Zx\n", sz);
+ gmp_printf (" from dst: %#Zx\n", dz);
+ abort ();
+ }
+ }
+
+ mpz_clear (sz);
+ mpz_clear (dz);
+ gmp_randclear (dst);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+
+ call_rand_algs (check_one);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/rand/t-lc2exp.c b/vendor/gmp-6.3.0/tests/rand/t-lc2exp.c
new file mode 100644
index 0000000..c66691d
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/rand/t-lc2exp.c
@@ -0,0 +1,216 @@
+/* Exercise the lc2exp random functions.
+
+Copyright 2002, 2011 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+/* a=0 and c=0 produces zero results always. */
+void
+check_zero (unsigned long m2exp)
+{
+ gmp_randstate_t r;
+ mpz_t a;
+ unsigned long c;
+ int i;
+
+ mpz_init_set_ui (a, 0L);
+ c = 0L;
+
+ gmp_randinit_lc_2exp (r, a, c, m2exp);
+ gmp_randseed_ui (r, 0L);
+
+ for (i = 0; i < 5; i++)
+ {
+ mpz_urandomb (a, r, 123L);
+ if (mpz_sgn (a) != 0)
+ {
+ printf ("check_zero m2exp=%lu: didn't get zero\n", m2exp);
+ gmp_printf (" rand=%#Zx\n", a);
+ abort ();
+ }
+ }
+
+ mpz_clear (a);
+ gmp_randclear (r);
+}
+
+/* negative a */
+void
+check_nega (void)
+{
+ gmp_randstate_t r;
+ mpz_t a;
+ unsigned long c, m2exp;
+ int i;
+
+ mpz_init (a);
+ mpz_setbit (a, 1000L);
+ mpz_neg (a, a);
+ c = 0L;
+ m2exp = 45L;
+
+ gmp_randinit_lc_2exp (r, a, c, m2exp);
+ gmp_randseed_ui (r, 0L);
+
+ for (i = 0; i < 5; i++)
+ {
+ mpz_urandomb (a, r, 123L);
+ if (mpz_sgn (a) != 0)
+ printf ("check_nega m2exp=%lu: didn't get zero\n", m2exp);
+ }
+
+ mpz_clear (a);
+ gmp_randclear (r);
+}
+
+void
+check_bigc (void)
+{
+ gmp_randstate_t r;
+ mpz_t a;
+ unsigned long c, m2exp, bits;
+ int i;
+
+ mpz_init_set_ui (a, 0L);
+ c = ULONG_MAX;
+ m2exp = 8;
+
+ gmp_randinit_lc_2exp (r, a, c, m2exp);
+ gmp_randseed_ui (r, 0L);
+
+ for (i = 0; i < 20; i++)
+ {
+ bits = 123L;
+ mpz_urandomb (a, r, bits);
+ if (mpz_sgn (a) < 0 || mpz_sizeinbase (a, 2) > bits)
+ {
+ printf ("check_bigc: mpz_urandomb out of range\n");
+ printf (" m2exp=%lu\n", m2exp);
+ gmp_printf (" rand=%#ZX\n", a);
+ gmp_printf (" sizeinbase2=%u\n", mpz_sizeinbase (a, 2));
+ abort ();
+ }
+ }
+
+ mpz_clear (a);
+ gmp_randclear (r);
+}
+
+void
+check_bigc1 (void)
+{
+ gmp_randstate_t r;
+ mpz_t a;
+ unsigned long c, m2exp;
+ int i;
+
+ mpz_init_set_ui (a, 0L);
+ c = ULONG_MAX;
+ m2exp = 2;
+
+ gmp_randinit_lc_2exp (r, a, c, m2exp);
+ gmp_randseed_ui (r, 0L);
+
+ for (i = 0; i < 20; i++)
+ {
+ mpz_urandomb (a, r, 1L);
+ if (mpz_cmp_ui (a, 1L) != 0)
+ {
+ printf ("check_bigc1: mpz_urandomb didn't give 1\n");
+ printf (" m2exp=%lu\n", m2exp);
+ gmp_printf (" got rand=%#ZX\n", a);
+ abort ();
+ }
+ }
+
+ mpz_clear (a);
+ gmp_randclear (r);
+}
+
+/* Checks parameters which triggered an assertion failure in the past.
+ Happened when limbs(a)+limbs(c) < bits_to_limbs(m2exp). */
+void
+check_bigm (void)
+{
+ gmp_randstate_t rstate;
+ mpz_t a;
+
+ mpz_init_set_ui (a, 5L);
+ gmp_randinit_lc_2exp (rstate, a, 1L, 384L);
+
+ mpz_urandomb (a, rstate, 20L);
+
+ gmp_randclear (rstate);
+ mpz_clear (a);
+}
+
+/* Checks for seeds bigger than the modulus. */
+void
+check_bigs (void)
+{
+ gmp_randstate_t rstate;
+ mpz_t sd, a;
+ int i;
+
+ mpz_init (sd);
+ mpz_setbit (sd, 300L);
+ mpz_sub_ui (sd, sd, 1L);
+ mpz_clrbit (sd, 13L);
+ mpz_init_set_ui (a, 123456789L);
+
+ gmp_randinit_lc_2exp (rstate, a, 5L, 64L);
+
+ for (i = 0; i < 20; i++)
+ {
+ mpz_neg (sd, sd);
+ gmp_randseed (rstate, sd);
+ mpz_mul_ui (sd, sd, 7L);
+
+ mpz_urandomb (a, rstate, 80L);
+ }
+
+ gmp_randclear (rstate);
+ mpz_clear (a);
+ mpz_clear (sd);
+}
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_zero (2L);
+ check_zero (7L);
+ check_zero (32L);
+ check_zero (64L);
+ check_zero (1000L);
+
+ check_nega ();
+ check_bigc ();
+ check_bigc1 ();
+
+ check_bigm ();
+ check_bigs ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/rand/t-mt.c b/vendor/gmp-6.3.0/tests/rand/t-mt.c
new file mode 100644
index 0000000..08ba7fc
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/rand/t-mt.c
@@ -0,0 +1,82 @@
+/* Test the Mersenne Twister random number generator.
+
+Copyright 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+#ifndef TRUE
+#define TRUE (1)
+#endif
+#ifndef FALSE
+#define FALSE (0)
+#endif
+
+/* Test that the sequence without seeding equals the sequence with the
+ default seed. */
+int
+chk_default_seed (void)
+{
+ gmp_randstate_t r1, r2;
+ mpz_t a, b;
+ int i;
+ int ok = TRUE;
+
+ mpz_init2 (a, 19936L);
+ mpz_init2 (b, 19936L);
+
+ gmp_randinit_mt (r1);
+ gmp_randinit_mt (r2);
+ gmp_randseed_ui (r2, 5489L); /* Must match DEFAULT_SEED in randmt.c */
+ for (i = 0; i < 3; i++)
+ {
+ /* Extract one whole buffer per iteration. */
+ mpz_urandomb (a, r1, 19936L);
+ mpz_urandomb (b, r2, 19936L);
+ if (mpz_cmp (a, b) != 0)
+ {
+ ok = FALSE;
+ printf ("Default seed fails in iteration %d\n", i);
+ break;
+ }
+ }
+ gmp_randclear (r1);
+ gmp_randclear (r2);
+
+ mpz_clear (a);
+ mpz_clear (b);
+ return ok;
+}
+
+int
+main (int argc, char *argv[])
+{
+ int ok;
+
+ tests_start ();
+
+ ok = chk_default_seed ();
+
+ tests_end ();
+
+ if (ok)
+ return 0; /* pass */
+ else
+ return 1; /* fail */
+}
diff --git a/vendor/gmp-6.3.0/tests/rand/t-rand.c b/vendor/gmp-6.3.0/tests/rand/t-rand.c
new file mode 100644
index 0000000..1265a0d
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/rand/t-rand.c
@@ -0,0 +1,290 @@
+/* t-rand -- Test random number generators. */
+
+/*
+Copyright 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "gmp.h"
+
+#define SEED 1
+#define BASE 16
+#define ENTS 10 /* Number of entries in array when
+ printing. */
+
+/* These were generated by this very program. Do not edit! */
+/* Integers. */
+const char *z1[ENTS] = {"0", "1", "1", "1", "1", "0", "1", "1", "1", "1"};
+const char *z2[ENTS] = {"0", "3", "1", "3", "3", "0", "3", "3", "3", "1"};
+const char *z3[ENTS] = {"4", "3", "1", "7", "3", "0", "3", "3", "3", "1"};
+const char *z4[ENTS] = {"c", "3", "1", "f", "b", "8", "3", "3", "3", "1"};
+const char *z5[ENTS] = {"1c", "13", "11", "1f", "b", "18", "3", "13", "3", "1"};
+
+const char *z10[ENTS] = {"29c", "213", "f1", "17f", "12b", "178", "383", "d3", "3a3", "281"};
+
+const char *z15[ENTS] = {"29c", "1a13", "74f1", "257f", "592b", "4978", "4783", "7cd3", "5ba3", "4681"};
+const char *z16[ENTS] = {"29c", "9a13", "74f1", "a57f", "d92b", "4978", "c783", "fcd3", "5ba3", "c681"};
+const char *z17[ENTS] = {"51e", "f17a", "54ff", "1a335", "cf65", "5d6f", "583f", "618f", "1bc6", "98ff"};
+
+const char *z31[ENTS] = {"3aecd515", "13ae8ec6", "518c8090", "81ca077", "70b7134", "7ee78d71", "323a7636", "2122cb1a", "19811941", "41fd605"};
+const char *z32[ENTS] = {"baecd515", "13ae8ec6", "518c8090", "881ca077", "870b7134", "7ee78d71", "323a7636", "a122cb1a", "99811941", "841fd605"};
+const char *z33[ENTS] = {"1faf4cca", "15d6ef83b", "9095fe72", "1b6a3dff6", "b17cbddd", "16e5209d4", "6f65b12c", "493bbbc6", "abf2a5d5", "6d491a3c"};
+
+const char *z63[ENTS] = {"48a74f367fa7b5c8", "3ba9e9dc1b263076", "1e0ac84e7678e0fb", "11416581728b3e35", "36ab610523f0f1f7", "3e540e8e95c0eb4b", "439ae16057dbc9d3", "734fb260db243950", "7d3a317effc289bf", "1d80301fb3d1a0d1"};
+const char *z64[ENTS] = {"48a74f367fa7b5c8", "bba9e9dc1b263076", "9e0ac84e7678e0fb", "11416581728b3e35", "b6ab610523f0f1f7", "be540e8e95c0eb4b", "439ae16057dbc9d3", "f34fb260db243950", "fd3a317effc289bf", "1d80301fb3d1a0d1"};
+const char *z65[ENTS] = {"1ff77710d846d49f0", "1b1411701d709ee10", "31ffa81a208b6af4", "446638d431d3c681", "df5c569d5baa8b55", "197d99ea9bf28e5a0", "191ade09edd94cfae", "194acefa6dde5e18d", "1afc1167c56272d92", "d092994da72f206f"};
+
+const char *z127[ENTS] = {"2f66ba932aaf58a071fd8f0742a99a0c", "73cfa3c664c9c1753507ca60ec6b8425", "53ea074ca131dec12cd68b8aa8e20278", "3cf5ac8c343532f8a53cc0eb47581f73", "50c11d5869e208aa1b9aa317b8c2d0a9", "b23163c892876472b1ef19642eace09", "489f4c03d41f87509c8d6c90ce674f95", "2ab8748c96aa6762ea1932b44c9d7164", "98cb5591fc05ad31afbbc1d67b90edd", "77848bb991fd0be331adcf1457fbc672"};
+const char *z128[ENTS] = {"af66ba932aaf58a071fd8f0742a99a0c", "73cfa3c664c9c1753507ca60ec6b8425", "53ea074ca131dec12cd68b8aa8e20278", "3cf5ac8c343532f8a53cc0eb47581f73", "50c11d5869e208aa1b9aa317b8c2d0a9", "8b23163c892876472b1ef19642eace09", "489f4c03d41f87509c8d6c90ce674f95", "aab8748c96aa6762ea1932b44c9d7164", "98cb5591fc05ad31afbbc1d67b90edd", "f7848bb991fd0be331adcf1457fbc672"};
+
+/* Floats. */
+const char *f1[ENTS] = {"0.@0", "0.8@0", "0.8@0", "0.8@0", "0.8@0", "0.@0", "0.8@0", "0.8@0", "0.8@0", "0.8@0"};
+const char *f2[ENTS] = {"0.@0", "0.c@0", "0.4@0", "0.c@0", "0.c@0", "0.@0", "0.c@0", "0.c@0", "0.c@0", "0.4@0"};
+const char *f3[ENTS] = {"0.8@0", "0.6@0", "0.2@0", "0.e@0", "0.6@0", "0.@0", "0.6@0", "0.6@0", "0.6@0", "0.2@0"};
+const char *f4[ENTS] = {"0.c@0", "0.3@0", "0.1@0", "0.f@0", "0.b@0", "0.8@0", "0.3@0", "0.3@0", "0.3@0", "0.1@0"};
+const char *f5[ENTS] = {"0.e@0", "0.98@0", "0.88@0", "0.f8@0", "0.58@0", "0.c@0", "0.18@0", "0.98@0", "0.18@0", "0.8@-1"};
+
+const char *f10[ENTS] = {"0.a7@0", "0.84c@0", "0.3c4@0", "0.5fc@0", "0.4ac@0", "0.5e@0", "0.e0c@0", "0.34c@0", "0.e8c@0", "0.a04@0"};
+
+const char *f15[ENTS] = {"0.538@-1", "0.3426@0", "0.e9e2@0", "0.4afe@0", "0.b256@0", "0.92f@0", "0.8f06@0", "0.f9a6@0", "0.b746@0", "0.8d02@0"};
+const char *f16[ENTS] = {"0.29c@-1", "0.9a13@0", "0.74f1@0", "0.a57f@0", "0.d92b@0", "0.4978@0", "0.c783@0", "0.fcd3@0", "0.5ba3@0", "0.c681@0"};
+const char *f17[ENTS] = {"0.28f@-1", "0.78bd@0", "0.2a7f8@0", "0.d19a8@0", "0.67b28@0", "0.2eb78@0", "0.2c1f8@0", "0.30c78@0", "0.de3@-1", "0.4c7f8@0"};
+
+const char *f31[ENTS] = {"0.75d9aa2a@0", "0.275d1d8c@0", "0.a319012@0", "0.103940ee@0", "0.e16e268@-1", "0.fdcf1ae2@0", "0.6474ec6c@0", "0.42459634@0", "0.33023282@0", "0.83fac0a@-1"};
+const char *f32[ENTS] = {"0.baecd515@0", "0.13ae8ec6@0", "0.518c809@0", "0.881ca077@0", "0.870b7134@0", "0.7ee78d71@0", "0.323a7636@0", "0.a122cb1a@0", "0.99811941@0", "0.841fd605@0"};
+const char *f33[ENTS] = {"0.fd7a665@-1", "0.aeb77c1d8@0", "0.484aff39@0", "0.db51effb@0", "0.58be5eee8@0", "0.b72904ea@0", "0.37b2d896@0", "0.249ddde3@0", "0.55f952ea8@0", "0.36a48d1e@0"};
+
+const char *f63[ENTS] = {"0.914e9e6cff4f6b9@0", "0.7753d3b8364c60ec@0", "0.3c15909cecf1c1f6@0", "0.2282cb02e5167c6a@0", "0.6d56c20a47e1e3ee@0", "0.7ca81d1d2b81d696@0", "0.8735c2c0afb793a6@0", "0.e69f64c1b64872a@0", "0.fa7462fdff85137e@0", "0.3b00603f67a341a2@0"};
+const char *f64[ENTS] = {"0.48a74f367fa7b5c8@0", "0.bba9e9dc1b263076@0", "0.9e0ac84e7678e0fb@0", "0.11416581728b3e35@0", "0.b6ab610523f0f1f7@0", "0.be540e8e95c0eb4b@0", "0.439ae16057dbc9d3@0", "0.f34fb260db24395@0", "0.fd3a317effc289bf@0", "0.1d80301fb3d1a0d1@0"};
+const char *f65[ENTS] = {"0.ffbbb886c236a4f8@0", "0.d8a08b80eb84f708@0", "0.18ffd40d1045b57a@0", "0.22331c6a18e9e3408@0", "0.6fae2b4eadd545aa8@0", "0.cbeccf54df9472d@0", "0.c8d6f04f6eca67d7@0", "0.ca5677d36ef2f0c68@0", "0.d7e08b3e2b1396c9@0", "0.68494ca6d39790378@0"};
+
+const char *f127[ENTS] = {"0.5ecd7526555eb140e3fb1e0e85533418@0", "0.e79f478cc99382ea6a0f94c1d8d7084a@0", "0.a7d40e994263bd8259ad171551c404f@0", "0.79eb5918686a65f14a7981d68eb03ee6@0", "0.a1823ab0d3c411543735462f7185a152@0", "0.16462c791250ec8e563de32c85d59c12@0", "0.913e9807a83f0ea1391ad9219cce9f2a@0", "0.5570e9192d54cec5d4326568993ae2c8@0", "0.13196ab23f80b5a635f7783acf721dba@0", "0.ef09177323fa17c6635b9e28aff78ce4@0"};
+const char *f128[ENTS] = {"0.af66ba932aaf58a071fd8f0742a99a0c@0", "0.73cfa3c664c9c1753507ca60ec6b8425@0", "0.53ea074ca131dec12cd68b8aa8e20278@0", "0.3cf5ac8c343532f8a53cc0eb47581f73@0", "0.50c11d5869e208aa1b9aa317b8c2d0a9@0", "0.8b23163c892876472b1ef19642eace09@0", "0.489f4c03d41f87509c8d6c90ce674f95@0", "0.aab8748c96aa6762ea1932b44c9d7164@0", "0.98cb5591fc05ad31afbbc1d67b90edd@-1", "0.f7848bb991fd0be331adcf1457fbc672@0"};
+
+
+struct rt
+{
+ const char **s;
+ int nbits;
+};
+
+static struct rt zarr[] =
+{
+ {z1, 1},
+ {z2, 2},
+ {z3, 3},
+ {z4, 4},
+ {z5, 5},
+ {z10, 10},
+ {z15, 15},
+ {z16, 16},
+ {z17, 17},
+ {z31, 31},
+ {z32, 32},
+ {z33, 33},
+ {z63, 63},
+ {z64, 64},
+ {z65, 65},
+ {z127, 127},
+ {z128, 128},
+ {NULL, 0}
+};
+
+static struct rt farr[] =
+{
+ {f1, 1},
+ {f2, 2},
+ {f3, 3},
+ {f4, 4},
+ {f5, 5},
+ {f10, 10},
+ {f15, 15},
+ {f16, 16},
+ {f17, 17},
+ {f31, 31},
+ {f32, 32},
+ {f33, 33},
+ {f63, 63},
+ {f64, 64},
+ {f65, 65},
+ {f127, 127},
+ {f128, 128},
+ {NULL, 0}
+};
+
+
+int
+main (int argc, char *argv[])
+{
+ static char usage[] = "\
+usage: t-rand [function nbits]\n\
+ function is one of z, f\n\
+ nbits is number of bits\n\
+";
+ gmp_randstate_t rstate;
+ mpz_t z, rz;
+ mpf_t f, rf;
+ enum { Z, F } func = Z;
+ int nbits = 1;
+ int verify_mode_flag = 1;
+ int i;
+ struct rt *a;
+
+
+ if (argc > 1)
+ {
+ if (argc < 3)
+ {
+ fputs (usage, stderr);
+ exit (1);
+ }
+ verify_mode_flag = 0;
+ if (*argv[1] == 'z')
+ func = Z;
+ if (*argv[1] == 'f')
+ func = F;
+ nbits = atoi (argv[2]);
+ }
+
+ mpz_init (rz);
+
+ if (verify_mode_flag)
+ {
+#ifdef VERBOSE
+ printf ("%s: verifying random numbers: ", argv[0]);
+#endif
+
+ /* Test z. */
+ mpz_init (z);
+ for (a = zarr; a->s != NULL; a++)
+ {
+ gmp_randinit (rstate, GMP_RAND_ALG_LC, a->nbits);
+ if (gmp_errno != GMP_ERROR_NONE)
+ exit (1);
+ gmp_randseed_ui (rstate, SEED);
+
+ for (i = 0; i < ENTS; i++)
+ {
+ mpz_urandomb (rz, rstate, a->nbits);
+ mpz_set_str (z, a->s[i], BASE);
+ if (mpz_cmp (z, rz) != 0)
+ {
+ printf ("z%d: ", a->nbits);
+ mpz_out_str (stdout, BASE, rz);
+ printf (" should be ");
+ mpz_out_str (stdout, BASE, z);
+ puts ("");
+ exit (1);
+ }
+ }
+#ifdef VERBOSE
+ printf ("z%d ", a->nbits);
+#endif
+ gmp_randclear (rstate);
+ }
+ mpz_clear (z);
+
+
+ /* Test f. */
+ for (a = farr; a->s != NULL; a++)
+ {
+ gmp_randinit (rstate, GMP_RAND_ALG_LC, a->nbits);
+ if (gmp_errno != GMP_ERROR_NONE)
+ exit (1);
+ gmp_randseed_ui (rstate, SEED);
+
+ mpf_init2 (f, a->nbits);
+ mpf_init2 (rf, a->nbits);
+ for (i = 0; i < ENTS; i++)
+ {
+ mpf_urandomb (rf, rstate, a->nbits);
+ mpf_set_str (f, a->s[i], BASE);
+ if (mpf_cmp (f, rf) != 0)
+ {
+ printf ("f%d: ", a->nbits);
+ mpf_out_str (stdout, BASE, a->nbits, rf);
+ printf (" should be ");
+ mpf_out_str (stdout, BASE, a->nbits, f);
+ puts ("");
+ exit (1);
+ }
+ }
+#ifdef VERBOSE
+ printf ("f%d ", a->nbits);
+#endif
+ gmp_randclear (rstate);
+ mpf_clear (f);
+ mpf_clear (rf);
+ }
+
+#ifdef VERBOSE
+ puts ("");
+#endif
+ }
+ else /* Print mode. */
+ {
+ gmp_randinit (rstate, GMP_RAND_ALG_LC, nbits);
+ if (gmp_errno != GMP_ERROR_NONE)
+ exit (1);
+ gmp_randseed_ui (rstate, SEED);
+
+ switch (func)
+ {
+ case Z:
+ printf ("char *z%d[ENTS] = {", nbits);
+ for (i = 0; i < ENTS; i++)
+ {
+ mpz_urandomb (rz, rstate, nbits);
+ printf ("\"");
+ mpz_out_str (stdout, BASE, rz);
+ printf ("\"");
+ if (i != ENTS - 1)
+ printf (", ");
+ }
+ printf ("};\n");
+ printf (" {z%d, %d},\n", nbits, nbits);
+ break;
+
+ case F:
+ printf ("char *f%d[ENTS] = {", nbits);
+ mpf_init2 (rf, nbits);
+ for (i = 0; i < ENTS; i++)
+ {
+ mpf_urandomb (rf, rstate, nbits);
+ printf ("\"");
+ mpf_out_str (stdout, BASE, nbits, rf);
+ printf ("\"");
+ if (i != ENTS - 1)
+ printf (", ");
+ }
+ printf ("};\n");
+ printf (" {f%d, %d},\n", nbits, nbits);
+ mpf_clear (rf);
+ break;
+
+ default:
+ exit (1);
+ }
+
+ gmp_randclear (rstate);
+ }
+
+ mpz_clear (rz);
+
+ return 0;
+}
diff --git a/vendor/gmp-6.3.0/tests/rand/t-urbui.c b/vendor/gmp-6.3.0/tests/rand/t-urbui.c
new file mode 100644
index 0000000..f56f538
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/rand/t-urbui.c
@@ -0,0 +1,64 @@
+/* Test gmp_urandomb_ui.
+
+Copyright 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+/* Expect numbers generated by rstate to obey the number of bits requested.
+ No point testing bits==BITS_PER_ULONG, since any return is acceptable in
+ that case. */
+void
+check_one (const char *name, gmp_randstate_ptr rstate)
+{
+ unsigned long bits, limit, got;
+ int i;
+
+ for (bits = 0; bits < BITS_PER_ULONG; bits++)
+ {
+ /* will demand got < limit */
+ limit = (1UL << bits);
+
+ for (i = 0; i < 5; i++)
+ {
+ got = gmp_urandomb_ui (rstate, bits);
+ if (got >= limit)
+ {
+ printf ("Return value out of range:\n");
+ printf (" algorithm: %s\n", name);
+ printf (" bits: %lu\n", bits);
+ printf (" limit: %#lx\n", limit);
+ printf (" got: %#lx\n", got);
+ abort ();
+ }
+ }
+ }
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+
+ call_rand_algs (check_one);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/rand/t-urmui.c b/vendor/gmp-6.3.0/tests/rand/t-urmui.c
new file mode 100644
index 0000000..cc8fedb
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/rand/t-urmui.c
@@ -0,0 +1,74 @@
+/* Test gmp_urandomm_ui.
+
+Copyright 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+/* Expect numbers generated by rstate to obey the limit requested. */
+void
+check_one (const char *name, gmp_randstate_ptr rstate)
+{
+ static const unsigned long n_table[] = {
+ 1, 2, 3, 4, 5, 6, 7, 8,
+ 123, 456, 789,
+
+ 255, 256, 257,
+ 1023, 1024, 1025,
+ 32767, 32768, 32769,
+
+ ULONG_MAX/2-2, ULONG_MAX/2-1, ULONG_MAX/2, ULONG_MAX/2+1, ULONG_MAX/2+2,
+
+ ULONG_MAX-2, ULONG_MAX-1, ULONG_MAX,
+ };
+
+ unsigned long got, n;
+ int i, j;
+
+ for (i = 0; i < numberof (n_table); i++)
+ {
+ n = n_table[i];
+
+ for (j = 0; j < 5; j++)
+ {
+ got = gmp_urandomm_ui (rstate, n);
+ if (got >= n)
+ {
+ printf ("Return value out of range:\n");
+ printf (" algorithm: %s\n", name);
+ printf (" n: %#lx\n", n);
+ printf (" got: %#lx\n", got);
+ abort ();
+ }
+ }
+ }
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+
+ call_rand_algs (check_one);
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/rand/t-urndmm.c b/vendor/gmp-6.3.0/tests/rand/t-urndmm.c
new file mode 100644
index 0000000..ae700dd
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/rand/t-urndmm.c
@@ -0,0 +1,158 @@
+/* Test mpz_urandomm.
+
+Copyright 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+#ifndef TRUE
+#define TRUE (1)
+#endif
+#ifndef FALSE
+#define FALSE (0)
+#endif
+
+int
+check_params (void)
+{
+ gmp_randstate_t r1, r2;
+ mpz_t a, b, m;
+ int i;
+ int result;
+
+ result = TRUE;
+
+ mpz_init (a);
+ mpz_init (b);
+ mpz_init (m);
+
+ if (result)
+ {
+ /* Test the consistency between urandomm and urandomb. */
+ gmp_randinit_default (r1);
+ gmp_randinit_default (r2);
+ gmp_randseed_ui (r1, 85L);
+ gmp_randseed_ui (r2, 85L);
+ mpz_set_ui (m, 0L);
+ mpz_setbit (m, 80L);
+ for (i = 0; i < 100; i++)
+ {
+ mpz_urandomm (a, r1, m);
+ mpz_urandomb (b, r2, 80L);
+ if (mpz_cmp (a, b) != 0)
+ {
+ result = FALSE;
+ printf ("mpz_urandomm != mpz_urandomb\n");
+ break;
+ }
+ }
+ gmp_randclear (r1);
+ gmp_randclear (r2);
+ }
+
+ if (result)
+ {
+ /* Test that mpz_urandomm returns the correct result with a
+ broken LC. */
+ mpz_set_ui (a, 0L);
+ gmp_randinit_lc_2exp (r1, a, 0xffL, 8L);
+ mpz_set_ui (m, 5L);
+ /* Warning: This code hangs in gmp 4.1 and below */
+ for (i = 0; i < 100; i++)
+ {
+ mpz_urandomm (a, r1, m);
+ if (mpz_cmp_ui (a, 2L) != 0)
+ {
+ result = FALSE;
+ gmp_printf ("mpz_urandomm returns %Zd instead of 2\n", a);
+ break;
+ }
+ }
+ gmp_randclear (r1);
+ }
+
+ if (result)
+ {
+ /* Test that the results are always in range for either
+ positive or negative values of m. */
+ gmp_randinit_default (r1);
+ mpz_set_ui (m, 5L);
+ mpz_set_si (b, -5L);
+ for (i = 0; i < 100; i++)
+ {
+ mpz_urandomm (a, r1, m);
+ if (mpz_cmp_ui (a, 5L) >= 0 || mpz_sgn (a) < 0)
+ {
+ result = FALSE;
+ gmp_printf ("Out-of-range or non-positive value: %Zd\n", a);
+ break;
+ }
+ mpz_urandomm (a, r1, b);
+ if (mpz_cmp_ui (a, 5L) >= 0 || mpz_sgn (a) < 0)
+ {
+ result = FALSE;
+ gmp_printf ("Out-of-range or non-positive value (from negative modulus): %Zd\n", a);
+ break;
+ }
+ }
+ gmp_randclear (r1);
+ }
+
+ if (result)
+ {
+ /* Test that m=1 forces always result=0. */
+ gmp_randinit_default (r1);
+ mpz_set_ui (m, 1L);
+ for (i = 0; i < 100; i++)
+ {
+ mpz_urandomm (a, r1, m);
+ if (mpz_sgn (a) != 0)
+ {
+ result = FALSE;
+ gmp_printf ("mpz_urandomm fails with m=1 (result=%Zd)\n", a);
+ break;
+ }
+ }
+ gmp_randclear (r1);
+ }
+
+ mpz_clear (a);
+ mpz_clear (b);
+ mpz_clear (m);
+ return result;
+}
+
+int
+main (int argc, char *argv[])
+{
+ int result = TRUE;
+
+ tests_start ();
+
+ if (result)
+ if (!check_params ())
+ result = FALSE;
+
+ tests_end ();
+
+ if (result)
+ return 0; /* pass */
+ else
+ return 1; /* fail */
+}
diff --git a/vendor/gmp-6.3.0/tests/rand/zdiv_round.c b/vendor/gmp-6.3.0/tests/rand/zdiv_round.c
new file mode 100644
index 0000000..e42e694
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/rand/zdiv_round.c
@@ -0,0 +1,43 @@
+/* zdiv_round() -- divide integers, round to nearest */
+
+/*
+Copyright 1999 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+void
+zdiv_round (mpz_t rop, mpz_t n, mpz_t d)
+{
+ mpf_t f_n, f_d;
+
+ mpf_init (f_n);
+ mpf_init (f_d);
+
+ mpf_set_z (f_d, d);
+ mpf_set_z (f_n, n);
+
+ mpf_div (f_n, f_n, f_d);
+ mpf_set_d (f_d, .5);
+ if (mpf_sgn (f_n) < 0)
+ mpf_neg (f_d, f_d);
+ mpf_add (f_n, f_n, f_d);
+ mpz_set_f (rop, f_n);
+
+ mpf_clear (f_n);
+ mpf_clear (f_d);
+ return;
+}
diff --git a/vendor/gmp-6.3.0/tests/refmpf.c b/vendor/gmp-6.3.0/tests/refmpf.c
new file mode 100644
index 0000000..bc955a5
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/refmpf.c
@@ -0,0 +1,427 @@
+/* Reference floating point routines.
+
+Copyright 1996, 2001, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+refmpf_add (mpf_ptr w, mpf_srcptr u, mpf_srcptr v)
+{
+ mp_size_t hi, lo, size;
+ mp_ptr ut, vt, wt;
+ int neg;
+ mp_exp_t exp;
+ mp_limb_t cy;
+ TMP_DECL;
+
+ TMP_MARK;
+
+ if (SIZ (u) == 0)
+ {
+ size = ABSIZ (v);
+ wt = TMP_ALLOC_LIMBS (size + 1);
+ MPN_COPY (wt, PTR (v), size);
+ exp = EXP (v);
+ neg = SIZ (v) < 0;
+ goto done;
+ }
+ if (SIZ (v) == 0)
+ {
+ size = ABSIZ (u);
+ wt = TMP_ALLOC_LIMBS (size + 1);
+ MPN_COPY (wt, PTR (u), size);
+ exp = EXP (u);
+ neg = SIZ (u) < 0;
+ goto done;
+ }
+ if ((SIZ (u) ^ SIZ (v)) < 0)
+ {
+ mpf_t tmp;
+ SIZ (tmp) = -SIZ (v);
+ EXP (tmp) = EXP (v);
+ PTR (tmp) = PTR (v);
+ refmpf_sub (w, u, tmp);
+ return;
+ }
+ neg = SIZ (u) < 0;
+
+ /* Compute the significance of the hi and lo end of the result. */
+ hi = MAX (EXP (u), EXP (v));
+ lo = MIN (EXP (u) - ABSIZ (u), EXP (v) - ABSIZ (v));
+ size = hi - lo;
+ ut = TMP_ALLOC_LIMBS (size + 1);
+ vt = TMP_ALLOC_LIMBS (size + 1);
+ wt = TMP_ALLOC_LIMBS (size + 1);
+ MPN_ZERO (ut, size);
+ MPN_ZERO (vt, size);
+ {int off;
+ off = size + (EXP (u) - hi) - ABSIZ (u);
+ MPN_COPY (ut + off, PTR (u), ABSIZ (u));
+ off = size + (EXP (v) - hi) - ABSIZ (v);
+ MPN_COPY (vt + off, PTR (v), ABSIZ (v));
+ }
+
+ cy = mpn_add_n (wt, ut, vt, size);
+ wt[size] = cy;
+ size += cy;
+ exp = hi + cy;
+
+done:
+ if (size > PREC (w))
+ {
+ wt += size - PREC (w);
+ size = PREC (w);
+ }
+ MPN_COPY (PTR (w), wt, size);
+ SIZ (w) = neg == 0 ? size : -size;
+ EXP (w) = exp;
+ TMP_FREE;
+}
+
+
+/* Add 1 "unit in last place" (ie. in the least significant limb) to f.
+ f cannot be zero, since that has no well-defined "last place".
+
+ This routine is designed for use in cases where we pay close attention to
+ the size of the data value and are using that (and the exponent) to
+ indicate the accurate part of a result, or similar. For this reason, if
+ there's a carry out we don't store 1 and adjust the exponent, we just
+ leave 100..00. We don't even adjust if there's a carry out of prec+1
+ limbs, but instead give up in that case (which we intend shouldn't arise
+ in normal circumstances). */
+
+void
+refmpf_add_ulp (mpf_ptr f)
+{
+ mp_ptr fp = PTR(f);
+ mp_size_t fsize = SIZ(f);
+ mp_size_t abs_fsize = ABSIZ(f);
+ mp_limb_t c;
+
+ if (fsize == 0)
+ {
+ printf ("Oops, refmpf_add_ulp called with f==0\n");
+ abort ();
+ }
+
+ c = refmpn_add_1 (fp, fp, abs_fsize, CNST_LIMB(1));
+ if (c != 0)
+ {
+ if (abs_fsize >= PREC(f) + 1)
+ {
+ printf ("Oops, refmpf_add_ulp carried out of prec+1 limbs\n");
+ abort ();
+ }
+
+ fp[abs_fsize] = c;
+ abs_fsize++;
+ SIZ(f) = (fsize > 0 ? abs_fsize : - abs_fsize);
+ EXP(f)++;
+ }
+}
+
+/* Fill f with size limbs of the given value, setup as an integer. */
+void
+refmpf_fill (mpf_ptr f, mp_size_t size, mp_limb_t value)
+{
+ ASSERT (size >= 0);
+ size = MIN (PREC(f) + 1, size);
+ SIZ(f) = size;
+ EXP(f) = size;
+ refmpn_fill (PTR(f), size, value);
+}
+
+/* Strip high zero limbs from the f data, adjusting exponent accordingly. */
+void
+refmpf_normalize (mpf_ptr f)
+{
+ while (SIZ(f) != 0 && PTR(f)[ABSIZ(f)-1] == 0)
+ {
+ SIZ(f) = (SIZ(f) >= 0 ? SIZ(f)-1 : SIZ(f)+1);
+ EXP(f) --;
+ }
+ if (SIZ(f) == 0)
+ EXP(f) = 0;
+}
+
+/* refmpf_set_overlap sets up dst as a copy of src, but with PREC(dst)
+ unchanged, in preparation for an overlap test.
+
+ The full value of src is copied, and the space at PTR(dst) is extended as
+ necessary. The way PREC(dst) is unchanged is as per an mpf_set_prec_raw.
+ The return value is the new PTR(dst) space precision, in bits, ready for
+ a restoring mpf_set_prec_raw before mpf_clear. */
+
+unsigned long
+refmpf_set_overlap (mpf_ptr dst, mpf_srcptr src)
+{
+ mp_size_t dprec = PREC(dst);
+ mp_size_t ssize = ABSIZ(src);
+ unsigned long ret;
+
+ refmpf_set_prec_limbs (dst, (unsigned long) MAX (dprec, ssize));
+ mpf_set (dst, src);
+
+ ret = mpf_get_prec (dst);
+ PREC(dst) = dprec;
+ return ret;
+}
+
+/* Like mpf_set_prec, but taking a precision in limbs.
+ PREC(f) ends up as the given "prec" value. */
+void
+refmpf_set_prec_limbs (mpf_ptr f, unsigned long prec)
+{
+ mpf_set_prec (f, __GMPF_PREC_TO_BITS (prec));
+}
+
+
+void
+refmpf_sub (mpf_ptr w, mpf_srcptr u, mpf_srcptr v)
+{
+ mp_size_t hi, lo, size;
+ mp_ptr ut, vt, wt;
+ int neg;
+ mp_exp_t exp;
+ TMP_DECL;
+
+ TMP_MARK;
+
+ if (SIZ (u) == 0)
+ {
+ size = ABSIZ (v);
+ wt = TMP_ALLOC_LIMBS (size + 1);
+ MPN_COPY (wt, PTR (v), size);
+ exp = EXP (v);
+ neg = SIZ (v) > 0;
+ goto done;
+ }
+ if (SIZ (v) == 0)
+ {
+ size = ABSIZ (u);
+ wt = TMP_ALLOC_LIMBS (size + 1);
+ MPN_COPY (wt, PTR (u), size);
+ exp = EXP (u);
+ neg = SIZ (u) < 0;
+ goto done;
+ }
+ if ((SIZ (u) ^ SIZ (v)) < 0)
+ {
+ mpf_t tmp;
+ SIZ (tmp) = -SIZ (v);
+ EXP (tmp) = EXP (v);
+ PTR (tmp) = PTR (v);
+ refmpf_add (w, u, tmp);
+ if (SIZ (u) < 0)
+ mpf_neg (w, w);
+ return;
+ }
+ neg = SIZ (u) < 0;
+
+ /* Compute the significance of the hi and lo end of the result. */
+ hi = MAX (EXP (u), EXP (v));
+ lo = MIN (EXP (u) - ABSIZ (u), EXP (v) - ABSIZ (v));
+ size = hi - lo;
+ ut = TMP_ALLOC_LIMBS (size + 1);
+ vt = TMP_ALLOC_LIMBS (size + 1);
+ wt = TMP_ALLOC_LIMBS (size + 1);
+ MPN_ZERO (ut, size);
+ MPN_ZERO (vt, size);
+ {int off;
+ off = size + (EXP (u) - hi) - ABSIZ (u);
+ MPN_COPY (ut + off, PTR (u), ABSIZ (u));
+ off = size + (EXP (v) - hi) - ABSIZ (v);
+ MPN_COPY (vt + off, PTR (v), ABSIZ (v));
+ }
+
+ if (mpn_cmp (ut, vt, size) >= 0)
+ mpn_sub_n (wt, ut, vt, size);
+ else
+ {
+ mpn_sub_n (wt, vt, ut, size);
+ neg ^= 1;
+ }
+ exp = hi;
+ while (size != 0 && wt[size - 1] == 0)
+ {
+ size--;
+ exp--;
+ }
+
+done:
+ if (size > PREC (w))
+ {
+ wt += size - PREC (w);
+ size = PREC (w);
+ }
+ MPN_COPY (PTR (w), wt, size);
+ SIZ (w) = neg == 0 ? size : -size;
+ EXP (w) = exp;
+ TMP_FREE;
+}
+
+
+/* Validate got by comparing to want. Return 1 if good, 0 if bad.
+
+ The data in got is compared to that in want, up to either PREC(got) limbs
+ or the size of got, whichever is bigger. Clearly we always demand
+ PREC(got) of accuracy, but we go further and say that if got is bigger
+ then any extra must be correct too.
+
+ want needs to have enough data to allow this comparison. The size in
+ want doesn't have to be that big though, if it's smaller then further low
+ limbs are taken to be zero.
+
+ This validation approach is designed to allow some flexibility in exactly
+ how much data is generated by an mpf function, ie. either prec or prec+1
+ limbs. We don't try to make a reference function that emulates that same
+ size decision, instead the idea is for a validation function to generate
+ at least as much data as the real function, then compare. */
+
+int
+refmpf_validate (const char *name, mpf_srcptr got, mpf_srcptr want)
+{
+ int bad = 0;
+ mp_size_t gsize, wsize, cmpsize, i;
+ mp_srcptr gp, wp;
+ mp_limb_t glimb, wlimb;
+
+ MPF_CHECK_FORMAT (got);
+
+ if (EXP (got) != EXP (want))
+ {
+ printf ("%s: wrong exponent\n", name);
+ bad = 1;
+ }
+
+ gsize = SIZ (got);
+ wsize = SIZ (want);
+ if ((gsize < 0 && wsize > 0) || (gsize > 0 && wsize < 0))
+ {
+ printf ("%s: wrong sign\n", name);
+ bad = 1;
+ }
+
+ gsize = ABS (gsize);
+ wsize = ABS (wsize);
+
+ /* most significant limb of respective data */
+ gp = PTR (got) + gsize - 1;
+ wp = PTR (want) + wsize - 1;
+
+ /* compare limb data */
+ cmpsize = MAX (PREC (got), gsize);
+ for (i = 0; i < cmpsize; i++)
+ {
+ glimb = (i < gsize ? gp[-i] : 0);
+ wlimb = (i < wsize ? wp[-i] : 0);
+
+ if (glimb != wlimb)
+ {
+ printf ("%s: wrong data starting at index %ld from top\n",
+ name, (long) i);
+ bad = 1;
+ break;
+ }
+ }
+
+ if (bad)
+ {
+ printf (" prec %d\n", PREC(got));
+ printf (" exp got %ld\n", (long) EXP(got));
+ printf (" exp want %ld\n", (long) EXP(want));
+ printf (" size got %d\n", SIZ(got));
+ printf (" size want %d\n", SIZ(want));
+ printf (" limbs (high to low)\n");
+ printf (" got ");
+ for (i = ABSIZ(got)-1; i >= 0; i--)
+ {
+ gmp_printf ("%MX", PTR(got)[i]);
+ if (i != 0)
+ printf (",");
+ }
+ printf ("\n");
+ printf (" want ");
+ for (i = ABSIZ(want)-1; i >= 0; i--)
+ {
+ gmp_printf ("%MX", PTR(want)[i]);
+ if (i != 0)
+ printf (",");
+ }
+ printf ("\n");
+ return 0;
+ }
+
+ return 1;
+}
+
+
+int
+refmpf_validate_division (const char *name, mpf_srcptr got,
+ mpf_srcptr n, mpf_srcptr d)
+{
+ mp_size_t nsize, dsize, sign, prec, qsize, tsize;
+ mp_srcptr np, dp;
+ mp_ptr tp, qp, rp;
+ mpf_t want;
+ int ret;
+
+ nsize = SIZ (n);
+ dsize = SIZ (d);
+ ASSERT_ALWAYS (dsize != 0);
+
+ sign = nsize ^ dsize;
+ nsize = ABS (nsize);
+ dsize = ABS (dsize);
+
+ np = PTR (n);
+ dp = PTR (d);
+ prec = PREC (got);
+
+ EXP (want) = EXP (n) - EXP (d) + 1;
+
+ qsize = prec + 2; /* at least prec+1 limbs, after high zero */
+ tsize = qsize + dsize - 1; /* dividend size to give desired qsize */
+
+ /* dividend n, extended or truncated */
+ tp = refmpn_malloc_limbs (tsize);
+ refmpn_copy_extend (tp, tsize, np, nsize);
+
+ qp = refmpn_malloc_limbs (qsize);
+ rp = refmpn_malloc_limbs (dsize); /* remainder, unused */
+
+ ASSERT_ALWAYS (qsize == tsize - dsize + 1);
+ refmpn_tdiv_qr (qp, rp, (mp_size_t) 0, tp, tsize, dp, dsize);
+
+ PTR (want) = qp;
+ SIZ (want) = (sign >= 0 ? qsize : -qsize);
+ refmpf_normalize (want);
+
+ ret = refmpf_validate (name, got, want);
+
+ free (tp);
+ free (qp);
+ free (rp);
+
+ return ret;
+}
diff --git a/vendor/gmp-6.3.0/tests/refmpn.c b/vendor/gmp-6.3.0/tests/refmpn.c
new file mode 100644
index 0000000..42bb411
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/refmpn.c
@@ -0,0 +1,2630 @@
+/* Reference mpn functions, designed to be simple, portable and independent
+ of the normal gmp code. Speed isn't a consideration.
+
+Copyright 1996-2009, 2011-2014 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+/* Most routines have assertions representing what the mpn routines are
+ supposed to accept. Many of these reference routines do sensible things
+ outside these ranges (eg. for size==0), but the assertions are present to
+ pick up bad parameters passed here that are about to be passed the same
+ to a real mpn routine being compared. */
+
+/* always do assertion checking */
+#define WANT_ASSERT 1
+
+#include <stdio.h> /* for NULL */
+#include <stdlib.h> /* for malloc */
+
+#include "gmp-impl.h"
+#include "longlong.h"
+
+#include "tests.h"
+
+
+
+/* Return non-zero if regions {xp,xsize} and {yp,ysize} overlap, with sizes
+ in bytes. */
+int
+byte_overlap_p (const void *v_xp, mp_size_t xsize,
+ const void *v_yp, mp_size_t ysize)
+{
+ const char *xp = (const char *) v_xp;
+ const char *yp = (const char *) v_yp;
+
+ ASSERT (xsize >= 0);
+ ASSERT (ysize >= 0);
+
+ /* no wraparounds */
+ ASSERT (xp+xsize >= xp);
+ ASSERT (yp+ysize >= yp);
+
+ if (xp + xsize <= yp)
+ return 0;
+
+ if (yp + ysize <= xp)
+ return 0;
+
+ return 1;
+}
+
+/* Return non-zero if limb regions {xp,xsize} and {yp,ysize} overlap. */
+int
+refmpn_overlap_p (mp_srcptr xp, mp_size_t xsize, mp_srcptr yp, mp_size_t ysize)
+{
+ return byte_overlap_p (xp, xsize * GMP_LIMB_BYTES,
+ yp, ysize * GMP_LIMB_BYTES);
+}
+
+/* Check overlap for a routine defined to work low to high. */
+int
+refmpn_overlap_low_to_high_p (mp_srcptr dst, mp_srcptr src, mp_size_t size)
+{
+ return (dst <= src || ! refmpn_overlap_p (dst, size, src, size));
+}
+
+/* Check overlap for a routine defined to work high to low. */
+int
+refmpn_overlap_high_to_low_p (mp_srcptr dst, mp_srcptr src, mp_size_t size)
+{
+ return (dst >= src || ! refmpn_overlap_p (dst, size, src, size));
+}
+
+/* Check overlap for a standard routine requiring equal or separate. */
+int
+refmpn_overlap_fullonly_p (mp_srcptr dst, mp_srcptr src, mp_size_t size)
+{
+ return (dst == src || ! refmpn_overlap_p (dst, size, src, size));
+}
+int
+refmpn_overlap_fullonly_two_p (mp_srcptr dst, mp_srcptr src1, mp_srcptr src2,
+ mp_size_t size)
+{
+ return (refmpn_overlap_fullonly_p (dst, src1, size)
+ && refmpn_overlap_fullonly_p (dst, src2, size));
+}
+
+
+mp_ptr
+refmpn_malloc_limbs (mp_size_t size)
+{
+ mp_ptr p;
+ ASSERT (size >= 0);
+ if (size == 0)
+ size = 1;
+ p = (mp_ptr) malloc ((size_t) (size * GMP_LIMB_BYTES));
+ ASSERT (p != NULL);
+ return p;
+}
+
+/* Free limbs allocated by refmpn_malloc_limbs. NOTE: Can't free
+ * memory allocated by refmpn_malloc_limbs_aligned. */
+void
+refmpn_free_limbs (mp_ptr p)
+{
+ free (p);
+}
+
+mp_ptr
+refmpn_memdup_limbs (mp_srcptr ptr, mp_size_t size)
+{
+ mp_ptr p;
+ p = refmpn_malloc_limbs (size);
+ refmpn_copyi (p, ptr, size);
+ return p;
+}
+
+/* malloc n limbs on a multiple of m bytes boundary */
+mp_ptr
+refmpn_malloc_limbs_aligned (mp_size_t n, size_t m)
+{
+ return (mp_ptr) align_pointer (refmpn_malloc_limbs (n + m-1), m);
+}
+
+
+void
+refmpn_fill (mp_ptr ptr, mp_size_t size, mp_limb_t value)
+{
+ mp_size_t i;
+ ASSERT (size >= 0);
+ for (i = 0; i < size; i++)
+ ptr[i] = value;
+}
+
+void
+refmpn_zero (mp_ptr ptr, mp_size_t size)
+{
+ refmpn_fill (ptr, size, CNST_LIMB(0));
+}
+
+void
+refmpn_zero_extend (mp_ptr ptr, mp_size_t oldsize, mp_size_t newsize)
+{
+ ASSERT (newsize >= oldsize);
+ refmpn_zero (ptr+oldsize, newsize-oldsize);
+}
+
+int
+refmpn_zero_p (mp_srcptr ptr, mp_size_t size)
+{
+ mp_size_t i;
+ for (i = 0; i < size; i++)
+ if (ptr[i] != 0)
+ return 0;
+ return 1;
+}
+
+mp_size_t
+refmpn_normalize (mp_srcptr ptr, mp_size_t size)
+{
+ ASSERT (size >= 0);
+ while (size > 0 && ptr[size-1] == 0)
+ size--;
+ return size;
+}
+
+/* the highest one bit in x */
+mp_limb_t
+refmpn_msbone (mp_limb_t x)
+{
+ mp_limb_t n = (mp_limb_t) 1 << (GMP_LIMB_BITS-1);
+
+ while (n != 0)
+ {
+ if (x & n)
+ break;
+ n >>= 1;
+ }
+ return n;
+}
+
+/* a mask of the highest one bit plus and all bits below */
+mp_limb_t
+refmpn_msbone_mask (mp_limb_t x)
+{
+ if (x == 0)
+ return 0;
+
+ return (refmpn_msbone (x) << 1) - 1;
+}
+
+/* How many digits in the given base will fit in a limb.
+ Notice that the product b is allowed to be equal to the limit
+ 2^GMP_NUMB_BITS, this ensures the result for base==2 will be
+ GMP_NUMB_BITS (and similarly other powers of 2). */
+int
+refmpn_chars_per_limb (int base)
+{
+ mp_limb_t limit[2], b[2];
+ int chars_per_limb;
+
+ ASSERT (base >= 2);
+
+ limit[0] = 0; /* limit = 2^GMP_NUMB_BITS */
+ limit[1] = 1;
+ b[0] = 1; /* b = 1 */
+ b[1] = 0;
+
+ chars_per_limb = 0;
+ for (;;)
+ {
+ if (refmpn_mul_1 (b, b, (mp_size_t) 2, (mp_limb_t) base))
+ break;
+ if (refmpn_cmp (b, limit, (mp_size_t) 2) > 0)
+ break;
+ chars_per_limb++;
+ }
+ return chars_per_limb;
+}
+
+/* The biggest value base**n which fits in GMP_NUMB_BITS. */
+mp_limb_t
+refmpn_big_base (int base)
+{
+ int chars_per_limb = refmpn_chars_per_limb (base);
+ int i;
+ mp_limb_t bb;
+
+ ASSERT (base >= 2);
+ bb = 1;
+ for (i = 0; i < chars_per_limb; i++)
+ bb *= base;
+ return bb;
+}
+
+
+void
+refmpn_setbit (mp_ptr ptr, unsigned long bit)
+{
+ ptr[bit/GMP_NUMB_BITS] |= CNST_LIMB(1) << (bit%GMP_NUMB_BITS);
+}
+
+void
+refmpn_clrbit (mp_ptr ptr, unsigned long bit)
+{
+ ptr[bit/GMP_NUMB_BITS] &= ~ (CNST_LIMB(1) << (bit%GMP_NUMB_BITS));
+}
+
+#define REFMPN_TSTBIT(ptr,bit) \
+ (((ptr)[(bit)/GMP_NUMB_BITS] & (CNST_LIMB(1) << ((bit)%GMP_NUMB_BITS))) != 0)
+
+int
+refmpn_tstbit (mp_srcptr ptr, unsigned long bit)
+{
+ return REFMPN_TSTBIT (ptr, bit);
+}
+
+unsigned long
+refmpn_scan0 (mp_srcptr ptr, unsigned long bit)
+{
+ while (REFMPN_TSTBIT (ptr, bit) != 0)
+ bit++;
+ return bit;
+}
+
+unsigned long
+refmpn_scan1 (mp_srcptr ptr, unsigned long bit)
+{
+ while (REFMPN_TSTBIT (ptr, bit) == 0)
+ bit++;
+ return bit;
+}
+
+void
+refmpn_copy (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+ ASSERT (refmpn_overlap_fullonly_p (rp, sp, size));
+ refmpn_copyi (rp, sp, size);
+}
+
+void
+refmpn_copyi (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+ mp_size_t i;
+
+ ASSERT (refmpn_overlap_low_to_high_p (rp, sp, size));
+ ASSERT (size >= 0);
+
+ for (i = 0; i < size; i++)
+ rp[i] = sp[i];
+}
+
+void
+refmpn_copyd (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+ mp_size_t i;
+
+ ASSERT (refmpn_overlap_high_to_low_p (rp, sp, size));
+ ASSERT (size >= 0);
+
+ for (i = size-1; i >= 0; i--)
+ rp[i] = sp[i];
+}
+
+/* Copy {xp,xsize} to {wp,wsize}. If x is shorter, then pad w with low
+ zeros to wsize. If x is longer, then copy just the high wsize limbs. */
+void
+refmpn_copy_extend (mp_ptr wp, mp_size_t wsize, mp_srcptr xp, mp_size_t xsize)
+{
+ ASSERT (wsize >= 0);
+ ASSERT (xsize >= 0);
+
+ /* high part of x if x bigger than w */
+ if (xsize > wsize)
+ {
+ xp += xsize - wsize;
+ xsize = wsize;
+ }
+
+ refmpn_copy (wp + wsize-xsize, xp, xsize);
+ refmpn_zero (wp, wsize-xsize);
+}
+
+int
+refmpn_cmp (mp_srcptr xp, mp_srcptr yp, mp_size_t size)
+{
+ mp_size_t i;
+
+ ASSERT (size >= 1);
+ ASSERT_MPN (xp, size);
+ ASSERT_MPN (yp, size);
+
+ for (i = size-1; i >= 0; i--)
+ {
+ if (xp[i] > yp[i]) return 1;
+ if (xp[i] < yp[i]) return -1;
+ }
+ return 0;
+}
+
+int
+refmpn_cmp_allowzero (mp_srcptr xp, mp_srcptr yp, mp_size_t size)
+{
+ if (size == 0)
+ return 0;
+ else
+ return refmpn_cmp (xp, yp, size);
+}
+
+int
+refmpn_cmp_twosizes (mp_srcptr xp, mp_size_t xsize,
+ mp_srcptr yp, mp_size_t ysize)
+{
+ int opp, cmp;
+
+ ASSERT_MPN (xp, xsize);
+ ASSERT_MPN (yp, ysize);
+
+ opp = (xsize < ysize);
+ if (opp)
+ MPN_SRCPTR_SWAP (xp,xsize, yp,ysize);
+
+ if (! refmpn_zero_p (xp+ysize, xsize-ysize))
+ cmp = 1;
+ else
+ cmp = refmpn_cmp (xp, yp, ysize);
+
+ return (opp ? -cmp : cmp);
+}
+
+int
+refmpn_equal_anynail (mp_srcptr xp, mp_srcptr yp, mp_size_t size)
+{
+ mp_size_t i;
+ ASSERT (size >= 0);
+
+ for (i = 0; i < size; i++)
+ if (xp[i] != yp[i])
+ return 0;
+ return 1;
+}
+
+
+#define LOGOPS(operation) \
+ { \
+ mp_size_t i; \
+ \
+ ASSERT (refmpn_overlap_fullonly_two_p (rp, s1p, s2p, size)); \
+ ASSERT (size >= 1); \
+ ASSERT_MPN (s1p, size); \
+ ASSERT_MPN (s2p, size); \
+ \
+ for (i = 0; i < size; i++) \
+ rp[i] = operation; \
+ }
+
+void
+refmpn_and_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
+{
+ LOGOPS (s1p[i] & s2p[i]);
+}
+void
+refmpn_andn_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
+{
+ LOGOPS (s1p[i] & ~s2p[i]);
+}
+void
+refmpn_nand_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
+{
+ LOGOPS ((s1p[i] & s2p[i]) ^ GMP_NUMB_MASK);
+}
+void
+refmpn_ior_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
+{
+ LOGOPS (s1p[i] | s2p[i]);
+}
+void
+refmpn_iorn_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
+{
+ LOGOPS (s1p[i] | (s2p[i] ^ GMP_NUMB_MASK));
+}
+void
+refmpn_nior_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
+{
+ LOGOPS ((s1p[i] | s2p[i]) ^ GMP_NUMB_MASK);
+}
+void
+refmpn_xor_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
+{
+ LOGOPS (s1p[i] ^ s2p[i]);
+}
+void
+refmpn_xnor_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
+{
+ LOGOPS ((s1p[i] ^ s2p[i]) ^ GMP_NUMB_MASK);
+}
+
+
+/* set *dh,*dl to mh:ml - sh:sl, in full limbs */
+void
+refmpn_sub_ddmmss (mp_limb_t *dh, mp_limb_t *dl,
+ mp_limb_t mh, mp_limb_t ml, mp_limb_t sh, mp_limb_t sl)
+{
+ *dl = ml - sl;
+ *dh = mh - sh - (ml < sl);
+}
+
+
+/* set *w to x+y, return 0 or 1 carry */
+mp_limb_t
+ref_addc_limb (mp_limb_t *w, mp_limb_t x, mp_limb_t y)
+{
+ mp_limb_t sum, cy;
+
+ ASSERT_LIMB (x);
+ ASSERT_LIMB (y);
+
+ sum = x + y;
+#if GMP_NAIL_BITS == 0
+ *w = sum;
+ cy = (sum < x);
+#else
+ *w = sum & GMP_NUMB_MASK;
+ cy = (sum >> GMP_NUMB_BITS);
+#endif
+ return cy;
+}
+
+/* set *w to x-y, return 0 or 1 borrow */
+mp_limb_t
+ref_subc_limb (mp_limb_t *w, mp_limb_t x, mp_limb_t y)
+{
+ mp_limb_t diff, cy;
+
+ ASSERT_LIMB (x);
+ ASSERT_LIMB (y);
+
+ diff = x - y;
+#if GMP_NAIL_BITS == 0
+ *w = diff;
+ cy = (diff > x);
+#else
+ *w = diff & GMP_NUMB_MASK;
+ cy = (diff >> GMP_NUMB_BITS) & 1;
+#endif
+ return cy;
+}
+
+/* set *w to x+y+c (where c is 0 or 1), return 0 or 1 carry */
+mp_limb_t
+adc (mp_limb_t *w, mp_limb_t x, mp_limb_t y, mp_limb_t c)
+{
+ mp_limb_t r;
+
+ ASSERT_LIMB (x);
+ ASSERT_LIMB (y);
+ ASSERT (c == 0 || c == 1);
+
+ r = ref_addc_limb (w, x, y);
+ return r + ref_addc_limb (w, *w, c);
+}
+
+/* set *w to x-y-c (where c is 0 or 1), return 0 or 1 borrow */
+mp_limb_t
+sbb (mp_limb_t *w, mp_limb_t x, mp_limb_t y, mp_limb_t c)
+{
+ mp_limb_t r;
+
+ ASSERT_LIMB (x);
+ ASSERT_LIMB (y);
+ ASSERT (c == 0 || c == 1);
+
+ r = ref_subc_limb (w, x, y);
+ return r + ref_subc_limb (w, *w, c);
+}
+
+
+#define AORS_1(operation) \
+ { \
+ mp_size_t i; \
+ \
+ ASSERT (refmpn_overlap_fullonly_p (rp, sp, size)); \
+ ASSERT (size >= 1); \
+ ASSERT_MPN (sp, size); \
+ ASSERT_LIMB (n); \
+ \
+ for (i = 0; i < size; i++) \
+ n = operation (&rp[i], sp[i], n); \
+ return n; \
+ }
+
+mp_limb_t
+refmpn_add_1 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_limb_t n)
+{
+ AORS_1 (ref_addc_limb);
+}
+mp_limb_t
+refmpn_sub_1 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_limb_t n)
+{
+ AORS_1 (ref_subc_limb);
+}
+
+#define AORS_NC(operation) \
+ { \
+ mp_size_t i; \
+ \
+ ASSERT (refmpn_overlap_fullonly_two_p (rp, s1p, s2p, size)); \
+ ASSERT (carry == 0 || carry == 1); \
+ ASSERT (size >= 1); \
+ ASSERT_MPN (s1p, size); \
+ ASSERT_MPN (s2p, size); \
+ \
+ for (i = 0; i < size; i++) \
+ carry = operation (&rp[i], s1p[i], s2p[i], carry); \
+ return carry; \
+ }
+
+mp_limb_t
+refmpn_add_nc (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size,
+ mp_limb_t carry)
+{
+ AORS_NC (adc);
+}
+mp_limb_t
+refmpn_sub_nc (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size,
+ mp_limb_t carry)
+{
+ AORS_NC (sbb);
+}
+
+
+mp_limb_t
+refmpn_add_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
+{
+ return refmpn_add_nc (rp, s1p, s2p, size, CNST_LIMB(0));
+}
+mp_limb_t
+refmpn_sub_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
+{
+ return refmpn_sub_nc (rp, s1p, s2p, size, CNST_LIMB(0));
+}
+
+mp_limb_t
+refmpn_cnd_add_n (mp_limb_t cnd, mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
+{
+ if (cnd != 0)
+ return refmpn_add_n (rp, s1p, s2p, size);
+ else
+ {
+ refmpn_copyi (rp, s1p, size);
+ return 0;
+ }
+}
+mp_limb_t
+refmpn_cnd_sub_n (mp_limb_t cnd, mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
+{
+ if (cnd != 0)
+ return refmpn_sub_n (rp, s1p, s2p, size);
+ else
+ {
+ refmpn_copyi (rp, s1p, size);
+ return 0;
+ }
+}
+
+
+#define AORS_ERR1_N(operation) \
+ { \
+ mp_size_t i; \
+ mp_limb_t carry2; \
+ \
+ ASSERT (refmpn_overlap_fullonly_p (rp, s1p, size)); \
+ ASSERT (refmpn_overlap_fullonly_p (rp, s2p, size)); \
+ ASSERT (! refmpn_overlap_p (rp, size, yp, size)); \
+ ASSERT (! refmpn_overlap_p (ep, 2, s1p, size)); \
+ ASSERT (! refmpn_overlap_p (ep, 2, s2p, size)); \
+ ASSERT (! refmpn_overlap_p (ep, 2, yp, size)); \
+ ASSERT (! refmpn_overlap_p (ep, 2, rp, size)); \
+ \
+ ASSERT (carry == 0 || carry == 1); \
+ ASSERT (size >= 1); \
+ ASSERT_MPN (s1p, size); \
+ ASSERT_MPN (s2p, size); \
+ ASSERT_MPN (yp, size); \
+ \
+ ep[0] = ep[1] = CNST_LIMB(0); \
+ \
+ for (i = 0; i < size; i++) \
+ { \
+ carry = operation (&rp[i], s1p[i], s2p[i], carry); \
+ if (carry == 1) \
+ { \
+ carry2 = ref_addc_limb (&ep[0], ep[0], yp[size - 1 - i]); \
+ carry2 = ref_addc_limb (&ep[1], ep[1], carry2); \
+ ASSERT (carry2 == 0); \
+ } \
+ } \
+ return carry; \
+ }
+
+mp_limb_t
+refmpn_add_err1_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p,
+ mp_ptr ep, mp_srcptr yp,
+ mp_size_t size, mp_limb_t carry)
+{
+ AORS_ERR1_N (adc);
+}
+mp_limb_t
+refmpn_sub_err1_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p,
+ mp_ptr ep, mp_srcptr yp,
+ mp_size_t size, mp_limb_t carry)
+{
+ AORS_ERR1_N (sbb);
+}
+
+
+#define AORS_ERR2_N(operation) \
+ { \
+ mp_size_t i; \
+ mp_limb_t carry2; \
+ \
+ ASSERT (refmpn_overlap_fullonly_p (rp, s1p, size)); \
+ ASSERT (refmpn_overlap_fullonly_p (rp, s2p, size)); \
+ ASSERT (! refmpn_overlap_p (rp, size, y1p, size)); \
+ ASSERT (! refmpn_overlap_p (rp, size, y2p, size)); \
+ ASSERT (! refmpn_overlap_p (ep, 4, s1p, size)); \
+ ASSERT (! refmpn_overlap_p (ep, 4, s2p, size)); \
+ ASSERT (! refmpn_overlap_p (ep, 4, y1p, size)); \
+ ASSERT (! refmpn_overlap_p (ep, 4, y2p, size)); \
+ ASSERT (! refmpn_overlap_p (ep, 4, rp, size)); \
+ \
+ ASSERT (carry == 0 || carry == 1); \
+ ASSERT (size >= 1); \
+ ASSERT_MPN (s1p, size); \
+ ASSERT_MPN (s2p, size); \
+ ASSERT_MPN (y1p, size); \
+ ASSERT_MPN (y2p, size); \
+ \
+ ep[0] = ep[1] = CNST_LIMB(0); \
+ ep[2] = ep[3] = CNST_LIMB(0); \
+ \
+ for (i = 0; i < size; i++) \
+ { \
+ carry = operation (&rp[i], s1p[i], s2p[i], carry); \
+ if (carry == 1) \
+ { \
+ carry2 = ref_addc_limb (&ep[0], ep[0], y1p[size - 1 - i]); \
+ carry2 = ref_addc_limb (&ep[1], ep[1], carry2); \
+ ASSERT (carry2 == 0); \
+ carry2 = ref_addc_limb (&ep[2], ep[2], y2p[size - 1 - i]); \
+ carry2 = ref_addc_limb (&ep[3], ep[3], carry2); \
+ ASSERT (carry2 == 0); \
+ } \
+ } \
+ return carry; \
+ }
+
+mp_limb_t
+refmpn_add_err2_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p,
+ mp_ptr ep, mp_srcptr y1p, mp_srcptr y2p,
+ mp_size_t size, mp_limb_t carry)
+{
+ AORS_ERR2_N (adc);
+}
+mp_limb_t
+refmpn_sub_err2_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p,
+ mp_ptr ep, mp_srcptr y1p, mp_srcptr y2p,
+ mp_size_t size, mp_limb_t carry)
+{
+ AORS_ERR2_N (sbb);
+}
+
+
+#define AORS_ERR3_N(operation) \
+ { \
+ mp_size_t i; \
+ mp_limb_t carry2; \
+ \
+ ASSERT (refmpn_overlap_fullonly_p (rp, s1p, size)); \
+ ASSERT (refmpn_overlap_fullonly_p (rp, s2p, size)); \
+ ASSERT (! refmpn_overlap_p (rp, size, y1p, size)); \
+ ASSERT (! refmpn_overlap_p (rp, size, y2p, size)); \
+ ASSERT (! refmpn_overlap_p (rp, size, y3p, size)); \
+ ASSERT (! refmpn_overlap_p (ep, 6, s1p, size)); \
+ ASSERT (! refmpn_overlap_p (ep, 6, s2p, size)); \
+ ASSERT (! refmpn_overlap_p (ep, 6, y1p, size)); \
+ ASSERT (! refmpn_overlap_p (ep, 6, y2p, size)); \
+ ASSERT (! refmpn_overlap_p (ep, 6, y3p, size)); \
+ ASSERT (! refmpn_overlap_p (ep, 6, rp, size)); \
+ \
+ ASSERT (carry == 0 || carry == 1); \
+ ASSERT (size >= 1); \
+ ASSERT_MPN (s1p, size); \
+ ASSERT_MPN (s2p, size); \
+ ASSERT_MPN (y1p, size); \
+ ASSERT_MPN (y2p, size); \
+ ASSERT_MPN (y3p, size); \
+ \
+ ep[0] = ep[1] = CNST_LIMB(0); \
+ ep[2] = ep[3] = CNST_LIMB(0); \
+ ep[4] = ep[5] = CNST_LIMB(0); \
+ \
+ for (i = 0; i < size; i++) \
+ { \
+ carry = operation (&rp[i], s1p[i], s2p[i], carry); \
+ if (carry == 1) \
+ { \
+ carry2 = ref_addc_limb (&ep[0], ep[0], y1p[size - 1 - i]); \
+ carry2 = ref_addc_limb (&ep[1], ep[1], carry2); \
+ ASSERT (carry2 == 0); \
+ carry2 = ref_addc_limb (&ep[2], ep[2], y2p[size - 1 - i]); \
+ carry2 = ref_addc_limb (&ep[3], ep[3], carry2); \
+ ASSERT (carry2 == 0); \
+ carry2 = ref_addc_limb (&ep[4], ep[4], y3p[size - 1 - i]); \
+ carry2 = ref_addc_limb (&ep[5], ep[5], carry2); \
+ ASSERT (carry2 == 0); \
+ } \
+ } \
+ return carry; \
+ }
+
+mp_limb_t
+refmpn_add_err3_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p,
+ mp_ptr ep, mp_srcptr y1p, mp_srcptr y2p, mp_srcptr y3p,
+ mp_size_t size, mp_limb_t carry)
+{
+ AORS_ERR3_N (adc);
+}
+mp_limb_t
+refmpn_sub_err3_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p,
+ mp_ptr ep, mp_srcptr y1p, mp_srcptr y2p, mp_srcptr y3p,
+ mp_size_t size, mp_limb_t carry)
+{
+ AORS_ERR3_N (sbb);
+}
+
+
+mp_limb_t
+refmpn_addlsh_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
+ mp_size_t n, unsigned int s)
+{
+ mp_limb_t cy;
+ mp_ptr tp;
+
+ ASSERT (refmpn_overlap_fullonly_two_p (rp, up, vp, n));
+ ASSERT (n >= 1);
+ ASSERT (0 < s && s < GMP_NUMB_BITS);
+ ASSERT_MPN (up, n);
+ ASSERT_MPN (vp, n);
+
+ tp = refmpn_malloc_limbs (n);
+ cy = refmpn_lshift (tp, vp, n, s);
+ cy += refmpn_add_n (rp, up, tp, n);
+ free (tp);
+ return cy;
+}
+mp_limb_t
+refmpn_addlsh1_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
+{
+ return refmpn_addlsh_n (rp, up, vp, n, 1);
+}
+mp_limb_t
+refmpn_addlsh2_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
+{
+ return refmpn_addlsh_n (rp, up, vp, n, 2);
+}
+mp_limb_t
+refmpn_addlsh_n_ip1 (mp_ptr rp, mp_srcptr vp, mp_size_t n, unsigned int s)
+{
+ return refmpn_addlsh_n (rp, rp, vp, n, s);
+}
+mp_limb_t
+refmpn_addlsh1_n_ip1 (mp_ptr rp, mp_srcptr vp, mp_size_t n)
+{
+ return refmpn_addlsh_n (rp, rp, vp, n, 1);
+}
+mp_limb_t
+refmpn_addlsh2_n_ip1 (mp_ptr rp, mp_srcptr vp, mp_size_t n)
+{
+ return refmpn_addlsh_n (rp, rp, vp, n, 2);
+}
+mp_limb_t
+refmpn_addlsh_n_ip2 (mp_ptr rp, mp_srcptr vp, mp_size_t n, unsigned int s)
+{
+ return refmpn_addlsh_n (rp, vp, rp, n, s);
+}
+mp_limb_t
+refmpn_addlsh1_n_ip2 (mp_ptr rp, mp_srcptr vp, mp_size_t n)
+{
+ return refmpn_addlsh_n (rp, vp, rp, n, 1);
+}
+mp_limb_t
+refmpn_addlsh2_n_ip2 (mp_ptr rp, mp_srcptr vp, mp_size_t n)
+{
+ return refmpn_addlsh_n (rp, vp, rp, n, 2);
+}
+mp_limb_t
+refmpn_addlsh_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
+ mp_size_t n, unsigned int s, mp_limb_t carry)
+{
+ mp_limb_t cy;
+
+ ASSERT (carry <= (CNST_LIMB(1) << s));
+
+ cy = refmpn_addlsh_n (rp, up, vp, n, s);
+ cy += refmpn_add_1 (rp, rp, n, carry);
+ return cy;
+}
+mp_limb_t
+refmpn_addlsh1_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t carry)
+{
+ return refmpn_addlsh_nc (rp, up, vp, n, 1, carry);
+}
+mp_limb_t
+refmpn_addlsh2_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t carry)
+{
+ return refmpn_addlsh_nc (rp, up, vp, n, 2, carry);
+}
+
+mp_limb_t
+refmpn_sublsh_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
+ mp_size_t n, unsigned int s)
+{
+ mp_limb_t cy;
+ mp_ptr tp;
+
+ ASSERT (refmpn_overlap_fullonly_two_p (rp, up, vp, n));
+ ASSERT (n >= 1);
+ ASSERT (0 < s && s < GMP_NUMB_BITS);
+ ASSERT_MPN (up, n);
+ ASSERT_MPN (vp, n);
+
+ tp = refmpn_malloc_limbs (n);
+ cy = mpn_lshift (tp, vp, n, s);
+ cy += mpn_sub_n (rp, up, tp, n);
+ free (tp);
+ return cy;
+}
+mp_limb_t
+refmpn_sublsh1_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
+{
+ return refmpn_sublsh_n (rp, up, vp, n, 1);
+}
+mp_limb_t
+refmpn_sublsh2_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
+{
+ return refmpn_sublsh_n (rp, up, vp, n, 2);
+}
+mp_limb_t
+refmpn_sublsh_n_ip1 (mp_ptr rp, mp_srcptr vp, mp_size_t n, unsigned int s)
+{
+ return refmpn_sublsh_n (rp, rp, vp, n, s);
+}
+mp_limb_t
+refmpn_sublsh1_n_ip1 (mp_ptr rp, mp_srcptr vp, mp_size_t n)
+{
+ return refmpn_sublsh_n (rp, rp, vp, n, 1);
+}
+mp_limb_t
+refmpn_sublsh2_n_ip1 (mp_ptr rp, mp_srcptr vp, mp_size_t n)
+{
+ return refmpn_sublsh_n (rp, rp, vp, n, 2);
+}
+mp_limb_t
+refmpn_sublsh_n_ip2 (mp_ptr rp, mp_srcptr vp, mp_size_t n, unsigned int s)
+{
+ return refmpn_sublsh_n (rp, vp, rp, n, s);
+}
+mp_limb_t
+refmpn_sublsh1_n_ip2 (mp_ptr rp, mp_srcptr vp, mp_size_t n)
+{
+ return refmpn_sublsh_n (rp, vp, rp, n, 1);
+}
+mp_limb_t
+refmpn_sublsh2_n_ip2 (mp_ptr rp, mp_srcptr vp, mp_size_t n)
+{
+ return refmpn_sublsh_n (rp, vp, rp, n, 2);
+}
+mp_limb_t
+refmpn_sublsh_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
+ mp_size_t n, unsigned int s, mp_limb_t carry)
+{
+ mp_limb_t cy;
+
+ ASSERT (carry <= (CNST_LIMB(1) << s));
+
+ cy = refmpn_sublsh_n (rp, up, vp, n, s);
+ cy += refmpn_sub_1 (rp, rp, n, carry);
+ return cy;
+}
+mp_limb_t
+refmpn_sublsh1_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t carry)
+{
+ return refmpn_sublsh_nc (rp, up, vp, n, 1, carry);
+}
+mp_limb_t
+refmpn_sublsh2_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t carry)
+{
+ return refmpn_sublsh_nc (rp, up, vp, n, 2, carry);
+}
+
+mp_limb_signed_t
+refmpn_rsblsh_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
+ mp_size_t n, unsigned int s)
+{
+ mp_limb_signed_t cy;
+ mp_ptr tp;
+
+ ASSERT (refmpn_overlap_fullonly_two_p (rp, up, vp, n));
+ ASSERT (n >= 1);
+ ASSERT (0 < s && s < GMP_NUMB_BITS);
+ ASSERT_MPN (up, n);
+ ASSERT_MPN (vp, n);
+
+ tp = refmpn_malloc_limbs (n);
+ cy = mpn_lshift (tp, vp, n, s);
+ cy -= mpn_sub_n (rp, tp, up, n);
+ free (tp);
+ return cy;
+}
+mp_limb_signed_t
+refmpn_rsblsh1_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
+{
+ return refmpn_rsblsh_n (rp, up, vp, n, 1);
+}
+mp_limb_signed_t
+refmpn_rsblsh2_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
+{
+ return refmpn_rsblsh_n (rp, up, vp, n, 2);
+}
+mp_limb_signed_t
+refmpn_rsblsh_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
+ mp_size_t n, unsigned int s, mp_limb_signed_t carry)
+{
+ mp_limb_signed_t cy;
+
+ ASSERT (carry == -1 || (carry >> s) == 0);
+
+ cy = refmpn_rsblsh_n (rp, up, vp, n, s);
+ if (carry > 0)
+ cy += refmpn_add_1 (rp, rp, n, carry);
+ else
+ cy -= refmpn_sub_1 (rp, rp, n, -carry);
+ return cy;
+}
+mp_limb_signed_t
+refmpn_rsblsh1_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_signed_t carry)
+{
+ return refmpn_rsblsh_nc (rp, up, vp, n, 1, carry);
+}
+mp_limb_signed_t
+refmpn_rsblsh2_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_signed_t carry)
+{
+ return refmpn_rsblsh_nc (rp, up, vp, n, 2, carry);
+}
+
+mp_limb_t
+refmpn_rsh1add_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
+{
+ mp_limb_t cya, cys;
+
+ ASSERT (refmpn_overlap_fullonly_two_p (rp, up, vp, n));
+ ASSERT (n >= 1);
+ ASSERT_MPN (up, n);
+ ASSERT_MPN (vp, n);
+
+ cya = mpn_add_n (rp, up, vp, n);
+ cys = mpn_rshift (rp, rp, n, 1) >> (GMP_NUMB_BITS - 1);
+ rp[n - 1] |= cya << (GMP_NUMB_BITS - 1);
+ return cys;
+}
+mp_limb_t
+refmpn_rsh1sub_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
+{
+ mp_limb_t cya, cys;
+
+ ASSERT (refmpn_overlap_fullonly_two_p (rp, up, vp, n));
+ ASSERT (n >= 1);
+ ASSERT_MPN (up, n);
+ ASSERT_MPN (vp, n);
+
+ cya = mpn_sub_n (rp, up, vp, n);
+ cys = mpn_rshift (rp, rp, n, 1) >> (GMP_NUMB_BITS - 1);
+ rp[n - 1] |= cya << (GMP_NUMB_BITS - 1);
+ return cys;
+}
+
+/* Twos complement, return borrow. */
+mp_limb_t
+refmpn_neg (mp_ptr dst, mp_srcptr src, mp_size_t size)
+{
+ mp_ptr zeros;
+ mp_limb_t ret;
+
+ ASSERT (size >= 1);
+
+ zeros = refmpn_malloc_limbs (size);
+ refmpn_fill (zeros, size, CNST_LIMB(0));
+ ret = refmpn_sub_n (dst, zeros, src, size);
+ free (zeros);
+ return ret;
+}
+
+
+#define AORS(aors_n, aors_1) \
+ { \
+ mp_limb_t c; \
+ ASSERT (s1size >= s2size); \
+ ASSERT (s2size >= 1); \
+ c = aors_n (rp, s1p, s2p, s2size); \
+ if (s1size-s2size != 0) \
+ c = aors_1 (rp+s2size, s1p+s2size, s1size-s2size, c); \
+ return c; \
+ }
+mp_limb_t
+refmpn_add (mp_ptr rp,
+ mp_srcptr s1p, mp_size_t s1size,
+ mp_srcptr s2p, mp_size_t s2size)
+{
+ AORS (refmpn_add_n, refmpn_add_1);
+}
+mp_limb_t
+refmpn_sub (mp_ptr rp,
+ mp_srcptr s1p, mp_size_t s1size,
+ mp_srcptr s2p, mp_size_t s2size)
+{
+ AORS (refmpn_sub_n, refmpn_sub_1);
+}
+
+
+#define SHIFTHIGH(x) ((x) << GMP_LIMB_BITS/2)
+#define SHIFTLOW(x) ((x) >> GMP_LIMB_BITS/2)
+
+#define LOWMASK (((mp_limb_t) 1 << GMP_LIMB_BITS/2)-1)
+#define HIGHMASK SHIFTHIGH(LOWMASK)
+
+#define LOWPART(x) ((x) & LOWMASK)
+#define HIGHPART(x) SHIFTLOW((x) & HIGHMASK)
+
+/* Set return:*lo to x*y, using full limbs not nails. */
+mp_limb_t
+refmpn_umul_ppmm (mp_limb_t *lo, mp_limb_t x, mp_limb_t y)
+{
+ mp_limb_t hi, s;
+
+ *lo = LOWPART(x) * LOWPART(y);
+ hi = HIGHPART(x) * HIGHPART(y);
+
+ s = LOWPART(x) * HIGHPART(y);
+ hi += HIGHPART(s);
+ s = SHIFTHIGH(LOWPART(s));
+ *lo += s;
+ hi += (*lo < s);
+
+ s = HIGHPART(x) * LOWPART(y);
+ hi += HIGHPART(s);
+ s = SHIFTHIGH(LOWPART(s));
+ *lo += s;
+ hi += (*lo < s);
+
+ return hi;
+}
+
+mp_limb_t
+refmpn_umul_ppmm_r (mp_limb_t x, mp_limb_t y, mp_limb_t *lo)
+{
+ return refmpn_umul_ppmm (lo, x, y);
+}
+
+mp_limb_t
+refmpn_mul_1c (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_limb_t multiplier,
+ mp_limb_t carry)
+{
+ mp_size_t i;
+ mp_limb_t hi, lo;
+
+ ASSERT (refmpn_overlap_low_to_high_p (rp, sp, size));
+ ASSERT (size >= 1);
+ ASSERT_MPN (sp, size);
+ ASSERT_LIMB (multiplier);
+ ASSERT_LIMB (carry);
+
+ multiplier <<= GMP_NAIL_BITS;
+ for (i = 0; i < size; i++)
+ {
+ hi = refmpn_umul_ppmm (&lo, sp[i], multiplier);
+ lo >>= GMP_NAIL_BITS;
+ ASSERT_NOCARRY (ref_addc_limb (&hi, hi, ref_addc_limb (&lo, lo, carry)));
+ rp[i] = lo;
+ carry = hi;
+ }
+ return carry;
+}
+
+mp_limb_t
+refmpn_mul_1 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_limb_t multiplier)
+{
+ return refmpn_mul_1c (rp, sp, size, multiplier, CNST_LIMB(0));
+}
+
+
+mp_limb_t
+refmpn_mul_N (mp_ptr dst, mp_srcptr src, mp_size_t size,
+ mp_srcptr mult, mp_size_t msize)
+{
+ mp_ptr src_copy;
+ mp_limb_t ret;
+ mp_size_t i;
+
+ ASSERT (refmpn_overlap_fullonly_p (dst, src, size));
+ ASSERT (! refmpn_overlap_p (dst, size+msize-1, mult, msize));
+ ASSERT (size >= msize);
+ ASSERT_MPN (mult, msize);
+
+ /* in case dst==src */
+ src_copy = refmpn_malloc_limbs (size);
+ refmpn_copyi (src_copy, src, size);
+ src = src_copy;
+
+ dst[size] = refmpn_mul_1 (dst, src, size, mult[0]);
+ for (i = 1; i < msize-1; i++)
+ dst[size+i] = refmpn_addmul_1 (dst+i, src, size, mult[i]);
+ ret = refmpn_addmul_1 (dst+i, src, size, mult[i]);
+
+ free (src_copy);
+ return ret;
+}
+
+mp_limb_t
+refmpn_mul_2 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_srcptr mult)
+{
+ return refmpn_mul_N (rp, sp, size, mult, (mp_size_t) 2);
+}
+mp_limb_t
+refmpn_mul_3 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_srcptr mult)
+{
+ return refmpn_mul_N (rp, sp, size, mult, (mp_size_t) 3);
+}
+mp_limb_t
+refmpn_mul_4 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_srcptr mult)
+{
+ return refmpn_mul_N (rp, sp, size, mult, (mp_size_t) 4);
+}
+mp_limb_t
+refmpn_mul_5 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_srcptr mult)
+{
+ return refmpn_mul_N (rp, sp, size, mult, (mp_size_t) 5);
+}
+mp_limb_t
+refmpn_mul_6 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_srcptr mult)
+{
+ return refmpn_mul_N (rp, sp, size, mult, (mp_size_t) 6);
+}
+
+#define AORSMUL_1C(operation_n) \
+ { \
+ mp_ptr p; \
+ mp_limb_t ret; \
+ \
+ ASSERT (refmpn_overlap_fullonly_p (rp, sp, size)); \
+ \
+ p = refmpn_malloc_limbs (size); \
+ ret = refmpn_mul_1c (p, sp, size, multiplier, carry); \
+ ret += operation_n (rp, rp, p, size); \
+ \
+ free (p); \
+ return ret; \
+ }
+
+mp_limb_t
+refmpn_addmul_1c (mp_ptr rp, mp_srcptr sp, mp_size_t size,
+ mp_limb_t multiplier, mp_limb_t carry)
+{
+ AORSMUL_1C (refmpn_add_n);
+}
+mp_limb_t
+refmpn_submul_1c (mp_ptr rp, mp_srcptr sp, mp_size_t size,
+ mp_limb_t multiplier, mp_limb_t carry)
+{
+ AORSMUL_1C (refmpn_sub_n);
+}
+
+
+mp_limb_t
+refmpn_addmul_1 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_limb_t multiplier)
+{
+ return refmpn_addmul_1c (rp, sp, size, multiplier, CNST_LIMB(0));
+}
+mp_limb_t
+refmpn_submul_1 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_limb_t multiplier)
+{
+ return refmpn_submul_1c (rp, sp, size, multiplier, CNST_LIMB(0));
+}
+
+
+mp_limb_t
+refmpn_addmul_N (mp_ptr dst, mp_srcptr src, mp_size_t size,
+ mp_srcptr mult, mp_size_t msize)
+{
+ mp_ptr src_copy;
+ mp_limb_t ret;
+ mp_size_t i;
+
+ ASSERT (dst == src || ! refmpn_overlap_p (dst, size+msize-1, src, size));
+ ASSERT (! refmpn_overlap_p (dst, size+msize-1, mult, msize));
+ ASSERT (size >= msize);
+ ASSERT_MPN (mult, msize);
+
+ /* in case dst==src */
+ src_copy = refmpn_malloc_limbs (size);
+ refmpn_copyi (src_copy, src, size);
+ src = src_copy;
+
+ for (i = 0; i < msize-1; i++)
+ dst[size+i] = refmpn_addmul_1 (dst+i, src, size, mult[i]);
+ ret = refmpn_addmul_1 (dst+i, src, size, mult[i]);
+
+ free (src_copy);
+ return ret;
+}
+
+mp_limb_t
+refmpn_addmul_2 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_srcptr mult)
+{
+ return refmpn_addmul_N (rp, sp, size, mult, (mp_size_t) 2);
+}
+mp_limb_t
+refmpn_addmul_3 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_srcptr mult)
+{
+ return refmpn_addmul_N (rp, sp, size, mult, (mp_size_t) 3);
+}
+mp_limb_t
+refmpn_addmul_4 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_srcptr mult)
+{
+ return refmpn_addmul_N (rp, sp, size, mult, (mp_size_t) 4);
+}
+mp_limb_t
+refmpn_addmul_5 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_srcptr mult)
+{
+ return refmpn_addmul_N (rp, sp, size, mult, (mp_size_t) 5);
+}
+mp_limb_t
+refmpn_addmul_6 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_srcptr mult)
+{
+ return refmpn_addmul_N (rp, sp, size, mult, (mp_size_t) 6);
+}
+mp_limb_t
+refmpn_addmul_7 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_srcptr mult)
+{
+ return refmpn_addmul_N (rp, sp, size, mult, (mp_size_t) 7);
+}
+mp_limb_t
+refmpn_addmul_8 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_srcptr mult)
+{
+ return refmpn_addmul_N (rp, sp, size, mult, (mp_size_t) 8);
+}
+
+mp_limb_t
+refmpn_add_n_sub_nc (mp_ptr r1p, mp_ptr r2p,
+ mp_srcptr s1p, mp_srcptr s2p, mp_size_t size,
+ mp_limb_t carry)
+{
+ mp_ptr p;
+ mp_limb_t acy, scy;
+
+ /* Destinations can't overlap. */
+ ASSERT (! refmpn_overlap_p (r1p, size, r2p, size));
+ ASSERT (refmpn_overlap_fullonly_two_p (r1p, s1p, s2p, size));
+ ASSERT (refmpn_overlap_fullonly_two_p (r2p, s1p, s2p, size));
+ ASSERT (size >= 1);
+
+ /* in case r1p==s1p or r1p==s2p */
+ p = refmpn_malloc_limbs (size);
+
+ acy = refmpn_add_nc (p, s1p, s2p, size, carry >> 1);
+ scy = refmpn_sub_nc (r2p, s1p, s2p, size, carry & 1);
+ refmpn_copyi (r1p, p, size);
+
+ free (p);
+ return 2 * acy + scy;
+}
+
+mp_limb_t
+refmpn_add_n_sub_n (mp_ptr r1p, mp_ptr r2p,
+ mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
+{
+ return refmpn_add_n_sub_nc (r1p, r2p, s1p, s2p, size, CNST_LIMB(0));
+}
+
+
+/* Right shift hi,lo and return the low limb of the result.
+ Note a shift by GMP_LIMB_BITS isn't assumed to work (doesn't on x86). */
+mp_limb_t
+rshift_make (mp_limb_t hi, mp_limb_t lo, unsigned shift)
+{
+ ASSERT (shift < GMP_NUMB_BITS);
+ if (shift == 0)
+ return lo;
+ else
+ return ((hi << (GMP_NUMB_BITS-shift)) | (lo >> shift)) & GMP_NUMB_MASK;
+}
+
+/* Left shift hi,lo and return the high limb of the result.
+ Note a shift by GMP_LIMB_BITS isn't assumed to work (doesn't on x86). */
+mp_limb_t
+lshift_make (mp_limb_t hi, mp_limb_t lo, unsigned shift)
+{
+ ASSERT (shift < GMP_NUMB_BITS);
+ if (shift == 0)
+ return hi;
+ else
+ return ((hi << shift) | (lo >> (GMP_NUMB_BITS-shift))) & GMP_NUMB_MASK;
+}
+
+
+mp_limb_t
+refmpn_rshift (mp_ptr rp, mp_srcptr sp, mp_size_t size, unsigned shift)
+{
+ mp_limb_t ret;
+ mp_size_t i;
+
+ ASSERT (refmpn_overlap_low_to_high_p (rp, sp, size));
+ ASSERT (size >= 1);
+ ASSERT (shift >= 1 && shift < GMP_NUMB_BITS);
+ ASSERT_MPN (sp, size);
+
+ ret = rshift_make (sp[0], CNST_LIMB(0), shift);
+
+ for (i = 0; i < size-1; i++)
+ rp[i] = rshift_make (sp[i+1], sp[i], shift);
+
+ rp[i] = rshift_make (CNST_LIMB(0), sp[i], shift);
+ return ret;
+}
+
+mp_limb_t
+refmpn_lshift (mp_ptr rp, mp_srcptr sp, mp_size_t size, unsigned shift)
+{
+ mp_limb_t ret;
+ mp_size_t i;
+
+ ASSERT (refmpn_overlap_high_to_low_p (rp, sp, size));
+ ASSERT (size >= 1);
+ ASSERT (shift >= 1 && shift < GMP_NUMB_BITS);
+ ASSERT_MPN (sp, size);
+
+ ret = lshift_make (CNST_LIMB(0), sp[size-1], shift);
+
+ for (i = size-2; i >= 0; i--)
+ rp[i+1] = lshift_make (sp[i+1], sp[i], shift);
+
+ rp[i+1] = lshift_make (sp[i+1], CNST_LIMB(0), shift);
+ return ret;
+}
+
+void
+refmpn_com (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+ mp_size_t i;
+
+ /* We work downwards since mpn_lshiftc needs that. */
+ ASSERT (refmpn_overlap_high_to_low_p (rp, sp, size));
+
+ for (i = size - 1; i >= 0; i--)
+ rp[i] = (~sp[i]) & GMP_NUMB_MASK;
+}
+
+mp_limb_t
+refmpn_lshiftc (mp_ptr rp, mp_srcptr sp, mp_size_t size, unsigned shift)
+{
+ mp_limb_t res;
+
+ /* No asserts here, refmpn_lshift will assert what we need. */
+
+ res = refmpn_lshift (rp, sp, size, shift);
+ refmpn_com (rp, rp, size);
+ return res;
+}
+
+/* accepting shift==0 and doing a plain copyi or copyd in that case */
+mp_limb_t
+refmpn_rshift_or_copy (mp_ptr rp, mp_srcptr sp, mp_size_t size, unsigned shift)
+{
+ if (shift == 0)
+ {
+ refmpn_copyi (rp, sp, size);
+ return 0;
+ }
+ else
+ {
+ return refmpn_rshift (rp, sp, size, shift);
+ }
+}
+mp_limb_t
+refmpn_lshift_or_copy (mp_ptr rp, mp_srcptr sp, mp_size_t size, unsigned shift)
+{
+ if (shift == 0)
+ {
+ refmpn_copyd (rp, sp, size);
+ return 0;
+ }
+ else
+ {
+ return refmpn_lshift (rp, sp, size, shift);
+ }
+}
+
+/* accepting size==0 too */
+mp_limb_t
+refmpn_rshift_or_copy_any (mp_ptr rp, mp_srcptr sp, mp_size_t size,
+ unsigned shift)
+{
+ return (size == 0 ? 0 : refmpn_rshift_or_copy (rp, sp, size, shift));
+}
+mp_limb_t
+refmpn_lshift_or_copy_any (mp_ptr rp, mp_srcptr sp, mp_size_t size,
+ unsigned shift)
+{
+ return (size == 0 ? 0 : refmpn_lshift_or_copy (rp, sp, size, shift));
+}
+
+/* Divide h,l by d, return quotient, store remainder to *rp.
+ Operates on full limbs, not nails.
+ Must have h < d.
+ __udiv_qrnnd_c isn't simple, and it's a bit slow, but it works. */
+mp_limb_t
+refmpn_udiv_qrnnd (mp_limb_t *rp, mp_limb_t h, mp_limb_t l, mp_limb_t d)
+{
+ mp_limb_t q, r;
+ int n;
+
+ ASSERT (d != 0);
+ ASSERT (h < d);
+
+#if 0
+ udiv_qrnnd (q, r, h, l, d);
+ *rp = r;
+ return q;
+#endif
+
+ n = refmpn_count_leading_zeros (d);
+ d <<= n;
+
+ if (n != 0)
+ {
+ h = (h << n) | (l >> (GMP_LIMB_BITS - n));
+ l <<= n;
+ }
+
+ __udiv_qrnnd_c (q, r, h, l, d);
+ r >>= n;
+ *rp = r;
+ return q;
+}
+
+mp_limb_t
+refmpn_udiv_qrnnd_r (mp_limb_t h, mp_limb_t l, mp_limb_t d, mp_limb_t *rp)
+{
+ return refmpn_udiv_qrnnd (rp, h, l, d);
+}
+
+/* This little subroutine avoids some bad code generation from i386 gcc 3.0
+ -fPIC -O2 -fomit-frame-pointer (%ebp being used uninitialized). */
+static mp_limb_t
+refmpn_divmod_1c_workaround (mp_ptr rp, mp_srcptr sp, mp_size_t size,
+ mp_limb_t divisor, mp_limb_t carry)
+{
+ mp_size_t i;
+ mp_limb_t rem[1];
+ for (i = size-1; i >= 0; i--)
+ {
+ rp[i] = refmpn_udiv_qrnnd (rem, carry,
+ sp[i] << GMP_NAIL_BITS,
+ divisor << GMP_NAIL_BITS);
+ carry = *rem >> GMP_NAIL_BITS;
+ }
+ return carry;
+}
+
+mp_limb_t
+refmpn_divmod_1c (mp_ptr rp, mp_srcptr sp, mp_size_t size,
+ mp_limb_t divisor, mp_limb_t carry)
+{
+ mp_ptr sp_orig;
+ mp_ptr prod;
+ mp_limb_t carry_orig;
+
+ ASSERT (refmpn_overlap_fullonly_p (rp, sp, size));
+ ASSERT (size >= 0);
+ ASSERT (carry < divisor);
+ ASSERT_MPN (sp, size);
+ ASSERT_LIMB (divisor);
+ ASSERT_LIMB (carry);
+
+ if (size == 0)
+ return carry;
+
+ sp_orig = refmpn_memdup_limbs (sp, size);
+ prod = refmpn_malloc_limbs (size);
+ carry_orig = carry;
+
+ carry = refmpn_divmod_1c_workaround (rp, sp, size, divisor, carry);
+
+ /* check by multiplying back */
+#if 0
+ printf ("size=%ld divisor=0x%lX carry=0x%lX remainder=0x%lX\n",
+ size, divisor, carry_orig, carry);
+ mpn_trace("s",sp_copy,size);
+ mpn_trace("r",rp,size);
+ printf ("mul_1c %lX\n", refmpn_mul_1c (prod, rp, size, divisor, carry));
+ mpn_trace("p",prod,size);
+#endif
+ ASSERT (refmpn_mul_1c (prod, rp, size, divisor, carry) == carry_orig);
+ ASSERT (refmpn_cmp (prod, sp_orig, size) == 0);
+ free (sp_orig);
+ free (prod);
+
+ return carry;
+}
+
+mp_limb_t
+refmpn_divmod_1 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_limb_t divisor)
+{
+ return refmpn_divmod_1c (rp, sp, size, divisor, CNST_LIMB(0));
+}
+
+
+mp_limb_t
+refmpn_mod_1c (mp_srcptr sp, mp_size_t size, mp_limb_t divisor,
+ mp_limb_t carry)
+{
+ mp_ptr p = refmpn_malloc_limbs (size);
+ carry = refmpn_divmod_1c (p, sp, size, divisor, carry);
+ free (p);
+ return carry;
+}
+
+mp_limb_t
+refmpn_mod_1 (mp_srcptr sp, mp_size_t size, mp_limb_t divisor)
+{
+ return refmpn_mod_1c (sp, size, divisor, CNST_LIMB(0));
+}
+
+mp_limb_t
+refmpn_preinv_mod_1 (mp_srcptr sp, mp_size_t size, mp_limb_t divisor,
+ mp_limb_t inverse)
+{
+ ASSERT (divisor & GMP_NUMB_HIGHBIT);
+ ASSERT (inverse == refmpn_invert_limb (divisor));
+ return refmpn_mod_1 (sp, size, divisor);
+}
+
+/* This implementation will be rather slow, but has the advantage of being
+ in a different style than the libgmp versions. */
+mp_limb_t
+refmpn_mod_34lsub1 (mp_srcptr p, mp_size_t n)
+{
+ ASSERT ((GMP_NUMB_BITS % 4) == 0);
+ return mpn_mod_1 (p, n, (CNST_LIMB(1) << (3 * GMP_NUMB_BITS / 4)) - 1);
+}
+
+
+mp_limb_t
+refmpn_divrem_1c (mp_ptr rp, mp_size_t xsize,
+ mp_srcptr sp, mp_size_t size, mp_limb_t divisor,
+ mp_limb_t carry)
+{
+ mp_ptr z;
+
+ z = refmpn_malloc_limbs (xsize);
+ refmpn_fill (z, xsize, CNST_LIMB(0));
+
+ carry = refmpn_divmod_1c (rp+xsize, sp, size, divisor, carry);
+ carry = refmpn_divmod_1c (rp, z, xsize, divisor, carry);
+
+ free (z);
+ return carry;
+}
+
+mp_limb_t
+refmpn_divrem_1 (mp_ptr rp, mp_size_t xsize,
+ mp_srcptr sp, mp_size_t size, mp_limb_t divisor)
+{
+ return refmpn_divrem_1c (rp, xsize, sp, size, divisor, CNST_LIMB(0));
+}
+
+mp_limb_t
+refmpn_preinv_divrem_1 (mp_ptr rp, mp_size_t xsize,
+ mp_srcptr sp, mp_size_t size,
+ mp_limb_t divisor, mp_limb_t inverse, unsigned shift)
+{
+ ASSERT (size >= 0);
+ ASSERT (shift == refmpn_count_leading_zeros (divisor));
+ ASSERT (inverse == refmpn_invert_limb (divisor << shift));
+
+ return refmpn_divrem_1 (rp, xsize, sp, size, divisor);
+}
+
+mp_limb_t
+refmpn_divrem_2 (mp_ptr qp, mp_size_t qxn,
+ mp_ptr np, mp_size_t nn,
+ mp_srcptr dp)
+{
+ mp_ptr tp;
+ mp_limb_t qh;
+
+ tp = refmpn_malloc_limbs (nn + qxn);
+ refmpn_zero (tp, qxn);
+ refmpn_copyi (tp + qxn, np, nn);
+ qh = refmpn_sb_div_qr (qp, tp, nn + qxn, dp, 2);
+ refmpn_copyi (np, tp, 2);
+ free (tp);
+ return qh;
+}
+
+/* Inverse is floor((b*(b-d)-1) / d), per division by invariant integers
+ paper, figure 8.1 m', where b=2^GMP_LIMB_BITS. Note that -d-1 < d
+ since d has the high bit set. */
+
+mp_limb_t
+refmpn_invert_limb (mp_limb_t d)
+{
+ mp_limb_t r;
+ ASSERT (d & GMP_LIMB_HIGHBIT);
+ return refmpn_udiv_qrnnd (&r, -d-1, MP_LIMB_T_MAX, d);
+}
+
+void
+refmpn_invert (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_ptr scratch)
+{
+ mp_ptr qp, tp;
+ TMP_DECL;
+ TMP_MARK;
+
+ tp = TMP_ALLOC_LIMBS (2 * n);
+ qp = TMP_ALLOC_LIMBS (n + 1);
+
+ MPN_ZERO (tp, 2 * n); mpn_sub_1 (tp, tp, 2 * n, 1);
+
+ refmpn_tdiv_qr (qp, rp, 0, tp, 2 * n, up, n);
+ refmpn_copyi (rp, qp, n);
+
+ TMP_FREE;
+}
+
+void
+refmpn_binvert (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_ptr scratch)
+{
+ mp_ptr tp;
+ mp_limb_t binv;
+ TMP_DECL;
+ TMP_MARK;
+
+ /* We use the library mpn_sbpi1_bdiv_q here, which isn't kosher in testing
+ code. To make up for it, we check that the inverse is correct using a
+ multiply. */
+
+ tp = TMP_ALLOC_LIMBS (2 * n);
+
+ MPN_ZERO (tp, n);
+ tp[0] = 1;
+ binvert_limb (binv, up[0]);
+ mpn_sbpi1_bdiv_q (rp, tp, n, up, n, -binv);
+
+ refmpn_mul_n (tp, rp, up, n);
+ ASSERT_ALWAYS (tp[0] == 1 && mpn_zero_p (tp + 1, n - 1));
+
+ TMP_FREE;
+}
+
+/* The aim is to produce a dst quotient and return a remainder c, satisfying
+ c*b^n + src-i == 3*dst, where i is the incoming carry.
+
+ Some value c==0, c==1 or c==2 will satisfy, so just try each.
+
+ If GMP_NUMB_BITS is even then 2^GMP_NUMB_BITS==1mod3 and a non-zero
+ remainder from the first division attempt determines the correct
+ remainder (3-c), but don't bother with that, since we can't guarantee
+ anything about GMP_NUMB_BITS when using nails.
+
+ If the initial src-i produces a borrow then refmpn_sub_1 leaves a twos
+ complement negative, ie. b^n+a-i, and the calculation produces c1
+ satisfying c1*b^n + b^n+src-i == 3*dst, from which clearly c=c1+1. This
+ means it's enough to just add any borrow back at the end.
+
+ A borrow only occurs when a==0 or a==1, and, by the same reasoning as in
+ mpn/generic/diveby3.c, the c1 that results in those cases will only be 0
+ or 1 respectively, so with 1 added the final return value is still in the
+ prescribed range 0 to 2. */
+
+mp_limb_t
+refmpn_divexact_by3c (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_limb_t carry)
+{
+ mp_ptr spcopy;
+ mp_limb_t c, cs;
+
+ ASSERT (refmpn_overlap_fullonly_p (rp, sp, size));
+ ASSERT (size >= 1);
+ ASSERT (carry <= 2);
+ ASSERT_MPN (sp, size);
+
+ spcopy = refmpn_malloc_limbs (size);
+ cs = refmpn_sub_1 (spcopy, sp, size, carry);
+
+ for (c = 0; c <= 2; c++)
+ if (refmpn_divmod_1c (rp, spcopy, size, CNST_LIMB(3), c) == 0)
+ goto done;
+ ASSERT_FAIL (no value of c satisfies);
+
+ done:
+ c += cs;
+ ASSERT (c <= 2);
+
+ free (spcopy);
+ return c;
+}
+
+mp_limb_t
+refmpn_divexact_by3 (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+ return refmpn_divexact_by3c (rp, sp, size, CNST_LIMB(0));
+}
+
+
+/* The same as mpn/generic/mul_basecase.c, but using refmpn functions. */
+void
+refmpn_mul_basecase (mp_ptr prodp,
+ mp_srcptr up, mp_size_t usize,
+ mp_srcptr vp, mp_size_t vsize)
+{
+ mp_size_t i;
+
+ ASSERT (! refmpn_overlap_p (prodp, usize+vsize, up, usize));
+ ASSERT (! refmpn_overlap_p (prodp, usize+vsize, vp, vsize));
+ ASSERT (usize >= vsize);
+ ASSERT (vsize >= 1);
+ ASSERT_MPN (up, usize);
+ ASSERT_MPN (vp, vsize);
+
+ prodp[usize] = refmpn_mul_1 (prodp, up, usize, vp[0]);
+ for (i = 1; i < vsize; i++)
+ prodp[usize+i] = refmpn_addmul_1 (prodp+i, up, usize, vp[i]);
+}
+
+
+/* The same as mpn/generic/mulmid_basecase.c, but using refmpn functions. */
+void
+refmpn_mulmid_basecase (mp_ptr rp,
+ mp_srcptr up, mp_size_t un,
+ mp_srcptr vp, mp_size_t vn)
+{
+ mp_limb_t cy;
+ mp_size_t i;
+
+ ASSERT (un >= vn);
+ ASSERT (vn >= 1);
+ ASSERT (! refmpn_overlap_p (rp, un - vn + 3, up, un));
+ ASSERT (! refmpn_overlap_p (rp, un - vn + 3, vp, vn));
+ ASSERT_MPN (up, un);
+ ASSERT_MPN (vp, vn);
+
+ rp[un - vn + 1] = refmpn_mul_1 (rp, up + vn - 1, un - vn + 1, vp[0]);
+ rp[un - vn + 2] = CNST_LIMB (0);
+ for (i = 1; i < vn; i++)
+ {
+ cy = refmpn_addmul_1 (rp, up + vn - i - 1, un - vn + 1, vp[i]);
+ cy = ref_addc_limb (&rp[un - vn + 1], rp[un - vn + 1], cy);
+ cy = ref_addc_limb (&rp[un - vn + 2], rp[un - vn + 2], cy);
+ ASSERT (cy == 0);
+ }
+}
+
+void
+refmpn_toom42_mulmid (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n,
+ mp_ptr scratch)
+{
+ refmpn_mulmid_basecase (rp, up, 2*n - 1, vp, n);
+}
+
+void
+refmpn_mulmid_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
+{
+ /* FIXME: this could be made faster by using refmpn_mul and then subtracting
+ off products near the middle product region boundary */
+ refmpn_mulmid_basecase (rp, up, 2*n - 1, vp, n);
+}
+
+void
+refmpn_mulmid (mp_ptr rp, mp_srcptr up, mp_size_t un,
+ mp_srcptr vp, mp_size_t vn)
+{
+ /* FIXME: this could be made faster by using refmpn_mul and then subtracting
+ off products near the middle product region boundary */
+ refmpn_mulmid_basecase (rp, up, un, vp, vn);
+}
+
+
+
+#define TOOM3_THRESHOLD (MAX (MUL_TOOM33_THRESHOLD, SQR_TOOM3_THRESHOLD))
+#define TOOM4_THRESHOLD (MAX (MUL_TOOM44_THRESHOLD, SQR_TOOM4_THRESHOLD))
+#define TOOM6_THRESHOLD (MAX (MUL_TOOM6H_THRESHOLD, SQR_TOOM6_THRESHOLD))
+#if WANT_FFT
+#define FFT_THRESHOLD (MAX (MUL_FFT_THRESHOLD, SQR_FFT_THRESHOLD))
+#else
+#define FFT_THRESHOLD MP_SIZE_T_MAX /* don't use toom44 here */
+#endif
+
+void
+refmpn_mul (mp_ptr wp, mp_srcptr up, mp_size_t un, mp_srcptr vp, mp_size_t vn)
+{
+ mp_ptr tp, rp;
+ mp_size_t tn;
+
+ if (vn < TOOM3_THRESHOLD)
+ {
+ /* In the mpn_mul_basecase and toom2 ranges, use our own mul_basecase. */
+ if (vn != 0)
+ refmpn_mul_basecase (wp, up, un, vp, vn);
+ else
+ MPN_ZERO (wp, un);
+ return;
+ }
+
+ MPN_ZERO (wp, vn);
+ rp = refmpn_malloc_limbs (2 * vn);
+
+ if (vn < TOOM4_THRESHOLD)
+ tn = mpn_toom22_mul_itch (vn, vn);
+ else if (vn < TOOM6_THRESHOLD)
+ tn = mpn_toom33_mul_itch (vn, vn);
+ else if (vn < FFT_THRESHOLD)
+ tn = mpn_toom44_mul_itch (vn, vn);
+ else
+ tn = mpn_toom6h_mul_itch (vn, vn);
+ tp = refmpn_malloc_limbs (tn);
+
+ while (un >= vn)
+ {
+ if (vn < TOOM4_THRESHOLD)
+ /* In the toom3 range, use mpn_toom22_mul. */
+ mpn_toom22_mul (rp, up, vn, vp, vn, tp);
+ else if (vn < TOOM6_THRESHOLD)
+ /* In the toom4 range, use mpn_toom33_mul. */
+ mpn_toom33_mul (rp, up, vn, vp, vn, tp);
+ else if (vn < FFT_THRESHOLD)
+ /* In the toom6 range, use mpn_toom44_mul. */
+ mpn_toom44_mul (rp, up, vn, vp, vn, tp);
+ else
+ /* For the largest operands, use mpn_toom6h_mul. */
+ mpn_toom6h_mul (rp, up, vn, vp, vn, tp);
+
+ ASSERT_NOCARRY (refmpn_add (wp, rp, 2 * vn, wp, vn));
+ wp += vn;
+
+ up += vn;
+ un -= vn;
+ }
+
+ free (tp);
+
+ if (un != 0)
+ {
+ refmpn_mul (rp, vp, vn, up, un);
+ ASSERT_NOCARRY (refmpn_add (wp, rp, un + vn, wp, vn));
+ }
+ free (rp);
+}
+
+void
+refmpn_mul_n (mp_ptr prodp, mp_srcptr up, mp_srcptr vp, mp_size_t size)
+{
+ refmpn_mul (prodp, up, size, vp, size);
+}
+
+void
+refmpn_mullo_n (mp_ptr prodp, mp_srcptr up, mp_srcptr vp, mp_size_t size)
+{
+ mp_ptr tp = refmpn_malloc_limbs (2*size);
+ refmpn_mul (tp, up, size, vp, size);
+ refmpn_copyi (prodp, tp, size);
+ free (tp);
+}
+
+void
+refmpn_sqr (mp_ptr dst, mp_srcptr src, mp_size_t size)
+{
+ refmpn_mul (dst, src, size, src, size);
+}
+
+void
+refmpn_sqrlo (mp_ptr dst, mp_srcptr src, mp_size_t size)
+{
+ refmpn_mullo_n (dst, src, src, size);
+}
+
+/* Allowing usize<vsize, usize==0 or vsize==0. */
+void
+refmpn_mul_any (mp_ptr prodp,
+ mp_srcptr up, mp_size_t usize,
+ mp_srcptr vp, mp_size_t vsize)
+{
+ ASSERT (! refmpn_overlap_p (prodp, usize+vsize, up, usize));
+ ASSERT (! refmpn_overlap_p (prodp, usize+vsize, vp, vsize));
+ ASSERT (usize >= 0);
+ ASSERT (vsize >= 0);
+ ASSERT_MPN (up, usize);
+ ASSERT_MPN (vp, vsize);
+
+ if (usize == 0)
+ {
+ refmpn_fill (prodp, vsize, CNST_LIMB(0));
+ return;
+ }
+
+ if (vsize == 0)
+ {
+ refmpn_fill (prodp, usize, CNST_LIMB(0));
+ return;
+ }
+
+ if (usize >= vsize)
+ refmpn_mul (prodp, up, usize, vp, vsize);
+ else
+ refmpn_mul (prodp, vp, vsize, up, usize);
+}
+
+
+mp_limb_t
+refmpn_gcd_11 (mp_limb_t x, mp_limb_t y)
+{
+ /* The non-ref function also requires input operands to be odd, but
+ below refmpn_gcd_1 doesn't guarantee that. */
+ ASSERT (x > 0);
+ ASSERT (y > 0);
+ do
+ {
+ while ((x & 1) == 0) x >>= 1;
+ while ((y & 1) == 0) y >>= 1;
+
+ if (x < y)
+ MP_LIMB_T_SWAP (x, y);
+
+ x -= y;
+ }
+ while (x != 0);
+
+ return y;
+}
+
+mp_double_limb_t
+refmpn_gcd_22 (mp_limb_t x1, mp_limb_t x0, mp_limb_t y1, mp_limb_t y0)
+{
+ ASSERT ((x0 & 1) != 0);
+ ASSERT ((y0 & 1) != 0);
+ mp_double_limb_t g;
+ mp_limb_t cy;
+
+ do
+ {
+ while ((x0 & 1) == 0)
+ {
+ x0 = (x1 << (GMP_NUMB_BITS - 1)) | (x0 >> 1);
+ x1 >>= 1;
+ }
+ while ((y0 & 1) == 0)
+ {
+ y0 = (y1 << (GMP_NUMB_BITS - 1)) | (y0 >> 1);
+ y1 >>= 1;
+ }
+
+
+ if (x1 < y1 || (x1 == y1 && x0 < y0))
+ {
+ mp_limb_t t;
+ t = x1; x1 = y1; y1 = t;
+ t = x0; x0 = y0; y0 = t;
+ }
+
+ cy = (x0 < y0);
+ x0 -= y0;
+ x1 -= y1 + cy;
+ }
+ while ((x1 | x0) != 0);
+
+ g.d1 = y1;
+ g.d0 = y0;
+ return g;
+}
+
+mp_limb_t
+refmpn_gcd_1 (mp_srcptr xp, mp_size_t xsize, mp_limb_t y)
+{
+ mp_limb_t x;
+ int twos;
+
+ ASSERT (y != 0);
+ ASSERT (! refmpn_zero_p (xp, xsize));
+ ASSERT_MPN (xp, xsize);
+ ASSERT_LIMB (y);
+
+ x = refmpn_mod_1 (xp, xsize, y);
+ if (x == 0)
+ return y;
+
+ twos = 0;
+ while ((x & 1) == 0 && (y & 1) == 0)
+ {
+ x >>= 1;
+ y >>= 1;
+ twos++;
+ }
+
+ return refmpn_gcd_11 (x, y) << twos;
+}
+
+
+/* Based on the full limb x, not nails. */
+unsigned
+refmpn_count_leading_zeros (mp_limb_t x)
+{
+ unsigned n = 0;
+
+ ASSERT (x != 0);
+
+ while ((x & GMP_LIMB_HIGHBIT) == 0)
+ {
+ x <<= 1;
+ n++;
+ }
+ return n;
+}
+
+/* Full limbs allowed, not limited to nails. */
+unsigned
+refmpn_count_trailing_zeros (mp_limb_t x)
+{
+ unsigned n = 0;
+
+ ASSERT (x != 0);
+ ASSERT_LIMB (x);
+
+ while ((x & 1) == 0)
+ {
+ x >>= 1;
+ n++;
+ }
+ return n;
+}
+
+/* Strip factors of two (low zero bits) from {p,size} by right shifting.
+ The return value is the number of twos stripped. */
+mp_size_t
+refmpn_strip_twos (mp_ptr p, mp_size_t size)
+{
+ mp_size_t limbs;
+ unsigned shift;
+
+ ASSERT (size >= 1);
+ ASSERT (! refmpn_zero_p (p, size));
+ ASSERT_MPN (p, size);
+
+ for (limbs = 0; p[0] == 0; limbs++)
+ {
+ refmpn_copyi (p, p+1, size-1);
+ p[size-1] = 0;
+ }
+
+ shift = refmpn_count_trailing_zeros (p[0]);
+ if (shift)
+ refmpn_rshift (p, p, size, shift);
+
+ return limbs*GMP_NUMB_BITS + shift;
+}
+
+mp_limb_t
+refmpn_gcd (mp_ptr gp, mp_ptr xp, mp_size_t xsize, mp_ptr yp, mp_size_t ysize)
+{
+ int cmp;
+
+ ASSERT (ysize >= 1);
+ ASSERT (xsize >= ysize);
+ ASSERT ((xp[0] & 1) != 0);
+ ASSERT ((yp[0] & 1) != 0);
+ /* ASSERT (xp[xsize-1] != 0); */ /* don't think x needs to be odd */
+ ASSERT (yp[ysize-1] != 0);
+ ASSERT (refmpn_overlap_fullonly_p (gp, xp, xsize));
+ ASSERT (refmpn_overlap_fullonly_p (gp, yp, ysize));
+ ASSERT (! refmpn_overlap_p (xp, xsize, yp, ysize));
+ if (xsize == ysize)
+ ASSERT (refmpn_msbone (xp[xsize-1]) >= refmpn_msbone (yp[ysize-1]));
+ ASSERT_MPN (xp, xsize);
+ ASSERT_MPN (yp, ysize);
+
+ refmpn_strip_twos (xp, xsize);
+ MPN_NORMALIZE (xp, xsize);
+ MPN_NORMALIZE (yp, ysize);
+
+ for (;;)
+ {
+ cmp = refmpn_cmp_twosizes (xp, xsize, yp, ysize);
+ if (cmp == 0)
+ break;
+ if (cmp < 0)
+ MPN_PTR_SWAP (xp,xsize, yp,ysize);
+
+ ASSERT_NOCARRY (refmpn_sub (xp, xp, xsize, yp, ysize));
+
+ refmpn_strip_twos (xp, xsize);
+ MPN_NORMALIZE (xp, xsize);
+ }
+
+ refmpn_copyi (gp, xp, xsize);
+ return xsize;
+}
+
+unsigned long
+ref_popc_limb (mp_limb_t src)
+{
+ unsigned long count;
+ int i;
+
+ count = 0;
+ for (i = 0; i < GMP_LIMB_BITS; i++)
+ {
+ count += (src & 1);
+ src >>= 1;
+ }
+ return count;
+}
+
+unsigned long
+refmpn_popcount (mp_srcptr sp, mp_size_t size)
+{
+ unsigned long count = 0;
+ mp_size_t i;
+
+ ASSERT (size >= 0);
+ ASSERT_MPN (sp, size);
+
+ for (i = 0; i < size; i++)
+ count += ref_popc_limb (sp[i]);
+ return count;
+}
+
+unsigned long
+refmpn_hamdist (mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
+{
+ mp_ptr d;
+ unsigned long count;
+
+ ASSERT (size >= 0);
+ ASSERT_MPN (s1p, size);
+ ASSERT_MPN (s2p, size);
+
+ if (size == 0)
+ return 0;
+
+ d = refmpn_malloc_limbs (size);
+ refmpn_xor_n (d, s1p, s2p, size);
+ count = refmpn_popcount (d, size);
+ free (d);
+ return count;
+}
+
+
+/* set r to a%d */
+void
+refmpn_mod2 (mp_limb_t r[2], const mp_limb_t a[2], const mp_limb_t d[2])
+{
+ mp_limb_t D[2];
+ int n;
+
+ ASSERT (! refmpn_overlap_p (r, (mp_size_t) 2, d, (mp_size_t) 2));
+ ASSERT_MPN (a, 2);
+ ASSERT_MPN (d, 2);
+
+ D[1] = d[1], D[0] = d[0];
+ r[1] = a[1], r[0] = a[0];
+ n = 0;
+
+ for (;;)
+ {
+ if (D[1] & GMP_NUMB_HIGHBIT)
+ break;
+ if (refmpn_cmp (r, D, (mp_size_t) 2) <= 0)
+ break;
+ refmpn_lshift (D, D, (mp_size_t) 2, 1);
+ n++;
+ ASSERT (n <= GMP_NUMB_BITS);
+ }
+
+ while (n >= 0)
+ {
+ if (refmpn_cmp (r, D, (mp_size_t) 2) >= 0)
+ ASSERT_NOCARRY (refmpn_sub_n (r, r, D, (mp_size_t) 2));
+ refmpn_rshift (D, D, (mp_size_t) 2, 1);
+ n--;
+ }
+
+ ASSERT (refmpn_cmp (r, d, (mp_size_t) 2) < 0);
+}
+
+
+
+/* Similar to the old mpn/generic/sb_divrem_mn.c, but somewhat simplified, in
+ particular the trial quotient is allowed to be 2 too big. */
+mp_limb_t
+refmpn_sb_div_qr (mp_ptr qp,
+ mp_ptr np, mp_size_t nsize,
+ mp_srcptr dp, mp_size_t dsize)
+{
+ mp_limb_t retval = 0;
+ mp_size_t i;
+ mp_limb_t d1 = dp[dsize-1];
+ mp_ptr np_orig = refmpn_memdup_limbs (np, nsize);
+
+ ASSERT (nsize >= dsize);
+ /* ASSERT (dsize > 2); */
+ ASSERT (dsize >= 2);
+ ASSERT (dp[dsize-1] & GMP_NUMB_HIGHBIT);
+ ASSERT (! refmpn_overlap_p (qp, nsize-dsize, np, nsize) || qp+dsize >= np);
+ ASSERT_MPN (np, nsize);
+ ASSERT_MPN (dp, dsize);
+
+ i = nsize-dsize;
+ if (refmpn_cmp (np+i, dp, dsize) >= 0)
+ {
+ ASSERT_NOCARRY (refmpn_sub_n (np+i, np+i, dp, dsize));
+ retval = 1;
+ }
+
+ for (i--; i >= 0; i--)
+ {
+ mp_limb_t n0 = np[i+dsize];
+ mp_limb_t n1 = np[i+dsize-1];
+ mp_limb_t q, dummy_r;
+
+ ASSERT (n0 <= d1);
+ if (n0 == d1)
+ q = GMP_NUMB_MAX;
+ else
+ q = refmpn_udiv_qrnnd (&dummy_r, n0, n1 << GMP_NAIL_BITS,
+ d1 << GMP_NAIL_BITS);
+
+ n0 -= refmpn_submul_1 (np+i, dp, dsize, q);
+ ASSERT (n0 == 0 || n0 == MP_LIMB_T_MAX);
+ if (n0)
+ {
+ q--;
+ if (! refmpn_add_n (np+i, np+i, dp, dsize))
+ {
+ q--;
+ ASSERT_CARRY (refmpn_add_n (np+i, np+i, dp, dsize));
+ }
+ }
+ np[i+dsize] = 0;
+
+ qp[i] = q;
+ }
+
+ /* remainder < divisor */
+#if 0 /* ASSERT triggers gcc 4.2.1 bug */
+ ASSERT (refmpn_cmp (np, dp, dsize) < 0);
+#endif
+
+ /* multiply back to original */
+ {
+ mp_ptr mp = refmpn_malloc_limbs (nsize);
+
+ refmpn_mul_any (mp, qp, nsize-dsize, dp, dsize);
+ if (retval)
+ ASSERT_NOCARRY (refmpn_add_n (mp+nsize-dsize,mp+nsize-dsize, dp, dsize));
+ ASSERT_NOCARRY (refmpn_add (mp, mp, nsize, np, dsize));
+ ASSERT (refmpn_cmp (mp, np_orig, nsize) == 0);
+
+ free (mp);
+ }
+
+ free (np_orig);
+ return retval;
+}
+
+/* Similar to the old mpn/generic/sb_divrem_mn.c, but somewhat simplified, in
+ particular the trial quotient is allowed to be 2 too big. */
+void
+refmpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
+ mp_ptr np, mp_size_t nsize,
+ mp_srcptr dp, mp_size_t dsize)
+{
+ ASSERT (qxn == 0);
+ ASSERT_MPN (np, nsize);
+ ASSERT_MPN (dp, dsize);
+ ASSERT (dsize > 0);
+ ASSERT (dp[dsize-1] != 0);
+
+ if (dsize == 1)
+ {
+ rp[0] = refmpn_divmod_1 (qp, np, nsize, dp[0]);
+ return;
+ }
+ else
+ {
+ mp_ptr n2p = refmpn_malloc_limbs (nsize+1);
+ mp_ptr d2p = refmpn_malloc_limbs (dsize);
+ int norm = refmpn_count_leading_zeros (dp[dsize-1]) - GMP_NAIL_BITS;
+
+ n2p[nsize] = refmpn_lshift_or_copy (n2p, np, nsize, norm);
+ ASSERT_NOCARRY (refmpn_lshift_or_copy (d2p, dp, dsize, norm));
+
+ refmpn_sb_div_qr (qp, n2p, nsize+1, d2p, dsize);
+ refmpn_rshift_or_copy (rp, n2p, dsize, norm);
+
+ /* ASSERT (refmpn_zero_p (tp+dsize, nsize-dsize)); */
+ free (n2p);
+ free (d2p);
+ }
+}
+
+mp_limb_t
+refmpn_redc_1 (mp_ptr rp, mp_ptr up, mp_srcptr mp, mp_size_t n, mp_limb_t invm)
+{
+ mp_size_t j;
+ mp_limb_t cy;
+
+ ASSERT_MPN (up, 2*n);
+ /* ASSERT about directed overlap rp, up */
+ /* ASSERT about overlap rp, mp */
+ /* ASSERT about overlap up, mp */
+
+ for (j = n - 1; j >= 0; j--)
+ {
+ up[0] = refmpn_addmul_1 (up, mp, n, (up[0] * invm) & GMP_NUMB_MASK);
+ up++;
+ }
+ cy = mpn_add_n (rp, up, up - n, n);
+ return cy;
+}
+
+size_t
+refmpn_get_str (unsigned char *dst, int base, mp_ptr src, mp_size_t size)
+{
+ unsigned char *d;
+ size_t dsize;
+
+ ASSERT (size >= 0);
+ ASSERT (base >= 2);
+ ASSERT (base < numberof (mp_bases));
+ ASSERT (size == 0 || src[size-1] != 0);
+ ASSERT_MPN (src, size);
+
+ MPN_SIZEINBASE (dsize, src, size, base);
+ ASSERT (dsize >= 1);
+ ASSERT (! byte_overlap_p (dst, (mp_size_t) dsize, src, size * GMP_LIMB_BYTES));
+
+ if (size == 0)
+ {
+ dst[0] = 0;
+ return 1;
+ }
+
+ /* don't clobber input for power of 2 bases */
+ if (POW2_P (base))
+ src = refmpn_memdup_limbs (src, size);
+
+ d = dst + dsize;
+ do
+ {
+ d--;
+ ASSERT (d >= dst);
+ *d = refmpn_divrem_1 (src, (mp_size_t) 0, src, size, (mp_limb_t) base);
+ size -= (src[size-1] == 0);
+ }
+ while (size != 0);
+
+ /* Move result back and decrement dsize if we didn't generate
+ the maximum possible digits. */
+ if (d != dst)
+ {
+ size_t i;
+ dsize -= d - dst;
+ for (i = 0; i < dsize; i++)
+ dst[i] = d[i];
+ }
+
+ if (POW2_P (base))
+ free (src);
+
+ return dsize;
+}
+
+
+mp_limb_t
+ref_bswap_limb (mp_limb_t src)
+{
+ mp_limb_t dst;
+ int i;
+
+ dst = 0;
+ for (i = 0; i < GMP_LIMB_BYTES; i++)
+ {
+ dst = (dst << 8) + (src & 0xFF);
+ src >>= 8;
+ }
+ return dst;
+}
+
+
+/* These random functions are mostly for transitional purposes while adding
+ nail support, since they're independent of the normal mpn routines. They
+ can probably be removed when those normal routines are reliable, though
+ perhaps something independent would still be useful at times. */
+
+#if GMP_LIMB_BITS == 32
+#define RAND_A CNST_LIMB(0x29CF535)
+#endif
+#if GMP_LIMB_BITS == 64
+#define RAND_A CNST_LIMB(0xBAECD515DAF0B49D)
+#endif
+
+mp_limb_t refmpn_random_seed;
+
+mp_limb_t
+refmpn_random_half (void)
+{
+ refmpn_random_seed = refmpn_random_seed * RAND_A + 1;
+ return (refmpn_random_seed >> GMP_LIMB_BITS/2);
+}
+
+mp_limb_t
+refmpn_random_limb (void)
+{
+ return ((refmpn_random_half () << (GMP_LIMB_BITS/2))
+ | refmpn_random_half ()) & GMP_NUMB_MASK;
+}
+
+void
+refmpn_random (mp_ptr ptr, mp_size_t size)
+{
+ mp_size_t i;
+ if (GMP_NAIL_BITS == 0)
+ {
+ mpn_random (ptr, size);
+ return;
+ }
+
+ for (i = 0; i < size; i++)
+ ptr[i] = refmpn_random_limb ();
+}
+
+void
+refmpn_random2 (mp_ptr ptr, mp_size_t size)
+{
+ mp_size_t i;
+ mp_limb_t bit, mask, limb;
+ int run;
+
+ if (GMP_NAIL_BITS == 0)
+ {
+ mpn_random2 (ptr, size);
+ return;
+ }
+
+#define RUN_MODULUS 32
+
+ /* start with ones at a random pos in the high limb */
+ bit = CNST_LIMB(1) << (refmpn_random_half () % GMP_NUMB_BITS);
+ mask = 0;
+ run = 0;
+
+ for (i = size-1; i >= 0; i--)
+ {
+ limb = 0;
+ do
+ {
+ if (run == 0)
+ {
+ run = (refmpn_random_half () % RUN_MODULUS) + 1;
+ mask = ~mask;
+ }
+
+ limb |= (bit & mask);
+ bit >>= 1;
+ run--;
+ }
+ while (bit != 0);
+
+ ptr[i] = limb;
+ bit = GMP_NUMB_HIGHBIT;
+ }
+}
+
+/* This is a simple bitwise algorithm working high to low across "s" and
+ testing each time whether setting the bit would make s^2 exceed n. */
+mp_size_t
+refmpn_sqrtrem (mp_ptr sp, mp_ptr rp, mp_srcptr np, mp_size_t nsize)
+{
+ mp_ptr tp, dp;
+ mp_size_t ssize, talloc, tsize, dsize, ret, ilimbs;
+ unsigned ibit;
+ long i;
+ mp_limb_t c;
+
+ ASSERT (nsize >= 0);
+
+ /* If n==0, then s=0 and r=0. */
+ if (nsize == 0)
+ return 0;
+
+ ASSERT (np[nsize - 1] != 0);
+ ASSERT (rp == NULL || MPN_SAME_OR_SEPARATE_P (np, rp, nsize));
+ ASSERT (rp == NULL || ! MPN_OVERLAP_P (sp, (nsize + 1) / 2, rp, nsize));
+ ASSERT (! MPN_OVERLAP_P (sp, (nsize + 1) / 2, np, nsize));
+
+ /* root */
+ ssize = (nsize+1)/2;
+ refmpn_zero (sp, ssize);
+
+ /* the remainder so far */
+ dp = refmpn_memdup_limbs (np, nsize);
+ dsize = nsize;
+
+ /* temporary */
+ talloc = 2*ssize + 1;
+ tp = refmpn_malloc_limbs (talloc);
+
+ for (i = GMP_NUMB_BITS * ssize - 1; i >= 0; i--)
+ {
+ /* t = 2*s*2^i + 2^(2*i), being the amount s^2 will increase by if 2^i
+ is added to it */
+
+ ilimbs = (i+1) / GMP_NUMB_BITS;
+ ibit = (i+1) % GMP_NUMB_BITS;
+ refmpn_zero (tp, ilimbs);
+ c = refmpn_lshift_or_copy (tp+ilimbs, sp, ssize, ibit);
+ tsize = ilimbs + ssize;
+ tp[tsize] = c;
+ tsize += (c != 0);
+
+ ilimbs = (2*i) / GMP_NUMB_BITS;
+ ibit = (2*i) % GMP_NUMB_BITS;
+ if (ilimbs + 1 > tsize)
+ {
+ refmpn_zero_extend (tp, tsize, ilimbs + 1);
+ tsize = ilimbs + 1;
+ }
+ c = refmpn_add_1 (tp+ilimbs, tp+ilimbs, tsize-ilimbs,
+ CNST_LIMB(1) << ibit);
+ ASSERT (tsize < talloc);
+ tp[tsize] = c;
+ tsize += (c != 0);
+
+ if (refmpn_cmp_twosizes (dp, dsize, tp, tsize) >= 0)
+ {
+ /* set this bit in s and subtract from the remainder */
+ refmpn_setbit (sp, i);
+
+ ASSERT_NOCARRY (refmpn_sub_n (dp, dp, tp, dsize));
+ dsize = refmpn_normalize (dp, dsize);
+ }
+ }
+
+ if (rp == NULL)
+ {
+ ret = ! refmpn_zero_p (dp, dsize);
+ }
+ else
+ {
+ ASSERT (dsize == 0 || dp[dsize-1] != 0);
+ refmpn_copy (rp, dp, dsize);
+ ret = dsize;
+ }
+
+ free (dp);
+ free (tp);
+ return ret;
+}
diff --git a/vendor/gmp-6.3.0/tests/refmpq.c b/vendor/gmp-6.3.0/tests/refmpq.c
new file mode 100644
index 0000000..8a2fc7a
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/refmpq.c
@@ -0,0 +1,40 @@
+/* Reference rational routines.
+
+Copyright 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+void
+refmpq_add (mpq_ptr w, mpq_srcptr x, mpq_srcptr y)
+{
+ mpz_mul (mpq_numref(w), mpq_numref(x), mpq_denref(y));
+ mpz_addmul (mpq_numref(w), mpq_denref(x), mpq_numref(y));
+ mpz_mul (mpq_denref(w), mpq_denref(x), mpq_denref(y));
+ mpq_canonicalize (w);
+}
+
+void
+refmpq_sub (mpq_ptr w, mpq_srcptr x, mpq_srcptr y)
+{
+ mpz_mul (mpq_numref(w), mpq_numref(x), mpq_denref(y));
+ mpz_submul (mpq_numref(w), mpq_denref(x), mpq_numref(y));
+ mpz_mul (mpq_denref(w), mpq_denref(x), mpq_denref(y));
+ mpq_canonicalize (w);
+}
diff --git a/vendor/gmp-6.3.0/tests/refmpz.c b/vendor/gmp-6.3.0/tests/refmpz.c
new file mode 100644
index 0000000..167799f
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/refmpz.c
@@ -0,0 +1,343 @@
+/* Reference mpz functions.
+
+Copyright 1997, 1999-2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+/* always do assertion checking */
+#define WANT_ASSERT 1
+
+#include <stdio.h>
+#include <stdlib.h> /* for free */
+#include "gmp-impl.h"
+#include "longlong.h"
+#include "tests.h"
+
+
+/* Change this to "#define TRACE(x) x" for some traces. */
+#define TRACE(x)
+
+
+/* FIXME: Shouldn't use plain mpz functions in a reference routine. */
+void
+refmpz_combit (mpz_ptr r, unsigned long bit)
+{
+ if (mpz_tstbit (r, bit))
+ mpz_clrbit (r, bit);
+ else
+ mpz_setbit (r, bit);
+}
+
+
+unsigned long
+refmpz_hamdist (mpz_srcptr x, mpz_srcptr y)
+{
+ mp_size_t xsize, ysize, tsize;
+ mp_ptr xp, yp;
+ unsigned long ret;
+
+ if ((SIZ(x) < 0 && SIZ(y) >= 0)
+ || (SIZ(y) < 0 && SIZ(x) >= 0))
+ return ULONG_MAX;
+
+ xsize = ABSIZ(x);
+ ysize = ABSIZ(y);
+ tsize = MAX (xsize, ysize);
+
+ xp = refmpn_malloc_limbs (tsize);
+ refmpn_zero (xp, tsize);
+ refmpn_copy (xp, PTR(x), xsize);
+
+ yp = refmpn_malloc_limbs (tsize);
+ refmpn_zero (yp, tsize);
+ refmpn_copy (yp, PTR(y), ysize);
+
+ if (SIZ(x) < 0)
+ refmpn_neg (xp, xp, tsize);
+
+ if (SIZ(x) < 0)
+ refmpn_neg (yp, yp, tsize);
+
+ ret = refmpn_hamdist (xp, yp, tsize);
+
+ free (xp);
+ free (yp);
+ return ret;
+}
+
+void
+refmpz_gcd (mpz_ptr g, mpz_srcptr a_orig, mpz_srcptr b_orig)
+{
+ mp_bitcnt_t a_twos, b_twos, common_twos;
+ mpz_t a;
+ mpz_t b;
+ mpz_init (a);
+ mpz_init (b);
+ mpz_abs (a, a_orig);
+ mpz_abs (b, b_orig);
+
+ if (mpz_sgn (a) == 0)
+ {
+ mpz_set (g, b);
+ return;
+ }
+ if (mpz_sgn (b) == 0)
+ {
+ mpz_set (g, a);
+ return;
+ }
+ a_twos = mpz_scan1 (a, 0);
+ mpz_tdiv_q_2exp (a, a, a_twos);
+
+ b_twos = mpz_scan1 (b, 0);
+ mpz_tdiv_q_2exp (b, b, b_twos);
+
+ common_twos = MIN(a_twos, b_twos);
+ for (;;)
+ {
+ int c;
+ mp_bitcnt_t twos;
+ c = mpz_cmp (a, b);
+ if (c == 0)
+ break;
+ if (c < 0)
+ mpz_swap (a, b);
+ mpz_sub (a, a, b);
+ twos = mpz_scan1 (a, 0);
+ mpz_tdiv_q_2exp (a, a, twos);
+ }
+ mpz_mul_2exp (g, a, common_twos);
+
+ mpz_clear (a);
+ mpz_clear (b);
+}
+
+/* (0/b), with mpz b; is 1 if b=+/-1, 0 otherwise */
+#define JACOBI_0Z(b) JACOBI_0LS (PTR(b)[0], SIZ(b))
+
+/* (a/b) effect due to sign of b: mpz/mpz */
+#define JACOBI_BSGN_ZZ_BIT1(a, b) JACOBI_BSGN_SS_BIT1 (SIZ(a), SIZ(b))
+
+/* (a/b) effect due to sign of a: mpz/unsigned-mpz, b odd;
+ is (-1/b) if a<0, or +1 if a>=0 */
+#define JACOBI_ASGN_ZZU_BIT1(a, b) JACOBI_ASGN_SU_BIT1 (SIZ(a), PTR(b)[0])
+
+int
+refmpz_kronecker (mpz_srcptr a_orig, mpz_srcptr b_orig)
+{
+ unsigned long twos;
+ mpz_t a, b;
+ int result_bit1 = 0;
+
+ if (mpz_sgn (b_orig) == 0)
+ return JACOBI_Z0 (a_orig); /* (a/0) */
+
+ if (mpz_sgn (a_orig) == 0)
+ return JACOBI_0Z (b_orig); /* (0/b) */
+
+ if (mpz_even_p (a_orig) && mpz_even_p (b_orig))
+ return 0;
+
+ if (mpz_cmp_ui (b_orig, 1) == 0)
+ return 1;
+
+ mpz_init_set (a, a_orig);
+ mpz_init_set (b, b_orig);
+
+ if (mpz_sgn (b) < 0)
+ {
+ result_bit1 ^= JACOBI_BSGN_ZZ_BIT1 (a, b);
+ mpz_neg (b, b);
+ }
+ if (mpz_even_p (b))
+ {
+ twos = mpz_scan1 (b, 0L);
+ mpz_tdiv_q_2exp (b, b, twos);
+ result_bit1 ^= JACOBI_TWOS_U_BIT1 (twos, PTR(a)[0]);
+ }
+
+ if (mpz_sgn (a) < 0)
+ {
+ result_bit1 ^= JACOBI_N1B_BIT1 (PTR(b)[0]);
+ mpz_neg (a, a);
+ }
+ if (mpz_even_p (a))
+ {
+ twos = mpz_scan1 (a, 0L);
+ mpz_tdiv_q_2exp (a, a, twos);
+ result_bit1 ^= JACOBI_TWOS_U_BIT1 (twos, PTR(b)[0]);
+ }
+
+ for (;;)
+ {
+ ASSERT (mpz_odd_p (a));
+ ASSERT (mpz_odd_p (b));
+ ASSERT (mpz_sgn (a) > 0);
+ ASSERT (mpz_sgn (b) > 0);
+
+ TRACE (printf ("top\n");
+ mpz_trace (" a", a);
+ mpz_trace (" b", b));
+
+ if (mpz_cmp (a, b) < 0)
+ {
+ TRACE (printf ("swap\n"));
+ mpz_swap (a, b);
+ result_bit1 ^= JACOBI_RECIP_UU_BIT1 (PTR(a)[0], PTR(b)[0]);
+ }
+
+ if (mpz_cmp_ui (b, 1) == 0)
+ break;
+
+ mpz_sub (a, a, b);
+ TRACE (printf ("sub\n");
+ mpz_trace (" a", a));
+ if (mpz_sgn (a) == 0)
+ goto zero;
+
+ twos = mpz_scan1 (a, 0L);
+ mpz_fdiv_q_2exp (a, a, twos);
+ TRACE (printf ("twos %lu\n", twos);
+ mpz_trace (" a", a));
+ result_bit1 ^= JACOBI_TWOS_U_BIT1 (twos, PTR(b)[0]);
+ }
+
+ mpz_clear (a);
+ mpz_clear (b);
+ return JACOBI_BIT1_TO_PN (result_bit1);
+
+ zero:
+ mpz_clear (a);
+ mpz_clear (b);
+ return 0;
+}
+
+/* Same as mpz_kronecker, but ignoring factors of 2 on b */
+int
+refmpz_jacobi (mpz_srcptr a, mpz_srcptr b)
+{
+ ASSERT_ALWAYS (mpz_sgn (b) > 0);
+ ASSERT_ALWAYS (mpz_odd_p (b));
+
+ return refmpz_kronecker (a, b);
+}
+
+/* Legendre symbol via powm. p must be an odd prime. */
+int
+refmpz_legendre (mpz_srcptr a, mpz_srcptr p)
+{
+ int res;
+
+ mpz_t r;
+ mpz_t e;
+
+ ASSERT_ALWAYS (mpz_sgn (p) > 0);
+ ASSERT_ALWAYS (mpz_odd_p (p));
+
+ mpz_init (r);
+ mpz_init (e);
+
+ mpz_fdiv_r (r, a, p);
+
+ mpz_set (e, p);
+ mpz_sub_ui (e, e, 1);
+ mpz_fdiv_q_2exp (e, e, 1);
+ mpz_powm (r, r, e, p);
+
+ /* Normalize to a more or less symmetric range around zero */
+ if (mpz_cmp (r, e) > 0)
+ mpz_sub (r, r, p);
+
+ ASSERT_ALWAYS (mpz_cmpabs_ui (r, 1) <= 0);
+
+ res = mpz_sgn (r);
+
+ mpz_clear (r);
+ mpz_clear (e);
+
+ return res;
+}
+
+
+int
+refmpz_kronecker_ui (mpz_srcptr a, unsigned long b)
+{
+ mpz_t bz;
+ int ret;
+ mpz_init_set_ui (bz, b);
+ ret = refmpz_kronecker (a, bz);
+ mpz_clear (bz);
+ return ret;
+}
+
+int
+refmpz_kronecker_si (mpz_srcptr a, long b)
+{
+ mpz_t bz;
+ int ret;
+ mpz_init_set_si (bz, b);
+ ret = refmpz_kronecker (a, bz);
+ mpz_clear (bz);
+ return ret;
+}
+
+int
+refmpz_ui_kronecker (unsigned long a, mpz_srcptr b)
+{
+ mpz_t az;
+ int ret;
+ mpz_init_set_ui (az, a);
+ ret = refmpz_kronecker (az, b);
+ mpz_clear (az);
+ return ret;
+}
+
+int
+refmpz_si_kronecker (long a, mpz_srcptr b)
+{
+ mpz_t az;
+ int ret;
+ mpz_init_set_si (az, a);
+ ret = refmpz_kronecker (az, b);
+ mpz_clear (az);
+ return ret;
+}
+
+
+void
+refmpz_pow_ui (mpz_ptr w, mpz_srcptr b, unsigned long e)
+{
+ mpz_t s, t;
+ unsigned long i;
+
+ mpz_init_set_ui (t, 1L);
+ mpz_init_set (s, b);
+
+ if ((e & 1) != 0)
+ mpz_mul (t, t, s);
+
+ for (i = 2; i <= e; i <<= 1)
+ {
+ mpz_mul (s, s, s);
+ if ((i & e) != 0)
+ mpz_mul (t, t, s);
+ }
+
+ mpz_set (w, t);
+
+ mpz_clear (s);
+ mpz_clear (t);
+}
diff --git a/vendor/gmp-6.3.0/tests/spinner.c b/vendor/gmp-6.3.0/tests/spinner.c
new file mode 100644
index 0000000..13448d0
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/spinner.c
@@ -0,0 +1,128 @@
+/* A stupid little spinning wheel designed to make it look like useful work
+ is being done.
+
+Copyright 1999-2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include "config.h"
+
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#if HAVE_UNISTD_H
+#include <unistd.h> /* for isatty */
+#endif
+
+#include "gmp-impl.h"
+
+#include "tests.h"
+
+
+/* "alarm" is not available on mingw32, and the SIGALRM constant is not
+ defined. Don't bother with a spinner in this case. */
+#if ! HAVE_ALARM || ! defined (SIGALRM)
+#define alarm(n) abort()
+#define signal(sig,func) SIG_ERR
+#endif
+
+
+/* An application can update this to get a count printed with the spinner.
+ If left at 0, no count is printed. */
+
+unsigned long spinner_count = 0;
+
+
+int spinner_wanted = -1; /* -1 uninitialized, 1 wanted, 0 not */
+int spinner_tick = 1; /* 1 ready to print, 0 not */
+
+
+/*ARGSUSED*/
+RETSIGTYPE
+spinner_signal (int signum)
+{
+ spinner_tick = 1;
+
+ if (signal (SIGALRM, spinner_signal) == SIG_ERR)
+ {
+ printf ("spinner_signal(): Oops, cannot reinstall SIGALRM\n");
+ abort ();
+ }
+ alarm (1);
+}
+
+
+/* Initialize the spinner.
+
+ This is done the first time spinner() is called, so an application
+ doesn't need to call this directly.
+
+ The spinner is only wanted if the output is a tty. */
+
+#define SPINNER_WANTED_INIT() \
+ if (spinner_wanted < 0) spinner_init ()
+
+void
+spinner_init (void)
+{
+ spinner_wanted = isatty (STDOUT_FILENO);
+ if (spinner_wanted == -1)
+ abort ();
+
+ if (!spinner_wanted)
+ return;
+
+ if (signal (SIGALRM, spinner_signal) == SIG_ERR)
+ {
+ printf ("(no spinner)\r");
+ spinner_tick = 0;
+ return;
+ }
+ alarm (1);
+
+ /* unbuffered output so the spinner will show up */
+ setbuf (stdout, NULL);
+}
+
+
+void
+spinner (void)
+{
+ static const char data[] = { '|', '/', '-', '\\' };
+ static int pos = 0;
+
+ char buf[128];
+
+ SPINNER_WANTED_INIT ();
+
+ if (spinner_tick)
+ {
+ buf[0] = data[pos];
+ pos = (pos + 1) % numberof (data);
+ spinner_tick = 0;
+
+ if (spinner_count != 0)
+ {
+ sprintf (buf+1, " %lu\r", spinner_count);
+ }
+ else
+ {
+ buf[1] = '\r';
+ buf[2] = '\0';
+ }
+ fputs (buf, stdout);
+ }
+}
diff --git a/vendor/gmp-6.3.0/tests/t-bswap.c b/vendor/gmp-6.3.0/tests/t-bswap.c
new file mode 100644
index 0000000..765ef8e
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/t-bswap.c
@@ -0,0 +1,70 @@
+/* Test BSWAP_LIMB.
+
+Copyright 2002 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+int
+main (void)
+{
+ mp_limb_t src, want, got;
+ int i;
+
+ tests_start ();
+ mp_trace_base = -16;
+
+ for (i = 0; i < 1000; i++)
+ {
+ mpn_random (&src, (mp_size_t) 1);
+
+ want = ref_bswap_limb (src);
+
+ BSWAP_LIMB (got, src);
+ if (got != want)
+ {
+ printf ("BSWAP_LIMB wrong result\n");
+ error:
+ mpn_trace (" src ", &src, (mp_size_t) 1);
+ mpn_trace (" want", &want, (mp_size_t) 1);
+ mpn_trace (" got ", &got, (mp_size_t) 1);
+ abort ();
+ }
+
+ BSWAP_LIMB_FETCH (got, &src);
+ if (got != want)
+ {
+ printf ("BSWAP_LIMB_FETCH wrong result\n");
+ goto error;
+ }
+
+ BSWAP_LIMB_STORE (&got, src);
+ if (got != want)
+ {
+ printf ("BSWAP_LIMB_STORE wrong result\n");
+ goto error;
+ }
+ }
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/t-constants.c b/vendor/gmp-6.3.0/tests/t-constants.c
new file mode 100644
index 0000000..35714c7
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/t-constants.c
@@ -0,0 +1,343 @@
+/* Check the values of some constants.
+
+Copyright 2000-2003, 2014 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+#ifdef ULONG_MAX
+const char *ulong_max_def = "defined";
+#else
+const char *ulong_max_def = "not defined";
+#endif
+#ifdef LONG_MAX
+const char *long_max_def = "defined";
+#else
+const char *long_max_def = "not defined";
+#endif
+
+#ifdef UINT_MAX
+const char *uint_max_def = "defined";
+#else
+const char *uint_max_def = "not defined";
+#endif
+#ifdef INT_MAX
+const char *int_max_def = "defined";
+#else
+const char *int_max_def = "not defined";
+#endif
+
+#ifdef USHRT_MAX
+const char *ushrt_max_def = "defined";
+#else
+const char *ushrt_max_def = "not defined";
+#endif
+#ifdef SHRT_MAX
+const char *shrt_max_def = "defined";
+#else
+const char *shrt_max_def = "not defined";
+#endif
+
+#include "gmp-impl.h"
+#include "longlong.h"
+
+
+#ifdef _LONG_LONG_LIMB
+#define LL(l,ll) ll
+#else
+#define LL(l,ll) l
+#endif
+
+#if __GMP_MP_SIZE_T_INT
+#define SS(i,l) i
+#else
+#define SS(i,l) l
+#endif
+
+
+#define CHECK_LIMB_S(x, xname, y, yname) \
+ do { \
+ if ((x) != (y)) \
+ { \
+ printf (LL("%s == %lx, but %s == %lx\n", \
+ "%s == %llx, but %s == %llx\n"), \
+ xname, x, yname, y); \
+ error = 1; \
+ } \
+ } while (0)
+
+#define CHECK_INT_S(x, xname, y, yname) \
+ do { \
+ if ((x) != (y)) \
+ { \
+ printf ("%s == %d, but %s == %d\n", xname, x, yname, y); \
+ error = 1; \
+ } \
+ } while (0)
+
+
+
+#define CHECK_CONDITION_S(x, xname) \
+ do { \
+ if (!(x)) \
+ { \
+ printf ("%s is false\n", xname); \
+ error = 1; \
+ } \
+ } while (0)
+
+
+/* How many bits seem to work in the given type. */
+#define CALC_BITS(result, type) \
+ do { \
+ type n = 1; \
+ result = 0; \
+ while (n != 0) \
+ { \
+ n <<= 1; \
+ result++; \
+ } \
+ } while (0)
+
+#define CHECK_BITS_S(constant, constant_name, type) \
+ do { \
+ int calculated; \
+ CALC_BITS (calculated, type); \
+ if (calculated != constant) \
+ { \
+ printf ("%s == %d, but calculated %d\n", \
+ constant_name, constant, calculated); \
+ error = 1; \
+ } \
+ } while (0)
+
+
+#define CHECK_HIGHBIT_S(value, value_name, type, format) \
+ do { \
+ type n = value; \
+ if (n == 0) \
+ { \
+ printf ("%s == 0\n", value_name); \
+ error = 1; \
+ } \
+ n <<= 1; \
+ if (n != 0) \
+ { \
+ printf ("%s << 1 = ", value_name); \
+ printf (format, n); \
+ printf (" != 0\n"); \
+ error = 1; \
+ } \
+ } while (0)
+
+
+#define CHECK_MAX_S(max_val, max_name, min_val, min_name, type, format) \
+ do { \
+ type maxval = max_val; \
+ type minval = min_val; \
+ type n = maxval; \
+ n++; \
+ if (n != minval) \
+ { \
+ printf ("%s + 1 = ", max_name); \
+ printf (format, n); \
+ printf (" != %s = ", min_name); \
+ printf (format, minval); \
+ printf ("\n"); \
+ error = 1; \
+ } \
+ if (maxval <= minval) \
+ { \
+ printf ("%s = ", max_name); \
+ printf (format, maxval); \
+ printf (" <= %s = ", min_name); \
+ printf (format, minval); \
+ printf ("\n"); \
+ error = 1; \
+ } \
+ } while (0)
+
+
+#define CHECK_LIMB(x,y) CHECK_LIMB_S (x, #x, y, #y)
+#define CHECK_INT(x,y) CHECK_INT_S (x, #x, y, #y)
+#define CHECK_CONDITION(x) CHECK_CONDITION_S (x, #x)
+#define CHECK_BITS(c,t) CHECK_BITS_S (c, #c, t)
+#define CHECK_MAX(m,n,t,f) CHECK_MAX_S (m, #m, n, #n, t, f)
+#define CHECK_HIGHBIT(n,t,f) CHECK_HIGHBIT_S (n, #n, t, f)
+
+
+/* The tests below marked "Bad!" fail on Cray T90 systems, where int, short
+ and mp_size_t are 48 bits or some such but don't wraparound in a plain
+ twos complement fashion. In particular,
+
+ INT_HIGHBIT << 1 = 0xFFFFC00000000000 != 0
+ INT_MAX + 1 = 35184372088832 != INT_MIN = -35184372088832
+
+ This is a bit bizarre, but doesn't matter because GMP doesn't rely on any
+ particular overflow behaviour for int or short, only for mp_limb_t. */
+
+int
+main (int argc, char *argv[])
+{
+ int error = 0;
+
+ CHECK_INT (GMP_LIMB_BYTES, (int) sizeof(mp_limb_t));
+ CHECK_INT (mp_bits_per_limb, GMP_LIMB_BITS);
+
+ CHECK_BITS (GMP_LIMB_BITS, mp_limb_t);
+ CHECK_BITS (BITS_PER_ULONG, unsigned long);
+
+ CHECK_HIGHBIT (GMP_LIMB_HIGHBIT, mp_limb_t, LL("0x%lX","0x%llX"));
+ CHECK_HIGHBIT (ULONG_HIGHBIT, unsigned long, "0x%lX");
+ CHECK_HIGHBIT (UINT_HIGHBIT, unsigned int, "0x%X");
+ CHECK_HIGHBIT (USHRT_HIGHBIT, unsigned short, "0x%hX");
+#if 0 /* Bad! */
+ CHECK_HIGHBIT (LONG_HIGHBIT, long, "0x%lX");
+ CHECK_HIGHBIT (INT_HIGHBIT, int, "0x%X");
+ CHECK_HIGHBIT (SHRT_HIGHBIT, short, "0x%hX");
+#endif
+
+#if 0 /* Bad! */
+ CHECK_MAX (LONG_MAX, LONG_MIN, long, "%ld");
+ CHECK_MAX (INT_MAX, INT_MIN, int, "%d");
+ CHECK_MAX (SHRT_MAX, SHRT_MIN, short, "%hd");
+#endif
+ CHECK_MAX (ULONG_MAX, 0, unsigned long, "%lu");
+ CHECK_MAX (UINT_MAX, 0, unsigned int, "%u");
+ CHECK_MAX (USHRT_MAX, 0, unsigned short, "%hu");
+#if 0 /* Bad! */
+ CHECK_MAX (MP_SIZE_T_MAX, MP_SIZE_T_MIN, mp_size_t, SS("%d","%ld"));
+#endif
+
+ /* UHWtype should have at least enough bits for half a UWtype */
+ {
+ int bits_per_UWtype, bits_per_UHWtype;
+ CALC_BITS (bits_per_UWtype, UWtype);
+ CALC_BITS (bits_per_UHWtype, UHWtype);
+ CHECK_CONDITION (2*bits_per_UHWtype >= bits_per_UWtype);
+ }
+
+ ASSERT_ALWAYS_LIMB (MODLIMB_INVERSE_3);
+ {
+ mp_limb_t modlimb_inverse_3_calc;
+ binvert_limb (modlimb_inverse_3_calc, CNST_LIMB(3));
+ ASSERT_ALWAYS_LIMB (modlimb_inverse_3_calc);
+ CHECK_LIMB (MODLIMB_INVERSE_3, modlimb_inverse_3_calc);
+ }
+ {
+ mp_limb_t MODLIMB_INVERSE_3_times_3
+ = (MODLIMB_INVERSE_3 * CNST_LIMB(3)) & GMP_NUMB_MASK;
+ CHECK_LIMB (MODLIMB_INVERSE_3_times_3, CNST_LIMB(1));
+ }
+
+ {
+ mp_limb_t hi, lo;
+ hi = refmpn_umul_ppmm (&lo, GMP_NUMB_CEIL_MAX_DIV3-1,
+ CNST_LIMB(3) << GMP_NAIL_BITS);
+ if (! (hi < 1))
+ {
+ printf ("GMP_NUMB_CEIL_MAX_DIV3 too big\n");
+ error = 1;
+ }
+ hi = refmpn_umul_ppmm (&lo, GMP_NUMB_CEIL_MAX_DIV3,
+ CNST_LIMB(3) << GMP_NAIL_BITS);
+ if (! (hi >= 1))
+ {
+ printf ("GMP_NUMB_CEIL_MAX_DIV3 too small\n");
+ error = 1;
+ }
+ }
+
+ {
+ mp_limb_t hi, lo;
+ hi = refmpn_umul_ppmm (&lo, GMP_NUMB_CEIL_2MAX_DIV3-1,
+ CNST_LIMB(3) << GMP_NAIL_BITS);
+ if (! (hi < 2))
+ {
+ printf ("GMP_NUMB_CEIL_2MAX_DIV3 too big\n");
+ error = 1;
+ }
+ hi = refmpn_umul_ppmm (&lo, GMP_NUMB_CEIL_2MAX_DIV3,
+ CNST_LIMB(3) << GMP_NAIL_BITS);
+ if (! (hi >= 2))
+ {
+ printf ("GMP_NUMB_CEIL_2MAX_DIV3 too small\n");
+ error = 1;
+ }
+ }
+
+#ifdef PP_INVERTED
+ {
+ mp_limb_t pp_inverted_calc;
+ invert_limb (pp_inverted_calc, PP);
+ CHECK_LIMB (PP_INVERTED, pp_inverted_calc);
+ }
+#endif
+
+ if (argc >= 2 || error)
+ {
+ int bits;
+
+ printf ("\n");
+ printf ("After gmp.h,\n");
+ printf (" ULONG_MAX %s\n", ulong_max_def);
+ printf (" LONG_MAX %s\n", long_max_def);
+ printf (" UINT_MAX %s\n", uint_max_def);
+ printf (" INT_MAX %s\n", int_max_def);
+ printf (" USHRT_MAX %s\n", ushrt_max_def);
+ printf (" SHRT_MAX %s\n", shrt_max_def);
+ printf ("\n");
+
+#ifdef _CRAY
+ printf ("_CRAY is defined, so limits.h is being used\n");
+#endif
+
+ printf ("ULONG_MAX %lX\n", ULONG_MAX);
+ printf ("ULONG_HIGHBIT %lX\n", ULONG_HIGHBIT);
+ printf ("LONG_MAX %lX\n", LONG_MAX);
+ printf ("LONG_MIN %lX\n", LONG_MIN);
+
+ printf ("UINT_MAX %X\n", UINT_MAX);
+ printf ("UINT_HIGHBIT %X\n", UINT_HIGHBIT);
+ printf ("INT_MAX %X\n", INT_MAX);
+ printf ("INT_MIN %X\n", INT_MIN);
+
+ printf ("USHRT_MAX %X\n", USHRT_MAX);
+ printf ("USHRT_HIGHBIT %X\n", USHRT_HIGHBIT);
+ printf ("SHRT_MAX %X\n", SHRT_MAX);
+ printf ("SHRT_MIN %X\n", SHRT_MIN);
+
+ printf ("\n");
+ printf ("Bits\n");
+ CALC_BITS (bits, long); printf (" long %d\n", bits);
+ CALC_BITS (bits, int); printf (" int %d\n", bits);
+ CALC_BITS (bits, short); printf (" short %d\n", bits);
+ CALC_BITS (bits, unsigned long); printf (" unsigned long %d\n", bits);
+ CALC_BITS (bits, unsigned int); printf (" unsigned int %d\n", bits);
+ CALC_BITS (bits, unsigned short); printf (" unsigned short %d\n", bits);
+ CALC_BITS (bits, mp_size_t); printf (" mp_size_t %d\n", bits);
+ }
+
+ if (error)
+ abort ();
+
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/t-count_zeros.c b/vendor/gmp-6.3.0/tests/t-count_zeros.c
new file mode 100644
index 0000000..5bb243c
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/t-count_zeros.c
@@ -0,0 +1,86 @@
+/* Test count_leading_zeros and count_trailing_zeros.
+
+Copyright 2001-2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "longlong.h"
+#include "tests.h"
+
+void
+check_clz (int want, mp_limb_t n)
+{
+ int got;
+ count_leading_zeros (got, n);
+ if (got != want)
+ {
+ printf ("count_leading_zeros wrong\n");
+ mp_limb_trace (" n ", n);
+ printf (" want %d\n", want);
+ printf (" got %d\n", got);
+ abort ();
+ }
+}
+
+void
+check_ctz (int want, mp_limb_t n)
+{
+ int got;
+ count_trailing_zeros (got, n);
+ if (got != want)
+ {
+ printf ("count_trailing_zeros wrong\n");
+ mpn_trace (" n ", &n, (mp_size_t) 1);
+ printf (" want %d\n", want);
+ printf (" got %d\n", got);
+ abort ();
+ }
+}
+
+void
+check_various (void)
+{
+ int i;
+
+#ifdef COUNT_LEADING_ZEROS_0
+ check_clz (COUNT_LEADING_ZEROS_0, CNST_LIMB(0));
+#endif
+
+ for (i=0; i < GMP_LIMB_BITS; i++)
+ {
+ check_clz (i, CNST_LIMB(1) << (GMP_LIMB_BITS-1-i));
+ check_ctz (i, CNST_LIMB(1) << i);
+
+ check_ctz (i, MP_LIMB_T_MAX << i);
+ check_clz (i, MP_LIMB_T_MAX >> i);
+ }
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+ mp_trace_base = 16;
+
+ check_various ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/t-hightomask.c b/vendor/gmp-6.3.0/tests/t-hightomask.c
new file mode 100644
index 0000000..3c65d03
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/t-hightomask.c
@@ -0,0 +1,42 @@
+/* Test LIMB_HIGHBIT_TO_MASK.
+
+Copyright 2004 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+/* There's very little to these tests, but it's nice to have them since if
+ something has gone wrong with the arithmetic right shift business in
+ LIMB_HIGHBIT_TO_MASK then the only symptom is likely to be failures in
+ udiv_qrnnd_preinv, which would not be easy to diagnose. */
+
+int
+main (void)
+{
+ ASSERT_ALWAYS (LIMB_HIGHBIT_TO_MASK (0) == 0);
+ ASSERT_ALWAYS (LIMB_HIGHBIT_TO_MASK (GMP_LIMB_HIGHBIT) == MP_LIMB_T_MAX);
+ ASSERT_ALWAYS (LIMB_HIGHBIT_TO_MASK (MP_LIMB_T_MAX) == MP_LIMB_T_MAX);
+ ASSERT_ALWAYS (LIMB_HIGHBIT_TO_MASK (GMP_LIMB_HIGHBIT >> 1) == 0);
+ ASSERT_ALWAYS (LIMB_HIGHBIT_TO_MASK (MP_LIMB_T_MAX >> 1) == 0);
+
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/t-modlinv.c b/vendor/gmp-6.3.0/tests/t-modlinv.c
new file mode 100644
index 0000000..47f5533
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/t-modlinv.c
@@ -0,0 +1,83 @@
+/* Test binvert_limb.
+
+Copyright 2000-2003 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "gmp-impl.h"
+#include "longlong.h"
+#include "tests.h"
+
+
+void
+one (mp_limb_t n)
+{
+ mp_limb_t inv, prod;
+
+ binvert_limb (inv, n);
+ prod = (inv * n) & GMP_NUMB_MASK;
+ if (prod != 1)
+ {
+ printf ("binvert_limb wrong\n");
+ mp_limb_trace (" n ", n);
+ mp_limb_trace (" got ", inv);
+ mp_limb_trace (" product ", prod);
+ abort ();
+ }
+}
+
+void
+some (void)
+{
+ int i;
+ for (i = 0; i < 10000; i++)
+ one (refmpn_random_limb () | 1);
+}
+
+void
+all (void)
+{
+ mp_limb_t n;
+
+ n = 1;
+ do {
+ one (n);
+ n += 2;
+ } while (n != 1);
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+
+ if (argc >= 2 && strcmp (argv[1], "-a") == 0)
+ {
+ /* it's feasible to run all values on a 32-bit limb, but not a 64-bit */
+ all ();
+ }
+ else
+ {
+ some ();
+ }
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/t-parity.c b/vendor/gmp-6.3.0/tests/t-parity.c
new file mode 100644
index 0000000..b6f2366
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/t-parity.c
@@ -0,0 +1,66 @@
+/* Test ULONG_PARITY.
+
+Copyright 2002, 2014 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+void
+check_one (int want, unsigned long n)
+{
+ int got;
+ ULONG_PARITY (got, n);
+ if (got != want)
+ {
+ printf ("ULONG_PARITY wrong\n");
+ printf (" n %lX\n", n);
+ printf (" want %d\n", want);
+ printf (" got %d\n", got);
+ abort ();
+ }
+}
+
+void
+check_various (void)
+{
+ int i;
+
+ check_one (0, 0L);
+ check_one (BITS_PER_ULONG & 1, ULONG_MAX);
+ check_one (0, 0x11L);
+ check_one (1, 0x111L);
+ check_one (1, 0x3111L);
+
+ for (i = 0; i < BITS_PER_ULONG; i++)
+ check_one (1, 1UL << i);
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ tests_start ();
+ mp_trace_base = 16;
+
+ check_various ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/t-popc.c b/vendor/gmp-6.3.0/tests/t-popc.c
new file mode 100644
index 0000000..421d4e2
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/t-popc.c
@@ -0,0 +1,79 @@
+/* Test popc_limb.
+
+Copyright 2002, 2012 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+int
+main (void)
+{
+ mp_limb_t src, want, got;
+ int i;
+
+ tests_start ();
+ mp_trace_base = -16;
+
+ for (i = 0; i < GMP_LIMB_BITS; i++)
+ {
+ src = CNST_LIMB(1) << i;
+ want = 1;
+
+ popc_limb (got, src);
+ if (got != want)
+ {
+ error:
+ printf ("popc_limb wrong result\n");
+ mpn_trace (" src ", &src, (mp_size_t) 1);
+ mpn_trace (" want", &want, (mp_size_t) 1);
+ mpn_trace (" got ", &got, (mp_size_t) 1);
+ abort ();
+ }
+ }
+
+ src = 0;
+ want = 0;
+ for (i = 0; i < GMP_LIMB_BITS; i++)
+ {
+ src += CNST_LIMB(1) << i;
+ want += 1;
+
+ popc_limb (got, src);
+ if (got != want)
+ {
+ goto error;
+ }
+ }
+
+ for (i = 0; i < 100; i++)
+ {
+ mpn_random2 (&src, (mp_size_t) 1);
+ want = ref_popc_limb (src);
+
+ popc_limb (got, src);
+ if (got != want)
+ goto error;
+ }
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/t-sub.c b/vendor/gmp-6.3.0/tests/t-sub.c
new file mode 100644
index 0000000..e916d4f
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/t-sub.c
@@ -0,0 +1,114 @@
+/* Test sub_ddmmss.
+
+Copyright 2004 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gmp-impl.h"
+#include "longlong.h"
+#include "tests.h"
+
+
+void
+check_data (void)
+{
+#define M MP_LIMB_T_MAX
+
+ static const struct {
+ mp_limb_t want_dh,want_dl, mh,ml, sh,sl;
+ } data[] = {
+ { 0,0, 0,0, 0,0 },
+ { 0,0, 0,1, 0,1 },
+ { 0,0, 1,2, 1,2 },
+
+ { 0,1, 0,2, 0,1 },
+ { 0,M, 1,0, 0,1 },
+ { M,M, 0,0, 0,1 },
+
+ { M,M, 0,M-1, 0,M },
+ { 0,0, 0,M-1, 0,M-1 },
+ { 0,1, 0,M-1, 0,M-2 },
+ };
+ int i;
+ mp_limb_t got_dh, got_dl;
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ sub_ddmmss (got_dh,got_dl, data[i].mh,data[i].ml, data[i].sh,data[i].sl);
+ if (got_dh != data[i].want_dh || got_dl != data[i].want_dl)
+ {
+ printf ("check_data wrong at data[%d]\n", i);
+ mp_limb_trace (" mh", data[i].mh);
+ mp_limb_trace (" ml", data[i].ml);
+ mp_limb_trace (" sh", data[i].sh);
+ mp_limb_trace (" sl", data[i].sl);
+ mp_limb_trace (" want dh", data[i].want_dh);
+ mp_limb_trace (" want dl", data[i].want_dl);
+ mp_limb_trace (" got dh ", got_dh);
+ mp_limb_trace (" got dl ", got_dl);
+ abort ();
+ }
+ }
+}
+
+void
+check_random (void)
+{
+ mp_limb_t want_dh,want_dl, got_dh,got_dl, mh,ml, sh,sl;
+ int i;
+
+ for (i = 0; i < 20; i++)
+ {
+ mh = urandom ();
+ ml = urandom ();
+ sh = urandom ();
+ sl = urandom ();
+
+ refmpn_sub_ddmmss (&want_dh,&want_dl, mh,ml, sh,sl);
+
+ sub_ddmmss (got_dh,got_dl, mh,ml, sh,sl);
+
+ if (got_dh != want_dh || got_dl != want_dl)
+ {
+ printf ("check_data wrong at data[%d]\n", i);
+ mp_limb_trace (" mh", mh);
+ mp_limb_trace (" ml", ml);
+ mp_limb_trace (" sh", sh);
+ mp_limb_trace (" sl", sl);
+ mp_limb_trace (" want dh", want_dh);
+ mp_limb_trace (" want dl", want_dl);
+ mp_limb_trace (" got dh ", got_dh);
+ mp_limb_trace (" got dl ", got_dl);
+ abort ();
+ }
+ }
+}
+
+int
+main (void)
+{
+ tests_start ();
+ mp_trace_base = -16;
+
+ check_data ();
+ check_random ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/vendor/gmp-6.3.0/tests/tests.h b/vendor/gmp-6.3.0/tests/tests.h
new file mode 100644
index 0000000..882c634
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/tests.h
@@ -0,0 +1,447 @@
+/* Tests support prototypes etc.
+
+Copyright 2000-2004, 2008-2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+#ifndef __TESTS_H__
+#define __TESTS_H__
+
+#include "config.h"
+
+#include <setjmp.h> /* for jmp_buf */
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+#ifdef __cplusplus
+#define ANYARGS ...
+#else
+#define ANYARGS
+#endif
+
+
+void tests_start (void);
+void tests_end (void);
+
+void tests_memory_start (void);
+void tests_memory_end (void);
+void *tests_allocate (size_t);
+void *tests_reallocate (void *, size_t, size_t);
+void tests_free (void *, size_t);
+void tests_free_nosize (void *);
+int tests_memory_valid (void *);
+
+void tests_rand_start (void);
+void tests_rand_end (void);
+
+double tests_infinity_d ();
+int tests_hardware_getround (void);
+int tests_hardware_setround (int);
+int tests_isinf (double);
+int tests_dbl_mant_bits (void);
+
+void x86_fldcw (unsigned short);
+unsigned short x86_fstcw (void);
+
+
+/* tests_setjmp_sigfpe is like a setjmp, establishing a trap for SIGFPE.
+ The initial return is 0, if SIGFPE is trapped execution goes back there
+ with return value 1.
+
+ tests_sigfpe_done puts SIGFPE back to SIG_DFL, which should be used once
+ the setjmp point is out of scope, so a later SIGFPE won't try to go back
+ there. */
+
+#define tests_setjmp_sigfpe() \
+ (signal (SIGFPE, tests_sigfpe_handler), \
+ setjmp (tests_sigfpe_target))
+
+RETSIGTYPE tests_sigfpe_handler (int);
+void tests_sigfpe_done (void);
+extern jmp_buf tests_sigfpe_target;
+
+
+#if HAVE_CALLING_CONVENTIONS
+extern mp_limb_t (*calling_conventions_function) (ANYARGS);
+mp_limb_t calling_conventions (ANYARGS);
+int calling_conventions_check (void);
+#define CALLING_CONVENTIONS(function) \
+ (calling_conventions_function = (function), calling_conventions)
+#define CALLING_CONVENTIONS_CHECK() (calling_conventions_check())
+#else
+#define CALLING_CONVENTIONS(function) (function)
+#define CALLING_CONVENTIONS_CHECK() 1 /* always ok */
+#endif
+
+
+extern int mp_trace_base;
+void mp_limb_trace (const char *, mp_limb_t);
+void mpn_trace (const char *, mp_srcptr, mp_size_t);
+void mpn_tracea (const char *, const mp_ptr *, int, mp_size_t);
+void mpn_tracen (const char *, int, mp_srcptr, mp_size_t);
+void mpn_trace_file (const char *, mp_srcptr, mp_size_t);
+void mpn_tracea_file (const char *, const mp_ptr *, int, mp_size_t);
+void mpf_trace (const char *, mpf_srcptr);
+void mpq_trace (const char *, mpq_srcptr);
+void mpz_trace (const char *, mpz_srcptr);
+void mpz_tracen (const char *, int, mpz_srcptr);
+void byte_trace (const char *, const void *, mp_size_t);
+void byte_tracen (const char *, int, const void *, mp_size_t);
+void d_trace (const char *, double);
+
+
+void spinner (void);
+extern unsigned long spinner_count;
+extern int spinner_wanted;
+extern int spinner_tick;
+
+
+void *align_pointer (void *, size_t);
+void *__gmp_allocate_func_aligned (size_t, size_t);
+void *__gmp_allocate_or_reallocate (void *, size_t, size_t);
+char *__gmp_allocate_strdup (const char *);
+char *strtoupper (char *);
+mp_limb_t urandom (void);
+void call_rand_algs (void (*func) (const char *, gmp_randstate_t));
+
+
+void mpf_set_str_or_abort (mpf_ptr, const char *, int);
+
+
+void mpq_set_str_or_abort (mpq_ptr, const char *, int);
+
+
+void mpz_erandomb (mpz_ptr, gmp_randstate_t, unsigned long);
+void mpz_erandomb_nonzero (mpz_ptr, gmp_randstate_t, unsigned long);
+void mpz_errandomb (mpz_ptr, gmp_randstate_t, unsigned long);
+void mpz_errandomb_nonzero (mpz_ptr, gmp_randstate_t, unsigned long);
+void mpz_init_set_n (mpz_ptr, mp_srcptr, mp_size_t);
+void mpz_negrandom (mpz_ptr, gmp_randstate_t);
+int mpz_pow2abs_p (mpz_srcptr) __GMP_ATTRIBUTE_PURE;
+void mpz_set_n (mpz_ptr, mp_srcptr, mp_size_t);
+void mpz_set_str_or_abort (mpz_ptr, const char *, int);
+void mpz_clobber(mpz_ptr);
+
+mp_size_t mpn_diff_highest (mp_srcptr, mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE;
+mp_size_t mpn_diff_lowest (mp_srcptr, mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE;
+mp_size_t byte_diff_highest (const void *, const void *, mp_size_t) __GMP_ATTRIBUTE_PURE;
+mp_size_t byte_diff_lowest (const void *, const void *, mp_size_t) __GMP_ATTRIBUTE_PURE;
+
+
+mp_limb_t ref_addc_limb (mp_limb_t *, mp_limb_t, mp_limb_t);
+mp_limb_t ref_bswap_limb (mp_limb_t);
+unsigned long ref_popc_limb (mp_limb_t);
+mp_limb_t ref_subc_limb (mp_limb_t *, mp_limb_t, mp_limb_t);
+
+
+void refmpf_add (mpf_ptr, mpf_srcptr, mpf_srcptr);
+void refmpf_add_ulp (mpf_ptr );
+void refmpf_fill (mpf_ptr, mp_size_t, mp_limb_t);
+void refmpf_normalize (mpf_ptr);
+void refmpf_set_prec_limbs (mpf_ptr, unsigned long);
+unsigned long refmpf_set_overlap (mpf_ptr, mpf_srcptr);
+void refmpf_sub (mpf_ptr, mpf_srcptr, mpf_srcptr);
+int refmpf_validate (const char *, mpf_srcptr, mpf_srcptr);
+int refmpf_validate_division (const char *, mpf_srcptr, mpf_srcptr, mpf_srcptr);
+
+
+mp_limb_t refmpn_cnd_add_n (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_cnd_sub_n (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+
+mp_limb_t refmpn_add (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_add_err1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_add_err2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_add_err3_n (mp_ptr, mp_srcptr, mp_srcptr, mp_ptr, mp_srcptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_add_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_addlsh1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_addlsh2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_addlsh_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned);
+mp_limb_t refmpn_addlsh1_n_ip1 (mp_ptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_addlsh2_n_ip1 (mp_ptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_addlsh_n_ip1 (mp_ptr, mp_srcptr, mp_size_t, unsigned);
+mp_limb_t refmpn_addlsh1_n_ip2 (mp_ptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_addlsh2_n_ip2 (mp_ptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_addlsh_n_ip2 (mp_ptr, mp_srcptr, mp_size_t, unsigned);
+mp_limb_t refmpn_addlsh1_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_addlsh2_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_addlsh_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned, mp_limb_t);
+mp_limb_t refmpn_addmul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_addmul_1c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
+mp_limb_t refmpn_addmul_2 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+mp_limb_t refmpn_addmul_3 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+mp_limb_t refmpn_addmul_4 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+mp_limb_t refmpn_addmul_5 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+mp_limb_t refmpn_addmul_6 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+mp_limb_t refmpn_addmul_7 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+mp_limb_t refmpn_addmul_8 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+
+mp_limb_t refmpn_add_n_sub_n (mp_ptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_add_n_sub_nc (mp_ptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+
+void refmpn_and_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+void refmpn_andn_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+
+mp_limb_t refmpn_big_base (int);
+
+int refmpn_chars_per_limb (int);
+void refmpn_clrbit (mp_ptr, unsigned long);
+int refmpn_cmp (mp_srcptr, mp_srcptr, mp_size_t);
+int refmpn_cmp_allowzero (mp_srcptr, mp_srcptr, mp_size_t);
+int refmpn_cmp_twosizes (mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+
+void refmpn_com (mp_ptr, mp_srcptr, mp_size_t);
+void refmpn_copy (mp_ptr, mp_srcptr, mp_size_t);
+void refmpn_copyi (mp_ptr, mp_srcptr, mp_size_t);
+void refmpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
+void refmpn_copy_extend (mp_ptr, mp_size_t, mp_srcptr, mp_size_t);
+
+unsigned refmpn_count_leading_zeros (mp_limb_t);
+unsigned refmpn_count_trailing_zeros (mp_limb_t);
+
+mp_limb_t refmpn_divexact_by3 (mp_ptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_divexact_by3c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+
+mp_limb_t refmpn_divmod_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_divmod_1c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
+mp_limb_t refmpn_divrem_1 (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_divrem_1c (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
+mp_limb_t refmpn_divrem_2 (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr);
+
+int refmpn_equal_anynail (mp_srcptr, mp_srcptr, mp_size_t);
+
+void refmpn_fill (mp_ptr, mp_size_t, mp_limb_t);
+
+mp_limb_t refmpn_gcd_11 (mp_limb_t, mp_limb_t);
+mp_limb_t refmpn_gcd_1 (mp_srcptr, mp_size_t, mp_limb_t);
+mp_double_limb_t refmpn_gcd_22 (mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t);
+mp_limb_t refmpn_gcd (mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
+
+size_t refmpn_get_str (unsigned char *, int, mp_ptr, mp_size_t);
+
+unsigned long refmpn_hamdist (mp_srcptr, mp_srcptr, mp_size_t);
+
+mp_limb_t refmpn_invert_limb (mp_limb_t);
+void refmpn_ior_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+void refmpn_iorn_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+
+mp_limb_t refmpn_lshift (mp_ptr, mp_srcptr, mp_size_t, unsigned);
+mp_limb_t refmpn_lshift_or_copy (mp_ptr, mp_srcptr, mp_size_t, unsigned);
+mp_limb_t refmpn_lshift_or_copy_any (mp_ptr, mp_srcptr, mp_size_t, unsigned);
+mp_limb_t refmpn_lshiftc (mp_ptr, mp_srcptr, mp_size_t, unsigned);
+void refmpn_com (mp_ptr, mp_srcptr, mp_size_t);
+
+mp_ptr refmpn_malloc_limbs (mp_size_t);
+mp_ptr refmpn_malloc_limbs_aligned (mp_size_t, size_t);
+void refmpn_free_limbs (mp_ptr);
+mp_limb_t refmpn_msbone (mp_limb_t);
+mp_limb_t refmpn_msbone_mask (mp_limb_t);
+mp_ptr refmpn_memdup_limbs (mp_srcptr, mp_size_t);
+
+mp_limb_t refmpn_mod_1 (mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_mod_1c (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
+mp_limb_t refmpn_mod_34lsub1 (mp_srcptr, mp_size_t);
+
+mp_limb_t refmpn_mul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_mul_1c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
+mp_limb_t refmpn_mul_2 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+mp_limb_t refmpn_mul_3 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+mp_limb_t refmpn_mul_4 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+mp_limb_t refmpn_mul_5 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+mp_limb_t refmpn_mul_6 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+
+void refmpn_mul_basecase (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+void refmpn_mulmid_basecase (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+void refmpn_toom42_mulmid (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr);
+void refmpn_mulmid_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+void refmpn_mulmid (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+void refmpn_mullo_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+void refmpn_mul_any (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+void refmpn_mul_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+void refmpn_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+
+void refmpn_nand_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+void refmpn_nior_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_neg (mp_ptr, mp_srcptr, mp_size_t);
+mp_size_t refmpn_normalize (mp_srcptr, mp_size_t);
+
+unsigned long refmpn_popcount (mp_srcptr, mp_size_t);
+mp_limb_t refmpn_preinv_divrem_1 (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, unsigned);
+mp_limb_t refmpn_preinv_mod_1 (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
+
+void refmpn_random (mp_ptr, mp_size_t);
+void refmpn_random2 (mp_ptr, mp_size_t);
+mp_limb_t refmpn_random_limb (void);
+
+mp_limb_t refmpn_rsh1add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_rsh1sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_rshift (mp_ptr, mp_srcptr, mp_size_t, unsigned);
+mp_limb_t refmpn_rshift_or_copy (mp_ptr, mp_srcptr, mp_size_t, unsigned);
+mp_limb_t refmpn_rshift_or_copy_any (mp_ptr, mp_srcptr, mp_size_t, unsigned);
+
+mp_limb_t refmpn_sb_div_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t);
+unsigned long refmpn_scan0 (mp_srcptr, unsigned long);
+unsigned long refmpn_scan1 (mp_srcptr, unsigned long);
+void refmpn_setbit (mp_ptr, unsigned long);
+void refmpn_sqr (mp_ptr, mp_srcptr, mp_size_t);
+void refmpn_sqrlo (mp_ptr, mp_srcptr, mp_size_t);
+mp_size_t refmpn_sqrtrem (mp_ptr, mp_ptr, mp_srcptr, mp_size_t);
+
+void refmpn_sub_ddmmss (mp_limb_t *, mp_limb_t *, mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t);
+mp_limb_t refmpn_sub (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_sub_err1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_sub_err2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_sub_err3_n (mp_ptr, mp_srcptr, mp_srcptr, mp_ptr, mp_srcptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_sub_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_sublsh1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_sublsh2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_sublsh_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int);
+mp_limb_t refmpn_sublsh1_n_ip1 (mp_ptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_sublsh2_n_ip1 (mp_ptr, mp_srcptr, mp_size_t);
+mp_limb_t refmpn_sublsh_n_ip1 (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
+mp_limb_t refmpn_sublsh1_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_sublsh2_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_sublsh_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int, mp_limb_t);
+mp_limb_t refmpn_submul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t refmpn_submul_1c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
+
+mp_limb_signed_t refmpn_rsblsh1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_signed_t refmpn_rsblsh2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_signed_t refmpn_rsblsh_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int);
+mp_limb_signed_t refmpn_rsblsh1_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_signed_t);
+mp_limb_signed_t refmpn_rsblsh2_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_signed_t);
+mp_limb_signed_t refmpn_rsblsh_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int, mp_limb_signed_t);
+
+void refmpn_tdiv_qr (mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t);
+int refmpn_tstbit (mp_srcptr, unsigned long);
+
+mp_limb_t refmpn_udiv_qrnnd (mp_limb_t *, mp_limb_t, mp_limb_t, mp_limb_t);
+mp_limb_t refmpn_udiv_qrnnd_r (mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t *);
+mp_limb_t refmpn_umul_ppmm (mp_limb_t *, mp_limb_t, mp_limb_t);
+mp_limb_t refmpn_umul_ppmm_r (mp_limb_t, mp_limb_t, mp_limb_t *);
+
+void refmpn_xnor_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+void refmpn_xor_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+
+void refmpn_zero (mp_ptr, mp_size_t);
+void refmpn_zero_extend (mp_ptr, mp_size_t, mp_size_t);
+int refmpn_zero_p (mp_srcptr, mp_size_t);
+
+void refmpn_binvert (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
+void refmpn_invert (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
+
+
+void refmpq_add (mpq_ptr, mpq_srcptr, mpq_srcptr);
+void refmpq_sub (mpq_ptr, mpq_srcptr, mpq_srcptr);
+
+
+void refmpz_combit (mpz_ptr, unsigned long);
+unsigned long refmpz_hamdist (mpz_srcptr, mpz_srcptr);
+void refmpz_gcd (mpz_ptr, mpz_srcptr, mpz_srcptr);
+int refmpz_kronecker (mpz_srcptr, mpz_srcptr);
+int refmpz_jacobi (mpz_srcptr, mpz_srcptr);
+int refmpz_legendre (mpz_srcptr, mpz_srcptr);
+int refmpz_kronecker_si (mpz_srcptr, long);
+int refmpz_kronecker_ui (mpz_srcptr, unsigned long);
+int refmpz_si_kronecker (long, mpz_srcptr);
+int refmpz_ui_kronecker (unsigned long, mpz_srcptr);
+
+void refmpz_pow_ui (mpz_ptr, mpz_srcptr, unsigned long);
+
+
+#if defined (__cplusplus)
+}
+#endif
+
+
+/* Establish ostringstream and istringstream. Do this here so as to hide
+ the conditionals, rather than putting stuff in each test program.
+
+ Oldish versions of g++, like 2.95.2, don't have <sstream>, only
+ <strstream>. Fake up ostringstream and istringstream classes, but not a
+ full implementation, just enough for our purposes. */
+
+#ifdef __cplusplus
+#if 1 || HAVE_SSTREAM
+#include <sstream>
+#else /* ! HAVE_SSTREAM */
+#include <string>
+#include <strstream>
+class
+ostringstream : public std::ostrstream {
+ public:
+ string str() {
+ int pcount = ostrstream::pcount ();
+ char *s = (char *) (*__gmp_allocate_func) (pcount + 1);
+ memcpy (s, ostrstream::str(), pcount);
+ s[pcount] = '\0';
+ string ret = string(s);
+ (*__gmp_free_func) (s, pcount + 1);
+ return ret; }
+};
+class
+istringstream : public std::istrstream {
+ public:
+ istringstream (const char *s) : istrstream (s) { };
+};
+#endif /* ! HAVE_SSTREAM */
+#endif /* __cplusplus */
+
+
+#define TESTS_REPS(count, argv, argc) \
+ do { \
+ char *envval, *end; \
+ double repfactor; \
+ int reps_nondefault = 0; \
+ if (argc > 1) \
+ { \
+ count = strtol (argv[1], &end, 0); \
+ if (*end || count <= 0) \
+ { \
+ fprintf (stderr, "Invalid test count: %s.\n", argv[1]); \
+ exit (1); \
+ } \
+ argv++; \
+ argc--; \
+ reps_nondefault = 1; \
+ } \
+ envval = getenv ("GMP_CHECK_REPFACTOR"); \
+ if (envval != NULL) \
+ { \
+ repfactor = strtod (envval, &end); \
+ if (*end || repfactor <= 0) \
+ { \
+ fprintf (stderr, "Invalid repfactor: %f.\n", repfactor); \
+ exit (1); \
+ } \
+ count *= repfactor; \
+ count = MAX (count, 1); \
+ reps_nondefault = 1; \
+ } \
+ if (reps_nondefault) \
+ printf ("Running test with %ld repetitions (include this in bug reports)\n",\
+ (long) count); \
+ } while (0)
+
+
+#endif /* __TESTS_H__ */
diff --git a/vendor/gmp-6.3.0/tests/trace.c b/vendor/gmp-6.3.0/tests/trace.c
new file mode 100644
index 0000000..de397f5
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/trace.c
@@ -0,0 +1,317 @@
+/* Support for diagnostic traces.
+
+Copyright 1999-2005 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+
+/* Future: Would like commas printed between limbs in hex or binary, but
+ perhaps not always since it might upset cutting and pasting into bc or
+ whatever. */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h> /* for strlen */
+
+#include "gmp-impl.h"
+
+#include "tests.h"
+
+
+/* Number base for the various trace printing routines.
+ Set this in main() or with the debugger.
+ If hexadecimal is going to be fed into GNU bc, remember to use -16
+ because bc requires upper case. */
+
+int mp_trace_base = 10;
+
+
+void
+mp_trace_start (const char *name)
+{
+ if (name != NULL && name[0] != '\0')
+ printf ("%s=", name);
+
+ switch (ABS (mp_trace_base)) {
+ case 2: printf ("bin:"); break;
+ case 8: printf ("oct:"); break;
+ case 10: break;
+ case 16: printf ("0x"); break;
+ default: printf ("base%d:", ABS (mp_trace_base)); break;
+ }
+}
+
+/* Print "name=value\n" to stdout for an mpq_t value. */
+void
+mpq_trace (const char *name, mpq_srcptr q)
+{
+ mp_trace_start (name);
+ if (q == NULL)
+ {
+ printf ("NULL\n");
+ return;
+ }
+
+ mpq_out_str (stdout, mp_trace_base, q);
+ printf ("\n");
+}
+
+
+/* Print "name=value\n" to stdout for an mpz_t value. */
+void
+mpz_trace (const char *name, mpz_srcptr z)
+{
+ mpq_t q;
+ mp_limb_t one;
+
+ if (z == NULL)
+ {
+ mpq_trace (name, NULL);
+ return;
+ }
+
+ q->_mp_num._mp_alloc = ALLOC(z);
+ q->_mp_num._mp_size = SIZ(z);
+ q->_mp_num._mp_d = PTR(z);
+
+ one = 1;
+ q->_mp_den._mp_alloc = 1;
+ q->_mp_den._mp_size = 1;
+ q->_mp_den._mp_d = &one;
+
+ mpq_trace(name, q);
+}
+
+
+/* Print "name=value\n" to stdout for an mpf_t value. */
+void
+mpf_trace (const char *name, mpf_srcptr f)
+{
+ mp_trace_start (name);
+ if (f == NULL)
+ {
+ printf ("NULL\n");
+ return;
+ }
+
+ mpf_out_str (stdout, ABS (mp_trace_base), 0, f);
+ printf ("\n");
+}
+
+
+/* Print "namenum=value\n" to stdout for an mpz_t value.
+ "name" should have a "%d" to get the number. */
+void
+mpz_tracen (const char *name, int num, mpz_srcptr z)
+{
+ if (name != NULL && name[0] != '\0')
+ {
+ printf (name, num);
+ putchar ('=');
+ }
+ mpz_trace (NULL, z);
+}
+
+
+/* Print "name=value\n" to stdout for an mpn style ptr,size. */
+void
+mpn_trace (const char *name, mp_srcptr ptr, mp_size_t size)
+{
+ mpz_t z;
+ if (ptr == NULL)
+ {
+ mpz_trace (name, NULL);
+ return;
+ }
+ MPN_NORMALIZE (ptr, size);
+ PTR(z) = (mp_ptr) ptr;
+ SIZ(z) = size;
+ ALLOC(z) = size;
+ mpz_trace (name, z);
+}
+
+/* Print "name=value\n" to stdout for a limb, nail doesn't have to be zero. */
+void
+mp_limb_trace (const char *name, mp_limb_t n)
+{
+#if GMP_NAIL_BITS != 0
+ mp_limb_t a[2];
+ a[0] = n & GMP_NUMB_MASK;
+ a[1] = n >> GMP_NUMB_BITS;
+ mpn_trace (name, a, (mp_size_t) 2);
+#else
+ mpn_trace (name, &n, (mp_size_t) 1);
+#endif
+}
+
+
+/* Print "namenum=value\n" to stdout for an mpn style ptr,size.
+ "name" should have a "%d" to get the number. */
+void
+mpn_tracen (const char *name, int num, mp_srcptr ptr, mp_size_t size)
+{
+ if (name != NULL && name[0] != '\0')
+ {
+ printf (name, num);
+ putchar ('=');
+ }
+ mpn_trace (NULL, ptr, size);
+}
+
+
+/* Print "namenum=value\n" to stdout for an array of mpn style ptr,size.
+
+ "a" is an array of pointers, each a[i] is a pointer to "size" many limbs.
+ The formal parameter isn't mp_srcptr because that causes compiler
+ warnings, but the values aren't modified.
+
+ "name" should have a printf style "%d" to get the array index. */
+
+void
+mpn_tracea (const char *name, const mp_ptr *a, int count, mp_size_t size)
+{
+ int i;
+ for (i = 0; i < count; i++)
+ mpn_tracen (name, i, a[i], size);
+}
+
+
+/* Print "value\n" to a file for an mpz_t value. Any previous contents of
+ the file are overwritten, so you need different file names each time this
+ is called.
+
+ Overwriting the file is a feature, it means you get old data replaced
+ when you run a test program repeatedly. */
+
+void
+mpn_trace_file (const char *filename, mp_srcptr ptr, mp_size_t size)
+{
+ FILE *fp;
+ mpz_t z;
+
+ fp = fopen (filename, "w");
+ if (fp == NULL)
+ {
+ perror ("fopen");
+ abort();
+ }
+
+ MPN_NORMALIZE (ptr, size);
+ PTR(z) = (mp_ptr) ptr;
+ SIZ(z) = (int) size;
+
+ mpz_out_str (fp, mp_trace_base, z);
+ fprintf (fp, "\n");
+
+ if (ferror (fp) || fclose (fp) != 0)
+ {
+ printf ("error writing %s\n", filename);
+ abort();
+ }
+}
+
+
+/* Print "value\n" to a set of files, one file for each element of the given
+ array of mpn style ptr,size. Any previous contents of the files are
+ overwritten, so you need different file names each time this is called.
+ Each file is "filenameN" where N is 0 to count-1.
+
+ "a" is an array of pointers, each a[i] is a pointer to "size" many limbs.
+ The formal parameter isn't mp_srcptr because that causes compiler
+ warnings, but the values aren't modified.
+
+ Overwriting the files is a feature, it means you get old data replaced
+ when you run a test program repeatedly. The output style isn't
+ particularly pretty, but at least it gets something out, and you can cat
+ the files into bc, or whatever. */
+
+void
+mpn_tracea_file (const char *filename,
+ const mp_ptr *a, int count, mp_size_t size)
+{
+ char *s;
+ int i;
+ TMP_DECL;
+
+ TMP_MARK;
+ s = (char *) TMP_ALLOC (strlen (filename) + 50);
+
+ for (i = 0; i < count; i++)
+ {
+ sprintf (s, "%s%d", filename, i);
+ mpn_trace_file (s, a[i], size);
+ }
+
+ TMP_FREE;
+}
+
+
+void
+byte_trace (const char *name, const void *ptr, mp_size_t size)
+{
+ const char *fmt;
+ mp_size_t i;
+
+ mp_trace_start (name);
+
+ switch (mp_trace_base) {
+ case 8: fmt = " %o"; break;
+ case 10: fmt = " %d"; break;
+ case 16: fmt = " %x"; break;
+ case -16: fmt = " %X"; break;
+ default: printf ("Oops, unsupported base in byte_trace\n"); abort (); break;
+ }
+
+ for (i = 0; i < size; i++)
+ printf (fmt, (int) ((unsigned char *) ptr)[i]);
+ printf ("\n");
+}
+
+void
+byte_tracen (const char *name, int num, const void *ptr, mp_size_t size)
+{
+ if (name != NULL && name[0] != '\0')
+ {
+ printf (name, num);
+ putchar ('=');
+ }
+ byte_trace (NULL, ptr, size);
+}
+
+
+void
+d_trace (const char *name, double d)
+{
+ union {
+ double d;
+ unsigned char b[sizeof(double)];
+ } u;
+ int i;
+
+ if (name != NULL && name[0] != '\0')
+ printf ("%s=", name);
+
+ u.d = d;
+ printf ("[");
+ for (i = 0; i < sizeof (u.b); i++)
+ {
+ if (i != 0)
+ printf (" ");
+ printf ("%02X", (int) u.b[i]);
+ }
+ printf ("] %.20g\n", d);
+}
diff --git a/vendor/gmp-6.3.0/tests/x86call.asm b/vendor/gmp-6.3.0/tests/x86call.asm
new file mode 100644
index 0000000..462b68b
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/x86call.asm
@@ -0,0 +1,154 @@
+dnl x86 calling conventions checking.
+
+dnl Copyright 2000, 2003, 2010, 2013 Free Software Foundation, Inc.
+
+dnl This file is part of the GNU MP Library test suite.
+
+dnl The GNU MP Library test suite is free software; you can redistribute it
+dnl and/or modify it under the terms of the GNU General Public License as
+dnl published by the Free Software Foundation; either version 3 of the
+dnl License, or (at your option) any later version.
+
+dnl The GNU MP Library test suite is distributed in the hope that it will be
+dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+dnl Public License for more details.
+
+dnl You should have received a copy of the GNU General Public License along
+dnl with the GNU MP Library test suite. If not, see
+dnl https://www.gnu.org/licenses/.
+
+
+dnl The current version of the code attempts to keep the call/return
+dnl prediction stack valid, but matching calls and returns.
+
+include(`../config.m4')
+
+
+C void x86_fldcw (unsigned short cw);
+C
+C Execute an fldcw, setting the x87 control word to cw.
+
+PROLOGUE(x86_fldcw)
+ fldcw 4(%esp)
+ ret
+EPILOGUE()
+
+
+C unsigned short x86_fstcw (void);
+C
+C Execute an fstcw, returning the current x87 control word.
+
+PROLOGUE(x86_fstcw)
+ xor %eax, %eax
+ push %eax
+ fstcw (%esp)
+ pop %eax
+ ret
+EPILOGUE()
+
+
+dnl Instrumented profiling doesn't come out quite right below, since we don't
+dnl do an actual "ret". There's only a few instructions here, so there's no
+dnl great need to get them separately accounted, just let them get attributed
+dnl to the caller. FIXME this comment might no longer be true.
+
+ifelse(WANT_PROFILING,instrument,
+`define(`WANT_PROFILING',no)')
+
+
+C int calling_conventions (...);
+C
+C The global variable "calling_conventions_function" is the function to
+C call, with the arguments as passed here.
+C
+C Perhaps the finit should be done only if the tags word isn't clear, but
+C nothing uses the rounding mode or anything at the moment.
+
+define(`WANT_EBX', eval(4*0)($1))
+define(`WANT_EBP', eval(4*1)($1))
+define(`WANT_ESI', eval(4*2)($1))
+define(`WANT_EDI', eval(4*3)($1))
+
+define(`JUNK_EAX', eval(4*4)($1))
+define(`JUNK_ECX', eval(4*5)($1))
+define(`JUNK_EDX', eval(4*6)($1))
+
+define(`SAVE_EBX', eval(4*7)($1))
+define(`SAVE_EBP', eval(4*8)($1))
+define(`SAVE_ESI', eval(4*9)($1))
+define(`SAVE_EDI', eval(4*10)($1))
+
+define(`RETADDR', eval(4*11)($1))
+
+define(`EBX', eval(4*12)($1))
+define(`EBP', eval(4*13)($1))
+define(`ESI', eval(4*14)($1))
+define(`EDI', eval(4*15)($1))
+define(`EFLAGS', eval(4*16)($1))
+
+
+define(G,
+m4_assert_numargs(1)
+`GSYM_PREFIX`'$1')
+
+ TEXT
+ ALIGN(8)
+PROLOGUE(calling_conventions)
+ LEA( G(calling_conventions_values), %ecx)
+ pop RETADDR(%ecx)
+
+ mov %ebx, SAVE_EBX(%ecx)
+ mov %ebp, SAVE_EBP(%ecx)
+ mov %esi, SAVE_ESI(%ecx)
+ mov %edi, SAVE_EDI(%ecx)
+
+ C Values we expect to see unchanged, as per amd64check.c
+ mov WANT_EBX(%ecx), %ebx
+ mov WANT_EBP(%ecx), %ebp
+ mov WANT_ESI(%ecx), %esi
+ mov WANT_EDI(%ecx), %edi
+
+ C Try to provoke a problem by starting with junk in the caller-saves
+ C registers, especially in %eax and %edx which will be return values
+ mov JUNK_EAX(%ecx), %eax
+ mov JUNK_EDX(%ecx), %edx
+C mov JUNK_ECX(%ecx), %ecx
+
+ifdef(`PIC',`
+ LEA( G(calling_conventions_function), %ecx)
+ call *(%ecx)
+',`
+ call *G(calling_conventions_function)
+')
+
+ LEA( G(calling_conventions_values), %ecx)
+
+ mov %ebx, EBX(%ecx)
+ mov %ebp, EBP(%ecx)
+ mov %esi, ESI(%ecx)
+ mov %edi, EDI(%ecx)
+
+ pushf
+ pop %ebx
+ mov %ebx, EFLAGS(%ecx)
+
+ mov SAVE_EBX(%ecx), %ebx
+ mov SAVE_ESI(%ecx), %esi
+ mov SAVE_EDI(%ecx), %edi
+ mov SAVE_EBP(%ecx), %ebp
+
+ push RETADDR(%ecx)
+
+ifdef(`PIC',`
+ LEA( G(calling_conventions_fenv), %ecx)
+ fstenv (%ecx)
+',`
+ fstenv G(calling_conventions_fenv)
+')
+ finit
+
+ ret
+
+EPILOGUE()
+ASM_END()
diff --git a/vendor/gmp-6.3.0/tests/x86check.c b/vendor/gmp-6.3.0/tests/x86check.c
new file mode 100644
index 0000000..12ea5b7
--- /dev/null
+++ b/vendor/gmp-6.3.0/tests/x86check.c
@@ -0,0 +1,117 @@
+/* x86 calling conventions checking. */
+
+/*
+Copyright 2000, 2001, 2010 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+
+#include <stdio.h>
+#include "gmp-impl.h"
+#include "tests.h"
+
+
+/* Vector if constants and register values. We use one vector to allow access
+ via a base pointer, very beneficial for the PIC-enabled amd64call.asm. */
+mp_limb_t calling_conventions_values[17] =
+{
+ CNST_LIMB(0x12345678), /* want_ebx */
+ CNST_LIMB(0x89ABCDEF), /* want_ebp */
+ CNST_LIMB(0xDEADBEEF), /* want_esi */
+ CNST_LIMB(0xFFEEDDCC), /* want_edi */
+
+ CNST_LIMB(0xFEEDABBA), /* JUNK_EAX */
+ CNST_LIMB(0xAB78DE89), /* JUNK_ECX */
+ CNST_LIMB(0x12389018) /* JUNK_EDX */
+
+ /* rest of array used for dynamic values. */
+};
+
+/* Index starts for various regions in above vector. */
+#define WANT 0
+#define JUNK 4
+#define SAVE 7
+#define RETADDR 11
+#define VAL 12
+#define EFLAGS 16
+
+
+/* values to check */
+#ifdef __cplusplus
+extern "C" {
+#endif
+struct {
+ unsigned control;
+ unsigned status;
+ unsigned tag;
+ unsigned other[4];
+} calling_conventions_fenv;
+#ifdef __cplusplus
+}
+#endif
+
+/* expected values, as per x86call.asm */
+#define VALUE_EBX 0x01234567
+#define VALUE_ESI 0x89ABCDEF
+#define VALUE_EDI 0xFEDCBA98
+#define VALUE_EBP 0x76543210
+
+
+const char *regname[] = {"ebx", "ebp", "esi", "edi"};
+
+#define DIR_BIT(eflags) (((eflags) & (1<<10)) != 0)
+
+
+/* Return 1 if ok, 0 if not */
+
+int
+calling_conventions_check (void)
+{
+ const char *header = "Violated calling conventions:\n";
+ int ret = 1;
+ int i;
+
+#define CHECK(callreg, regstr, value) \
+ if (callreg != value) \
+ { \
+ printf ("%s %s got 0x%08X want 0x%08X\n", \
+ header, regstr, callreg, value); \
+ header = ""; \
+ ret = 0; \
+ }
+
+ for (i = 0; i < 4; i++)
+ {
+ CHECK (calling_conventions_values[VAL+i], regname[i], calling_conventions_values[WANT+i]);
+ }
+
+ if (DIR_BIT (calling_conventions_values[EFLAGS]) != 0)
+ {
+ printf ("%s eflags dir bit got %d want 0\n",
+ header, DIR_BIT (calling_conventions_values[EFLAGS]));
+ header = "";
+ ret = 0;
+ }
+
+ if ((calling_conventions_fenv.tag & 0xFFFF) != 0xFFFF)
+ {
+ printf ("%s fpu tags got 0x%X want 0xFFFF\n",
+ header, calling_conventions_fenv.tag & 0xFFFF);
+ header = "";
+ ret = 0;
+ }
+
+ return ret;
+}