Files
wizapp-stdlib/src/base/hash/hasher/murmur3.h
T
Abdelrahman Said f73a870a34
Release / release (push) Successful in 3s
Convert hasher to interface and remove spihash64
2026-09-16 01:11:24 +01:00

41 lines
1021 B
C

// 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 "hasher.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 wpU64Const(0x57504d4841534833)
typedef struct WpMur3HasherData {
u64 magic;
u32 seed;
} WpMur3HasherData;
#ifdef WP_PLATFORM_CPP
#define wpMur3HasherData(SEED) (WpMur3HasherData{WP_MUR3_HASHER_MAGIC, SEED})
#else
#define wpMur3HasherData(SEED) ((WpMur3HasherData){ .magic = WP_MUR3_HASHER_MAGIC, .seed = SEED })
#endif
WpHasher wpX64Mur3Hasher(WpMur3HasherData *data);
WpU128Hash wpX64Mur3Hasher128(WpU8Stream *bytes, void *hasher_io);
#ifdef WP_PLATFORM_CPP
END_C_LINKAGE
#endif // !WP_PLATFORM_CPP
#endif // !MURMUR3_H