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