]> www.ginac.de Git - cln.git/blob - tests/timerecip2adic.cc
00068593caea1430a1b8db64364b2929849196c1
[cln.git] / tests / timerecip2adic.cc
1 #include <cl_number.h>
2 #include <cl_io.h>
3 #include <cl_integer.h>
4 #include "cl_DS.h"
5 #include "cl_2DS.h"
6 #include <cl_random.h>
7 #include "cl_random_impl.h"
8 #include <stdlib.h>
9 #include <string.h>
10 #include <cl_timing.h>
11
12 int main (int argc, char * argv[])
13 {
14         int repetitions = 1;
15         if ((argc >= 3) && !strcmp(argv[1],"-r")) {
16                 repetitions = atoi(argv[2]);
17                 argc -= 2; argv += 2;
18         }
19         if (argc < 2)
20                 exit(1);
21         uintL len = atoi(argv[1]);
22         SAVE_NUM_STACK;
23         uintD* a_MSDptr;
24         uintD* a_LSDptr;
25         uintD* b_MSDptr;
26         uintD* b_LSDptr;
27         num_stack_alloc(len,a_MSDptr=,a_LSDptr=);
28         num_stack_alloc(len,b_MSDptr=,b_LSDptr=);
29         random_UDS(cl_default_random_state,a_MSDptr,len);
30         lspref(a_LSDptr,0) |= 1; // force a to be odd
31         { CL_TIMING;
32           for (int rep = repetitions; rep > 0; rep--)
33             { recip2adic(len,a_LSDptr,b_LSDptr); }
34         }
35 }