/cln-1.3.2/tests/timediv.cc
C++ | 36 lines | 35 code | 1 blank | 0 comment | 6 complexity | d8b82c9c6bb4783b94082ef6b6beaabb MD5 | raw file
Possible License(s): GPL-2.0
1#include <cln/number.h>
2#include <cln/io.h>
3#include <cln/integer.h>
4#include <cln/random.h>
5#include <cstdlib>
6#include <cstring>
7#include <cln/timing.h>
8using namespace cln;
9
10int main (int argc, char * argv[])
11{
12 int repetitions = 1;
13 if ((argc >= 3) && !strcmp(argv[1],"-r")) {
14 repetitions = atoi(argv[2]);
15 argc -= 2; argv += 2;
16 }
17 if (argc < 2)
18 exit(1);
19 cl_I m1;
20 cl_I m2;
21 if (argc > 2) {
22 m1 = cl_I(argv[1]);
23 m2 = cl_I(argv[2]);
24 } else {
25 m2 = cl_I(argv[1]);
26 m1 = 2*m2;
27 }
28 cl_I M1 = (cl_I)1 << (intDsize*m1);
29 cl_I M2 = (cl_I)1 << (intDsize*m2);
30 cl_I a = random_I(M1);
31 cl_I b = random_I(M2);
32 { CL_TIMING;
33 for (int rep = repetitions; rep > 0; rep--)
34 { cl_I_div_t qr = floor2(a,b); }
35 }
36}