diff options
Diffstat (limited to 'src/hash_map.h')
-rw-r--r-- | src/hash_map.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/hash_map.h b/src/hash_map.h index 076f6c0..c63aa88 100644 --- a/src/hash_map.h +++ b/src/hash_map.h @@ -15,6 +15,7 @@ #ifndef NINJA_MAP_H_ #define NINJA_MAP_H_ +#include <string.h> #include "string_piece.h" // MurmurHash2, by Austin Appleby @@ -24,9 +25,10 @@ unsigned int MurmurHash2(const void* key, size_t len) { const unsigned int m = 0x5bd1e995; const int r = 24; unsigned int h = seed ^ len; - const unsigned char * data = (const unsigned char *)key; + const unsigned char* data = (const unsigned char*)key; while (len >= 4) { - unsigned int k = *(unsigned int *)data; + unsigned int k; + memcpy(&k, data, sizeof k); k *= m; k ^= k >> r; k *= m; |