PageRenderTime 50ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/cln-1.3.2/tests/timegcd.cc

#
C++ | 30 lines | 28 code | 1 blank | 1 comment | 4 complexity | e29528e8dee467db7fdc6a0fd6e502ab 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>
  8. using namespace cln;
  9. int main (int argc, char * argv[])
  10. {
  11. int repetitions = 1;
  12. if ((argc >= 3) && !strcmp(argv[1],"-r")) {
  13. repetitions = atoi(argv[2]);
  14. argc -= 2; argv += 2;
  15. }
  16. if (argc < 2)
  17. exit(1);
  18. cl_I m1 = cl_I(argv[1]);
  19. cl_I M1 = (cl_I)1 << (intDsize*m1);
  20. cl_I m2 = (argc>2 ? cl_I(argv[2]) : m1);
  21. cl_I M2 = (cl_I)1 << (intDsize*m2);
  22. cl_I a = random_I(M1);
  23. cl_I b = random_I(M2);
  24. { CL_TIMING;
  25. for (int rep = repetitions; rep > 0; rep--)
  26. { cl_I g = gcd(a,b); }
  27. // { cl_I u; cl_I v; cl_I g = xgcd(a,b,&u,&v); }
  28. }
  29. }