A function to return ceiling of log x in base 2. For example , it returns 3 for 8 and 4 for 9.
int ceilLog2 ( int x ) { int count = 0 ; x -- ; while ( x > 0 ) { x = x >> 1 ; count ++ ; } return count ; }