commit - 1d19226a8a09c02a94d6ccee03f964fd413f2fe1
commit + 5df018ff07ef1aef0762d98cceb95fa04dbdb706
blob - ac869f866068f2b1050c52779f2539890a8c877f
blob + d3a67547fa3ddbd12660f688766bd387d6ed905b
--- lib/murmurhash2.c
+++ lib/murmurhash2.c
/* Obtained from https://github.com/aappleby/smhasher */
#include <stdint.h>
+#include <string.h>
#include "murmurhash2.h"
uint32_t
-murmurhash2(const void * key, int len, uint32_t seed)
+murmurhash2(const unsigned char * key, int len, uint32_t seed)
{
// 'm' and 'r' are mixing constants generated offline.
// They're not really 'magic', they just happen to work well.
// Mix 4 bytes at a time into the hash
- const unsigned char *data = (const unsigned char *)key;
+ const unsigned char *data = key;
while(len >= 4)
{
- uint32_t k = *(uint32_t*)data;
+ uint32_t k;
+ memcpy(&k, data, sizeof(k));
+
k *= m;
k ^= k >> r;
k *= m;
h ^= h >> 15;
return h;
-}
+}
blob - bbd2bf3ef0309efebdfbb79dd75aa100d4fb0b74
blob + 8fa42cdb7d310218bbaff43e40157c42561bdebd
--- lib/murmurhash2.h
+++ lib/murmurhash2.h
/* Obtained from https://github.com/aappleby/smhasher */
-uint32_t murmurhash2(const void *key, int len, uint32_t seed);
+uint32_t murmurhash2(const unsigned char *key, int len, uint32_t seed);