Computer Science Department
Features:
Object Oriented API for hashing on a range contiguous bits.
Head-Of-Line lookup optimization and 29 instruction inlined lookup function. (about 40 cycles on a Sparc IPX)
Optimized bucket browse function that shortcuts on return codes from a user handler.
Optimized bucket round robin browse function that shortcuts on return codes from a user handler.
Hash table header allocated adjacent to the table for locality and contains oft referenced information.
Self referential structures to detect table and bucket corruption.
Separate bucket allocation and insertion procedures allowing preallocation strategies.
Extremely small footprint.
Test program included as documentation.
Easily made MT safe.
Completely Purified!
The API
extern void *init_hash_table(unsigned int bitrange, unsigned int size);
extern void *allocate_hash_entry(void *table);
extern int insert_hash_entry(void *table, void *bucket, unsigned int key);
extern void *lookup_hash_entry(void *table, unsigned int key);
extern int remove_hash_entry(void *table, void *bucket);
extern int deallocate_hash_entry(void *table, void *bucket);
extern void *browse_hash_table(void *table, int (*to_do_fn)(void *, unsigned int, void *), void *scratch);
extern void *round_robin_browse_hash_table(void *table, int (*to_do_fn)(void *, unsigned int, void *), void *scratch, void *start);
extern void deinit_hash_table(void *table);
Back to me: Philip J. Mucci.