Go to the FreeLists Home Page Home Signup Help Login
 



[haiku-development] || [Date Prev] [01-2008 Date Index] [Date Next] || [Thread Prev] [01-2008 Thread Index] [Thread Next]

[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.

Bye,
   Axel.






[ Home | Signup | Help | Login | Archives | Lists ]

All trademarks and copyrights within the FreeLists archives are owned by their respective owners.
Everything else ©2007 Avenir Technologies, LLC.