summaryrefslogtreecommitdiff
path: root/xs_set.h
diff options
context:
space:
mode:
Diffstat (limited to 'xs_set.h')
-rw-r--r--xs_set.h16
1 files changed, 1 insertions, 15 deletions
diff --git a/xs_set.h b/xs_set.h
index 8829f14..1857ae7 100644
--- a/xs_set.h
+++ b/xs_set.h
@@ -51,26 +51,12 @@ void xs_set_free(xs_set *s)
51} 51}
52 52
53 53
54static unsigned int _calc_hash(const char *data, int size)
55{
56 unsigned int hash = 0x666;
57 int n;
58
59 for (n = 0; n < size; n++) {
60 hash ^= data[n];
61 hash *= 111111111;
62 }
63
64 return hash ^ hash >> 16;
65}
66
67
68static int _store_hash(xs_set *s, const char *data, int value) 54static int _store_hash(xs_set *s, const char *data, int value)
69{ 55{
70 unsigned int hash, i; 56 unsigned int hash, i;
71 int sz = xs_size(data); 57 int sz = xs_size(data);
72 58
73 hash = _calc_hash(data, sz); 59 hash = xs_hash_func(data, sz);
74 60
75 while (s->hash[(i = hash % s->elems)]) { 61 while (s->hash[(i = hash % s->elems)]) {
76 /* get the pointer to the stored data */ 62 /* get the pointer to the stored data */