Skip to content

Commit

Permalink
Fix MurmurHash implementation to really be unaligned (#7482)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 authored and paramat committed Jun 25, 2018
1 parent d565783 commit b298b03
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/util/numeric.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit b298b03

Please sign in to comment.