2004-10-18 18:24:54 +00:00
|
|
|
|
2007-06-11 21:36:57 +00:00
|
|
|
#include <stasis/crc32.h>
|
2008-10-03 02:42:25 +00:00
|
|
|
#include <stasis/common.h>
|
2004-10-12 02:44:47 +00:00
|
|
|
|
2004-10-18 18:24:54 +00:00
|
|
|
#ifndef __HASH_H
|
|
|
|
#define __HASH_H
|
2006-05-25 00:02:46 +00:00
|
|
|
/**
|
|
|
|
@todo write a test harness for this...
|
|
|
|
*/
|
|
|
|
|
2008-10-03 02:42:25 +00:00
|
|
|
uint64_t max_bucket(unsigned char tableBits, uint64_t nextExtension);
|
2006-05-24 02:19:04 +00:00
|
|
|
/**
|
|
|
|
This function maps from the length of the bucket list to a appropriate set
|
|
|
|
of linear hash parameters to fill that size.
|
|
|
|
*/
|
2008-10-03 02:42:25 +00:00
|
|
|
void hashGetParamsForSize(uint64_t desiredSize, unsigned char *tableBits,
|
|
|
|
uint64_t* nextExtension);
|
|
|
|
/**
|
|
|
|
XXX despite it's interface, hash can't return values > 2^32!
|
|
|
|
*/
|
|
|
|
uint64_t hash(const void * val, uint64_t val_length, unsigned char tableBits, uint64_t nextExtension);
|
2004-10-18 18:24:54 +00:00
|
|
|
#define twoToThe(x) (1 << (x))
|
2008-10-03 02:42:25 +00:00
|
|
|
uint32_t logBase2(uint64_t value);
|
2004-10-18 18:24:54 +00:00
|
|
|
#endif /*__HASH_H */
|