diff options
author | sfan5 <sfan5@live.de> | 2018-06-26 01:12:09 +0200 |
---|---|---|
committer | Paramat <paramat@users.noreply.github.com> | 2018-06-26 00:12:09 +0100 |
commit | b298b0339c79db7f5b3873e73ff9ea0130f05a8a (patch) | |
tree | eda59bc00e083bbbe4ebed25f52f65823c12a9e8 /src/util/numeric.cpp | |
parent | d565783beca997d66f157158f45956e70c7cb59f (diff) | |
download | minetest-b298b0339c79db7f5b3873e73ff9ea0130f05a8a.tar.gz minetest-b298b0339c79db7f5b3873e73ff9ea0130f05a8a.tar.bz2 minetest-b298b0339c79db7f5b3873e73ff9ea0130f05a8a.zip |
Fix MurmurHash implementation to really be unaligned (#7482)
Diffstat (limited to 'src/util/numeric.cpp')
-rw-r--r-- | src/util/numeric.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util/numeric.cpp b/src/util/numeric.cpp index d878a3f60..a120e3207 100644 --- a/src/util/numeric.cpp +++ b/src/util/numeric.cpp @@ -61,13 +61,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; |