5 #include "llvm/Support/MathExtras.h"
8 testPow(int C, bool isPow)
11 bool testIsPow = IsPowerOf2(C, pow);
12 if (isPow != testIsPow)
13 printf("ERROR: IsPowerOf2() says \t%d %s a power of 2 = %d\n",
14 C, (isPow? "IS" : "IS NOT"), pow);
16 #undef PRINT_CORRECT_RESULTS
17 #ifdef PRINT_CORRECT_RESULTS
19 printf("CORRECT: IsPowerOf2() says \t%d %s a power of 2 = %d\n",
20 C, (isPow? "IS" : "IS NOT"), pow);
21 #endif PRINT_CORRECT_RESULTS
25 main(int argc, char** argv)
27 unsigned L = (argc > 1)? atoi(argv[1]) : 16;
32 for (unsigned i = 1; i < L; i++, C = C << 1)
36 for (unsigned j = C+1; j < (C << 1); j++)