3 int test_I_logcount (int iterations)
8 for (i = iterations; i > 0; i--) {
9 cl_I a = testrandom_I();
10 cl_I b = testrandom_I();
12 ASSERT2(logcount(a) == logcount(logand(a,b)) + logcount(logandc2(a,b)), a,b);
14 // Check behaviour on sign change.
15 for (i = iterations; i > 0; i--) {
16 cl_I a = testrandom_I();
17 ASSERT1(logcount(lognot(a)) == logcount(a), a);
19 // Check shift invariance.
20 for (i = iterations; i > 0; i--) {
21 cl_I a = testrandom_I();
22 sintL b = random32() % 1024;
23 ASSERT2(logcount(ash(a,b)) == logcount(a) + (minusp(a) ? b : 0), a,b);