~ubuntu-branches/ubuntu/trusty/gobject-introspection/trusty

« back to all changes in this revision

Viewing changes to girepository/cmph/jenkins_hash.h

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort
  • Date: 2011-03-22 00:32:36 UTC
  • mfrom: (1.4.1 upstream) (3.3.33 multiarch)
  • Revision ID: james.westby@ubuntu.com-20110322003236-4spdgfk1vai6xay1
Tags: 0.10.4-2
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __JEKINS_HASH_H__
 
2
#define __JEKINS_HASH_H__
 
3
 
 
4
#include "hash.h"
 
5
 
 
6
typedef struct __jenkins_state_t
 
7
{
 
8
        CMPH_HASH hashfunc;
 
9
        cmph_uint32 seed;
 
10
} jenkins_state_t;
 
11
        
 
12
jenkins_state_t *jenkins_state_new(cmph_uint32 size); //size of hash table
 
13
 
 
14
/** \fn cmph_uint32 jenkins_hash(jenkins_state_t *state, const char *k, cmph_uint32 keylen);
 
15
 *  \param state is a pointer to a jenkins_state_t structure
 
16
 *  \param key is a pointer to a key
 
17
 *  \param keylen is the key length
 
18
 *  \return an integer that represents a hash value of 32 bits.
 
19
 */
 
20
cmph_uint32 jenkins_hash(jenkins_state_t *state, const char *k, cmph_uint32 keylen);
 
21
 
 
22
/** \fn void jenkins_hash_vector_(jenkins_state_t *state, const char *k, cmph_uint32 keylen, cmph_uint32 * hashes);
 
23
 *  \param state is a pointer to a jenkins_state_t structure
 
24
 *  \param key is a pointer to a key
 
25
 *  \param keylen is the key length
 
26
 *  \param hashes is a pointer to a memory large enough to fit three 32-bit integers.
 
27
 */
 
28
void jenkins_hash_vector_(jenkins_state_t *state, const char *k, cmph_uint32 keylen, cmph_uint32 * hashes);
 
29
 
 
30
void jenkins_state_dump(jenkins_state_t *state, char **buf, cmph_uint32 *buflen);
 
31
jenkins_state_t *jenkins_state_copy(jenkins_state_t *src_state);
 
32
jenkins_state_t *jenkins_state_load(const char *buf, cmph_uint32 buflen);
 
33
void jenkins_state_destroy(jenkins_state_t *state);
 
34
 
 
35
/** \fn void jenkins_state_pack(jenkins_state_t *state, void *jenkins_packed);
 
36
 *  \brief Support the ability to pack a jenkins function into a preallocated contiguous memory space pointed by jenkins_packed.
 
37
 *  \param state points to the jenkins function
 
38
 *  \param jenkins_packed pointer to the contiguous memory area used to store the jenkins function. The size of jenkins_packed must be at least jenkins_state_packed_size() 
 
39
 */
 
40
void jenkins_state_pack(jenkins_state_t *state, void *jenkins_packed);
 
41
 
 
42
/** \fn cmph_uint32 jenkins_state_packed_size();
 
43
 *  \brief Return the amount of space needed to pack a jenkins function.
 
44
 *  \return the size of the packed function or zero for failures
 
45
 */ 
 
46
cmph_uint32 jenkins_state_packed_size(void);
 
47
 
 
48
 
 
49
/** \fn cmph_uint32 jenkins_hash_packed(void *jenkins_packed, const char *k, cmph_uint32 keylen);
 
50
 *  \param jenkins_packed is a pointer to a contiguous memory area
 
51
 *  \param key is a pointer to a key
 
52
 *  \param keylen is the key length
 
53
 *  \return an integer that represents a hash value of 32 bits.
 
54
 */
 
55
cmph_uint32 jenkins_hash_packed(void *jenkins_packed, const char *k, cmph_uint32 keylen);
 
56
 
 
57
/** \fn jenkins_hash_vector_packed(void *jenkins_packed, const char *k, cmph_uint32 keylen, cmph_uint32 * hashes);
 
58
 *  \param jenkins_packed is a pointer to a contiguous memory area
 
59
 *  \param key is a pointer to a key
 
60
 *  \param keylen is the key length
 
61
 *  \param hashes is a pointer to a memory large enough to fit three 32-bit integers.
 
62
 */
 
63
void jenkins_hash_vector_packed(void *jenkins_packed, const char *k, cmph_uint32 keylen, cmph_uint32 * hashes);
 
64
 
 
65
#endif