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.

27 lines
628 B

25 years ago
  1. #include <cl_number.h>
  2. #include <cl_io.h>
  3. #include <cl_integer.h>
  4. #include <cl_modinteger.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7. #include <cl_timing.h>
  8. int main (int argc, char * argv[])
  9. {
  10. int repetitions = 1;
  11. if ((argc >= 3) && !strcmp(argv[1],"-r")) {
  12. repetitions = atoi(argv[2]);
  13. argc -= 2; argv += 2;
  14. }
  15. if (argc < 2)
  16. exit(1);
  17. uintL len = atoi(argv[1]);
  18. cl_modint_ring R = cl_find_modint_ring((cl_I)1 << (intDsize*len));
  19. cl_MI a = R->random();
  20. cl_MI b;
  21. do { b = R->random(); } while (!oddp(R->retract(b)));
  22. { CL_TIMING;
  23. for (int rep = repetitions; rep > 0; rep--)
  24. { cl_MI c = R->div(a,b); }
  25. }
  26. }