From 5b3c7d45bbaa4bb0fee61b89f4ecc5df4c4ffcd8 Mon Sep 17 00:00:00 2001 From: default Date: Mon, 3 Jul 2023 16:41:51 +0200 Subject: Backport from xs. --- xs_set.h | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'xs_set.h') 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 */ -- cgit