1 #include <cln/number.h>
3 #include <cln/integer.h>
6 #include <cln/random.h>
7 #include "cl_random_impl.h"
11 #include <cln/timing.h>
14 int main (int argc, char * argv[])
17 if ((argc >= 3) && !strcmp(argv[1],"-r")) {
18 repetitions = atoi(argv[2]);
23 uintL len = atoi(argv[1]);
24 int threshold = atoi(argv[2]);
32 num_stack_alloc(len,a_MSDptr=,a_LSDptr=);
33 num_stack_alloc(len,b_MSDptr=,b_LSDptr=);
34 num_stack_alloc(len,bn_MSDptr=,bn_LSDptr=);
35 random_UDS(default_random_state,a_MSDptr,len);
36 lspref(a_LSDptr,0) |= 1; // force a to be odd
37 extern int recip2adic_threshold;
39 recip2adic_threshold = 1000000;
40 recip2adic(len,a_LSDptr,b_LSDptr);
41 recip2adic_threshold = threshold;
42 recip2adic(len,a_LSDptr,bn_LSDptr);
43 if (compare_loop_msp(b_MSDptr,bn_MSDptr,len)) cl_abort();
45 recip2adic_threshold = 1000000;
47 for (int rep = repetitions; rep > 0; rep--)
48 { recip2adic(len,a_LSDptr,b_LSDptr); }
50 recip2adic_threshold = threshold;
52 for (int rep = repetitions; rep > 0; rep--)
53 { recip2adic(len,a_LSDptr,b_LSDptr); }