1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
int power_of_two(int test) { int limit = 8192; int compare = 1; // post("testing what we thing is an int:%d",test); do { if(test == compare){ // post("good power of 2 found!"); return 1; } compare *= 2; } while (compare <= limit); return 0; }