summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-22 19:59:12 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-22 21:12:25 +0100
commit9bf3b53533cdc9b95c921b71da755401f223f765 (patch)
tree812e99b25cc09f5d5d3b130d25a02754283ff7a7 /src/test
parent14f862a508ee64466fa8b3f036797d472f4d03ed (diff)
shared: switch our hash table implementation over to SipHash
SipHash appears to be the new gold standard for hashing smaller strings for hashtables these days, so let's make use of it.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-prioq.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/test/test-prioq.c b/src/test/test-prioq.c
index aeac73973b..cdb1e4ad52 100644
--- a/src/test/test-prioq.c
+++ b/src/test/test-prioq.c
@@ -24,6 +24,7 @@
#include "util.h"
#include "set.h"
#include "prioq.h"
+#include "siphash24.h"
#define SET_SIZE 1024*4
@@ -88,10 +89,13 @@ static int test_compare(const void *a, const void *b) {
return 0;
}
-static unsigned test_hash(const void *a) {
+static unsigned long test_hash(const void *a, const uint8_t hash_key[HASH_KEY_SIZE]) {
const struct test *x = a;
+ uint64_t u;
- return x->value;
+ siphash24((uint8_t*) &u, &x->value, sizeof(x->value), hash_key);
+
+ return (unsigned long) u;
}
static void test_struct(void) {