This is most probably the best variabt so far, and not complicated, such aoptimizer can do "the right thing" easily. sorry for the many versions..
-gustaf
{ unsigned register int s = (size-1) >> 3; while (s>1) { s >>= 1; bucket++; } } if (bucket > NBUCKETS) { bucket = NBUCKETS; }