Collective Variables Module - Developer Documentation
Loading...
Searching...
No Matches
inthash.h
1#ifndef INTHASH_H
2#define INTHASH_H
3
4namespace IntHash_NS {
5
6 /* re-usable integer hash table code. */
7
10 int data; /* data in hash node */
11 int key; /* key for hash lookup */
12 inthash_node_t *next; /* next node in hash chain */
13 };
14
16 struct inthash_t {
17 inthash_node_t **bucket; /* array of hash nodes */
18 int size; /* size of the array */
19 int entries; /* number of entries in table */
20 int downshift; /* shift cound, used in hash function */
21 int mask; /* used to select bits for hashing */
22 };
23
24#define HASH_FAIL -1
25#define HASH_LIMIT 0.5
26
27 /* initialize new hash table */
28 void inthash_init(inthash_t *tptr, int buckets);
29 /* lookup entry in hash table */
30 int inthash_lookup(inthash_t *tptr, int key);
31 /* insert an entry into hash table. */
32 int inthash_insert(inthash_t *tptr, int key, int data);
33 /* delete the hash table */
34 void inthash_destroy(inthash_t *tptr);
35
36} // namespace IntHash_NS
37
38#endif
Definition: inthash.h:9
Definition: inthash.h:16