You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
722 B

25 years ago
25 years ago
  1. #include <cln/number.h>
  2. #include <cln/io.h>
  3. #include <cln/integer.h>
  4. #include <cln/random.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  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;
  19. cl_I m2;
  20. if (argc > 2) {
  21. m1 = cl_I(argv[1]);
  22. m2 = cl_I(argv[2]);
  23. } else {
  24. m2 = cl_I(argv[1]);
  25. m1 = 2*m2;
  26. }
  27. cl_I M1 = (cl_I)1 << (intDsize*m1);
  28. cl_I M2 = (cl_I)1 << (intDsize*m2);
  29. cl_I a = random_I(M1);
  30. cl_I b = random_I(M2);
  31. { CL_TIMING;
  32. for (int rep = repetitions; rep > 0; rep--)
  33. { cl_I_div_t qr = floor2(a,b); }
  34. }
  35. }