From: sfan5 Date: Mon, 25 Jun 2018 23:12:09 +0000 (+0200) Subject: Fix MurmurHash implementation to really be unaligned (#7482) X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=2e85254e91d623c68949205f681c11c88228824b;p=oweals%2Fminetest.git Fix MurmurHash implementation to really be unaligned (#7482) --- diff --git a/src/util/numeric.cpp b/src/util/numeric.cpp index e6a9cb75e..9127527de 100644 --- a/src/util/numeric.cpp +++ b/src/util/numeric.cpp @@ -60,13 +60,13 @@ u64 murmur_hash_64_ua(const void *key, int len, unsigned int seed) const int r = 47; u64 h = seed ^ (len * m); - const u64 *data = (const u64 *)key; - const u64 *end = data + (len / 8); + const u8 *data = (const u8 *)key; + const u8 *end = data + (len / 8) * 8; while (data != end) { u64 k; memcpy(&k, data, sizeof(u64)); - data++; + data += sizeof(u64); k *= m; k ^= k >> r;