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
9 typedef struct inthash_t {
10 struct inthash_node_t **bucket; /* array of hash nodes */
11 int size; /* size of the array */
12 int entries; /* number of entries in table */
13 int downshift; /* shift cound, used in hash function */
14 int mask; /* used to select bits for hashing */
15 } inthash_t;
16
18 typedef struct inthash_node_t {
19 int data; /* data in hash node */
20 int key; /* key for hash lookup */
21 struct inthash_node_t *next; /* next node in hash chain */
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:18
Definition: inthash.h:9