[haiku-development] Re: HASH table

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 22 Jan 2008 20:06:06 +0100 CET

"Salvatore Benedetto" <emitrax@xxxxxxxxx> wrote:
> I need to use a hash table in the ohci driver, along
> with basic functions (add, remove, find) of course.
> Is there anything (maybe templated) ready and easy-to-use
> in the Haiku kernel API?
> For now, I'm using *BSD solution which uses this hash function
> #define HASH(a) ((a) >> 4) % 128)
> where (a) is a physical address, and the result is used as index in 
> an
> 128 element array, where the virtual address is store (which is what 
> I need).

Have a look at headers/private/kernel/util/OpenHashTable.h.
For an example of code using it, see the TCP module.


Other related posts: