Pieter Claassen wrote:
>
> Is there any reasonable standard hash table storage in C on Linux?
>
> AFAICT the one in glibc has a data struct where the key and value
> pairs both have to be null terminated pointers. In my case, that
> is fine for the key, but I need to store a complex struct as the
> value and short of doing dangerous things like printing the memory
> location of the value struct and then recasting it when I want to
> get to the struct (which I think is dangerous), I don't want to
> use non-standard libraries.
>
> Also, what is a good way to generate a hash from a very large
> 96 bit identifier? the linux/hash.h only does longs which is a
> 32 bit number on my machine.
In reverse order, maybe treat it as a 12 char string? Look up the
hash references in the following.
hashlib is completely standard portable C. Available under GPL
at:
<http://cbfalconer.home.att.net/download/>
--
"I'm a war president. I make decisions here in the Oval Office
in foreign policy matters with war on my mind." - Bush.
"Churchill and Bush can both be considered wartime leaders, just
as Secretariat and Mr Ed were both horses." - James Rhodes.
|