1 parent
188cfae0d7
commit
5687cb512c
21 files changed
+108
-27
No files matched your search
@@ -7,8 +7,13 @@
|
||||
// compile and run any of them on any platform, but your performance with the
|
||||
// non-native version will be less than optimal.
|
||||
|
||||
#include "wapp.h"
|
||||
#include "MurmurHash3.h"
|
||||
|
||||
#ifdef WP_PLATFORM_WINDOWS
|
||||
#pragma warning(disable:5045)
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Platform-specific functions and macros
|
||||
|
||||
|
||||
@@ -7,8 +7,13 @@
|
||||
// compile and run any of them on any platform, but your performance with the
|
||||
// non-native version will be less than optimal.
|
||||
|
||||
#include "wapp.h"
|
||||
#include "MurmurHash3.h"
|
||||
|
||||
#ifdef WP_PLATFORM_WINDOWS
|
||||
#pragma warning(disable:5045)
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Platform-specific functions and macros
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ int siphash(const void *in, const size_t inlen, const void *k, uint8_t *out,
|
||||
uint64_t m;
|
||||
int i;
|
||||
const unsigned char *end = ni + inlen - (inlen % sizeof(uint64_t));
|
||||
const int left = inlen & 7;
|
||||
const int left = (const int)(inlen & 7);
|
||||
uint64_t b = ((uint64_t)inlen) << 56;
|
||||
v3 ^= k1;
|
||||
v2 ^= k0;
|
||||
|
||||
@@ -22,19 +22,19 @@ WpTestFuncResult test_murmur3(void) {
|
||||
|
||||
// Sring hash
|
||||
WpU128 mur_hash = hasher.func(&str_bytes, hasher.ctx);
|
||||
MurmurHash3_x64_128(str_bytes.data, str_bytes.count * str_bytes.item_size, hasher.ctx.murmur3, (void *)hash);
|
||||
MurmurHash3_x64_128(str_bytes.data, (i32)(str_bytes.count * str_bytes.item_size), hasher.ctx.murmur3, (void *)hash);
|
||||
|
||||
result = result && mur_hash.value[0] == hash[0] && mur_hash.value[1] == hash[1];
|
||||
|
||||
// Array hash
|
||||
mur_hash = hasher.func(&arr_bytes, hasher.ctx);
|
||||
MurmurHash3_x64_128(arr_bytes.data, arr_bytes.count * arr_bytes.item_size, hasher.ctx.murmur3, (void *)hash);
|
||||
MurmurHash3_x64_128(arr_bytes.data, (i32)(arr_bytes.count * arr_bytes.item_size), hasher.ctx.murmur3, (void *)hash);
|
||||
|
||||
result = result && mur_hash.value[0] == hash[0] && mur_hash.value[1] == hash[1];
|
||||
|
||||
// Number hash
|
||||
mur_hash = hasher.func(&num_bytes, hasher.ctx);
|
||||
MurmurHash3_x64_128(num_bytes.data, num_bytes.count * num_bytes.item_size, hasher.ctx.murmur3, (void *)hash);
|
||||
MurmurHash3_x64_128(num_bytes.data, (i32)(num_bytes.count * num_bytes.item_size), hasher.ctx.murmur3, (void *)hash);
|
||||
|
||||
result = result && mur_hash.value[0] == hash[0] && mur_hash.value[1] == hash[1];
|
||||
|
||||
|
||||
@@ -22,19 +22,19 @@ WpTestFuncResult test_murmur3(void) {
|
||||
|
||||
// Sring hash
|
||||
WpU128 mur_hash = hasher.func(&str_bytes, hasher.ctx);
|
||||
MurmurHash3_x64_128(str_bytes.data, str_bytes.count * str_bytes.item_size, hasher.ctx.murmur3, (void *)hash);
|
||||
MurmurHash3_x64_128(str_bytes.data, (i32)(str_bytes.count * str_bytes.item_size), hasher.ctx.murmur3, (void *)hash);
|
||||
|
||||
result = result && mur_hash.value[0] == hash[0] && mur_hash.value[1] == hash[1];
|
||||
|
||||
// Array hash
|
||||
mur_hash = hasher.func(&arr_bytes, hasher.ctx);
|
||||
MurmurHash3_x64_128(arr_bytes.data, arr_bytes.count * arr_bytes.item_size, hasher.ctx.murmur3, (void *)hash);
|
||||
MurmurHash3_x64_128(arr_bytes.data, (i32)(arr_bytes.count * arr_bytes.item_size), hasher.ctx.murmur3, (void *)hash);
|
||||
|
||||
result = result && mur_hash.value[0] == hash[0] && mur_hash.value[1] == hash[1];
|
||||
|
||||
// Number hash
|
||||
mur_hash = hasher.func(&num_bytes, hasher.ctx);
|
||||
MurmurHash3_x64_128(num_bytes.data, num_bytes.count * num_bytes.item_size, hasher.ctx.murmur3, (void *)hash);
|
||||
MurmurHash3_x64_128(num_bytes.data, (i32)(num_bytes.count * num_bytes.item_size), hasher.ctx.murmur3, (void *)hash);
|
||||
|
||||
result = result && mur_hash.value[0] == hash[0] && mur_hash.value[1] == hash[1];
|
||||
|
||||
|
||||
Reference in new issue
Block a user