projects
/
oweals
/
minetest.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
971dea7
)
Fix MurmurHash implementation to really be unaligned (#7482)
author
sfan5
<sfan5@live.de>
Mon, 25 Jun 2018 23:12:09 +0000
(
01:12
+0200)
committer
Loïc Blot
<nerzhul@users.noreply.github.com>
Thu, 28 Jun 2018 17:11:01 +0000
(19:11 +0200)
src/util/numeric.cpp
patch
|
blob
|
history
diff --git
a/src/util/numeric.cpp
b/src/util/numeric.cpp
index e6a9cb75ebddc549631867c17a0b8c2bd5c65e09..9127527de16eacde606a378f7de25f2d5e724a97 100644
(file)
--- 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 u
64 *data = (const u64
*)key;
- const u
64 *end = data + (len / 8)
;
+ const u
8 *data = (const u8
*)key;
+ const u
8 *end = data + (len / 8) * 8
;
while (data != end) {
u64 k;
memcpy(&k, data, sizeof(u64));
- data
++
;
+ data
+= sizeof(u64)
;
k *= m;
k ^= k >> r;