private static int ilog2(int v) { int ret=0; while(v>1) { ret++; v = (int)((uint)v >> 1); } return(ret); }