Subject: Re: 1. uiopeek? 2. hashinit/hashdone?
To: None <tech-kern@netbsd.org>
From: Chapman Flack <nblists@anastigmatix.net>
List: tech-kern
Date: 06/04/2006 21:17:19
Thor Lancelot Simon wrote:
> You always get power-of-two buckets, unless the implementation has changed
> since I last looked at the guts.  You just typically don't _use_ them all,

oh good - that was the only possibility I could see. :)

> e.g. by using %prime instead of &mask as your hash function; &mask is a
> pretty crappy hash function for a lot of purposes anyway.

I guess I had been thinking of two distinct stages, where something
like a hash(9) routine generates your hash, and &mask is just your
way of reducing it to an index. In principle, if the first function
is good enough at giving you equiprobable bit patterns in its
natural width, you shouldn't lose too badly with the &mask reduction.
How good are the hash(9) functions?  (NB: I haven't read their code!
This is another example of what I ought to be able to know about them
from the contract; by seeing that they were intended for use with an
&mask reduction step, it would be natural to rely on them to do their
part making good hash.)

-Chap