summaryrefslogtreecommitdiff
path: root/xs_set.h
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-07-03 16:41:51 +0200
committerdefault <nobody@localhost>2023-07-03 16:41:51 +0200
commit5b3c7d45bbaa4bb0fee61b89f4ecc5df4c4ffcd8 (patch)
tree436cecffbe17a2edaaa66ba83850658e92291217 /xs_set.h
parent7eeeeb3022b66a70f0bf9148348ef72206a13da4 (diff)
Backport from xs.
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)
}
-static unsigned int _calc_hash(const char *data, int size)
-{
- unsigned int hash = 0x666;
- int n;
-
- for (n = 0; n < size; n++) {
- hash ^= data[n];
- hash *= 111111111;
- }
-
- return hash ^ hash >> 16;
-}
-
-
static int _store_hash(xs_set *s, const char *data, int value)
{
unsigned int hash, i;
int sz = xs_size(data);
- hash = _calc_hash(data, sz);
+ hash = xs_hash_func(data, sz);
while (s->hash[(i = hash % s->elems)]) {
/* get the pointer to the stored data */