1 #include <cln/number.h>
3 #include <cln/integer.h>
4 #include <cln/random.h>
7 #include <cln/timing.h>
9 #include <cln/malloc.h>
10 #include <cln/abort.h>
12 int main (int argc, char * argv[])
15 if ((argc >= 3) && !strcmp(argv[1],"-r")) {
16 repetitions = atoi(argv[2]);
21 cl_I m = cl_I(argv[1]);
22 cl_I M = (cl_I)1 << (intDsize*m);
24 extern int cl_digits_algo;
25 // One run to fill the cache.
27 char* p = (cl_digits_algo = 0, cl_decimal_string(a));
28 char* q = (cl_digits_algo = 1, cl_decimal_string(a));
29 if (strcmp(p,q)) cl_abort();
33 // Now start the timing.
36 for (int rep = repetitions; rep > 0; rep--)
37 { char* p = cl_decimal_string(a); free_hook(p); }
41 for (int rep = repetitions; rep > 0; rep--)
42 { char* p = cl_decimal_string(a); free_hook(p); }