-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhash.h
More file actions
70 lines (51 loc) · 1.88 KB
/
hash.h
File metadata and controls
70 lines (51 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef __BIGHASH_H__
#define __BIGHASH_H__
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
struct hash;
extern const size_t hash_size;
struct hash *hash_create( size_t memsize
, void *mem
, size_t keysize
, size_t valsize
, size_t nbuckets
, uint32_t (*hashfun)(void *)
, bool (*keycmp)(void *, void *)
, void (*keycopy)(void *, void *)
, void (*valcopy)(void *, void *)
, void *allocator
, void *(*alloc)(void*,size_t)
, void (dealloc)(void*,void*)
);
void hash_set_rehash_values(struct hash *c, uint8_t fill, size_t n);
void hash_rehash_end(struct hash *c);
void hash_destroy(struct hash*);
bool hash_shrink(struct hash *, bool);
bool hash_add(struct hash *c, void *k, void *v);
void *hash_get(struct hash *c, void *k);
void hash_find( struct hash *c
, void *k
, void *cc
, void (*cb) (void *cc, void *v));
void hash_del( struct hash *c, void *k);
bool hash_alter( struct hash* c
, bool add
, void *k
, void *ctx
, void (*) (void *, void *, void *, bool));
void hash_enum( struct hash *c
, void *cc
, void (*)(void *, void *, void *));
void hash_filter( struct hash *c
, void *cc
, bool (*cb)(void *, void *, void *));
void hash_stats( struct hash *c
, size_t *capacity
, size_t *used
, size_t *collisions
, size_t *maxbuck
);
size_t hash_chunk_size(size_t k, size_t v);
size_t hash_minimal_mem_size(size_t bkt, size_t n, size_t k, size_t v);
#endif