util: introduce two trivial hash_ops

Will be used in a later commit.
This commit is contained in:
Yu Watanabe
2020-10-13 22:40:22 +09:00
parent 11e9fec259
commit 5e71868ced
2 changed files with 15 additions and 0 deletions
+13
View File
@@ -71,6 +71,19 @@ const struct hash_ops trivial_hash_ops = {
.compare = trivial_compare_func,
};
const struct hash_ops trivial_hash_ops_free = {
.hash = trivial_hash_func,
.compare = trivial_compare_func,
.free_key = free,
};
const struct hash_ops trivial_hash_ops_free_free = {
.hash = trivial_hash_func,
.compare = trivial_compare_func,
.free_key = free,
.free_value = free,
};
void uint64_hash_func(const uint64_t *p, struct siphash *state) {
siphash24_compress(p, sizeof(uint64_t), state);
}