Add implementation for the murmur3 x64_128 hash
Release / release (push) Successful in 3s

This commit is contained in:
2026-08-30 22:03:28 +01:00
parent d5578f009a
commit 55ff77c4ea
15 changed files with 980 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
// vim:fileencoding=utf-8:foldmethod=marker
/**
* An implementation of the x64 128-bit variant of the MurmurHash3 algorithm
* based on https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp
*/
#ifndef MURMUR3_H
#define MURMUR3_H
#include "../../stream/stream.h"
#include "../../../common/aliases/aliases.h"
#include "../../../common/platform/platform.h"
#ifdef WP_PLATFORM_CPP
BEGIN_C_LINKAGE
#endif // !WP_PLATFORM_CPP
#define WP_MUR3_HASHER_MAGIC ((u64)0x57504d4841534833)
typedef struct {
u64 magic;
u64 out_hash1;
u64 out_hash2;
u32 seed;
} WpMur3HasherIO;
#ifdef WP_PLATFORM_CPP
#define wpMur3HasherIO(SEED) (WpMur3HasherIO{WP_MUR3_HASHER_MAGIC, 0, 0, SEED})
#else
#define wpMur3HasherIO(SEED) ((WpMur3HasherIO){ .magic = WP_MUR3_HASHER_MAGIC, .seed = SEED })
#endif
void wpX64Mur3Hasher128(WpU8Stream *bytes, void *hasher_io);
#ifdef WP_PLATFORM_CPP
END_C_LINKAGE
#endif // !WP_PLATFORM_CPP
#endif // !MURMUR3_H