> BTW it turns out this leads to a good demonstration of my point about > making the modulus relatively prime to the size of the data.
Missed that point on first reading. I totally agree with you on this point. We already pay for the modulus in the current code, so we may as well take advantage of it. In an unrelated piece of software (phone call correlation), I use a precomputed table of primes that are all just a bit smaller than a power of two, and for any bucket count desired by the user, I really use the next largest almost-power-of-two prime from that table. best regards Patrick static unsigned sizes[] = { 3, /* 2^2-1 */ 7, /* 2^3-1 */ 13, 31, /* 2^5-1 */ 61, 127, /* 2^7-1 */ 251, 509, 1021, 2039, 4093, 8191, /* 2^13-1 */ 16381, 32749, 65521, 131071, /* 2^17-1 */ 262139, 524287, /* 2^19-1 */ 1048571, 2097157, 4194301, 8388581, };