This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user