Fix MurmurHash implementation to really be unaligned (#7482)

This commit is contained in:
sfan5 2018-06-26 01:12:09 +02:00 committed by Paramat
parent d565783bec
commit b298b0339c

@ -61,13 +61,13 @@ u64 murmur_hash_64_ua(const void *key, int len, unsigned int seed)
const int r = 47; const int r = 47;
u64 h = seed ^ (len * m); u64 h = seed ^ (len * m);
const u64 *data = (const u64 *)key; const u8 *data = (const u8 *)key;
const u64 *end = data + (len / 8); const u8 *end = data + (len / 8) * 8;
while (data != end) { while (data != end) {
u64 k; u64 k;
memcpy(&k, data, sizeof(u64)); memcpy(&k, data, sizeof(u64));
data++; data += sizeof(u64);
k *= m; k *= m;
k ^= k >> r; k ^= k >> r;