internal static int ilog(int v) { int ret=0; while(v!=0) { ret++; v = (int)((uint)v >> 1); } return(ret); }