aboutsummaryrefslogtreecommitdiff
path: root/src/murmur3.c
diff options
context:
space:
mode:
authorMarvin Borner2023-05-06 20:19:23 +0200
committerMarvin Borner2023-05-06 20:19:23 +0200
commitb31220aadc24ff137a4fe4bc39780ae63c58e11b (patch)
tree89e431ad99e85f581dbea56d61abac6794386f2a /src/murmur3.c
parentd19f7f5bb99ca1073edb3ce1b13e782a3f598b4a (diff)
Start fresh
Diffstat (limited to 'src/murmur3.c')
-rw-r--r--src/murmur3.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/src/murmur3.c b/src/murmur3.c
deleted file mode 100644
index bb1f666..0000000
--- a/src/murmur3.c
+++ /dev/null
@@ -1,40 +0,0 @@
-#include "murmur3.h"
-
-#include <string.h>
-
-static inline uint32_t murmur_32_scramble(uint32_t k)
-{
- k *= 0xcc9e2d51;
- k = (k << 15) | (k >> 17);
- k *= 0x1b873593;
- return k;
-}
-
-uint32_t murmur3_32(const uint8_t *key, size_t len, uint32_t seed)
-{
- uint32_t h = seed;
- uint32_t k;
- /* Read in groups of 4. */
- for (size_t i = len >> 2; i; i--) {
- memcpy(&k, key, sizeof(uint32_t));
- key += sizeof(uint32_t);
- h ^= murmur_32_scramble(k);
- h = (h << 13) | (h >> 19);
- h = h * 5 + 0xe6546b64;
- }
- /* Read the rest. */
- k = 0;
- for (size_t i = len & 3; i; i--) {
- k <<= 8;
- k |= key[i - 1];
- }
- h ^= murmur_32_scramble(k);
- /* Finalize. */
- h ^= len;
- h ^= h >> 16;
- h *= 0x85ebca6b;
- h ^= h >> 13;
- h *= 0xc2b2ae35;
- h ^= h >> 16;
- return h;
-}