1 #include <cln/number.h>
2 #include <cln/io.h>
3 #include <cln/integer.h>
4 #include "base/digitseq/cl_DS.h"
5 #include "base/digitseq/cl_2DS.h"
6 #include <cln/random.h>
7 #include "base/random/cl_random_impl.h"
8 #include <cstdlib>
9 #include <cstring>
10 #include <cln/timing.h>
11 using namespace cln;
12 
main(int argc,char * argv[])13 int main (int argc, char * argv[])
14 {
15 	int repetitions = 1;
16 	if ((argc >= 3) && !strcmp(argv[1],"-r")) {
17 		repetitions = atoi(argv[2]);
18 		argc -= 2; argv += 2;
19 	}
20 	if (argc < 2)
21 		exit(1);
22 	uintL len = atoi(argv[1]);
23 	CL_ALLOCA_STACK;
24 	uintD* a_MSDptr;
25 	uintD* a_LSDptr;
26 	uintD* b_MSDptr;
27 	uintD* b_LSDptr;
28 	num_stack_alloc(len,a_MSDptr=,a_LSDptr=);
29 	num_stack_alloc(len,b_MSDptr=,b_LSDptr=);
30 	random_UDS(default_random_state,a_MSDptr,len);
31 	lspref(a_LSDptr,0) |= 1; // force a to be odd
32 	{ CL_TIMING;
33 	  for (int rep = repetitions; rep > 0; rep--)
34 	    { recip2adic(len,a_LSDptr,b_LSDptr); }
35 	}
36 }
37