1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include "misc.hh" #include "glob.hh" #include <math.h> int intlog2(int d) { int i=0; while (!(d&1)) { d/= 2; i++; } assert(!(d/2)); return i; }