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.

26 lines
662 B

25 years ago
  1. #include "test_I.h"
  2. int test_I_logbitp (int iterations)
  3. {
  4. int error = 0;
  5. int i;
  6. // Check against ash and oddp.
  7. for (i = iterations; i > 0; i--) {
  8. uintL a = random32() % 1024;
  9. cl_I b = testrandom_I();
  10. ASSERT2(logbitp(a,b) == oddp(ash(b,-(sintL)a)), a,b);
  11. }
  12. // Check against ash and logand.
  13. for (i = iterations; i > 0; i--) {
  14. uintL a = random32() % 1024;
  15. cl_I b = testrandom_I();
  16. ASSERT2(logbitp(a,b) == !zerop(logand(b,ash(1,(sintL)a))), a,b);
  17. }
  18. // Check against each other.
  19. for (i = iterations; i > 0; i--) {
  20. uintL a = random32() % 1024;
  21. cl_I b = testrandom_I();
  22. ASSERT2(logbitp((cl_I)a,b) == logbitp(a,b), a,b);
  23. }
  24. return error;
  25. }