mirror of
https://github.com/minetest/minetest.git
synced 2024-12-01 20:13:48 +01:00
Fix MurmurHash implementation to really be unaligned (#7482)
This commit is contained in:
parent
971dea7efd
commit
2e85254e91
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user