2004-12-23 15:16:30 +02:00
|
|
|
#ifndef __JEKINS_HASH_H__
|
|
|
|
#define __JEKINS_HASH_H__
|
|
|
|
|
|
|
|
#include "hash.h"
|
|
|
|
|
2005-01-21 22:42:33 +02:00
|
|
|
typedef struct __jenkins_state_t
|
2004-12-23 15:16:30 +02:00
|
|
|
{
|
|
|
|
CMPH_HASH hashfunc;
|
2005-01-18 23:06:08 +02:00
|
|
|
cmph_uint32 seed;
|
2005-01-21 22:42:33 +02:00
|
|
|
} jenkins_state_t;
|
2004-12-23 15:16:30 +02:00
|
|
|
|
2005-01-21 22:42:33 +02:00
|
|
|
jenkins_state_t *jenkins_state_new(cmph_uint32 size); //size of hash table
|
2008-03-23 02:46:34 +02:00
|
|
|
|
|
|
|
/** \fn cmph_uint32 jenkins_hash(jenkins_state_t *state, const char *k, cmph_uint32 keylen);
|
|
|
|
* \param state is a pointer to a jenkins_state_t structure
|
|
|
|
* \param key is a pointer to a key
|
|
|
|
* \param keylen is the key length
|
|
|
|
* \return an integer that represents a hash value of 32 bits.
|
|
|
|
*/
|
2005-01-21 22:42:33 +02:00
|
|
|
cmph_uint32 jenkins_hash(jenkins_state_t *state, const char *k, cmph_uint32 keylen);
|
2008-03-23 02:46:34 +02:00
|
|
|
|
|
|
|
/** \fn void jenkins_hash_vector(jenkins_state_t *state, const char *k, cmph_uint32 keylen, cmph_uint32 * hashes);
|
|
|
|
* \param state is a pointer to a jenkins_state_t structure
|
|
|
|
* \param key is a pointer to a key
|
|
|
|
* \param keylen is the key length
|
|
|
|
* \param hashes is a pointer to a memory large enough to fit three 32-bit integers.
|
|
|
|
*/
|
|
|
|
void jenkins_hash_vector(jenkins_state_t *state, const char *k, cmph_uint32 keylen, cmph_uint32 * hashes);
|
|
|
|
|
2005-01-21 22:42:33 +02:00
|
|
|
void jenkins_state_dump(jenkins_state_t *state, char **buf, cmph_uint32 *buflen);
|
2005-07-29 06:09:31 +03:00
|
|
|
jenkins_state_t *jenkins_state_copy(jenkins_state_t *src_state);
|
2005-01-21 22:42:33 +02:00
|
|
|
jenkins_state_t *jenkins_state_load(const char *buf, cmph_uint32 buflen);
|
|
|
|
void jenkins_state_destroy(jenkins_state_t *state);
|
2004-12-23 15:16:30 +02:00
|
|
|
|
|
|
|
#endif
|