1 int CheckPow2(int num) 2 { 3 if (num < 0) 4 return -1; 5 6 if (0 == (num & (num - 1))) 7 return 0; 8 else 9 return 1; 10 }