summaryrefslogtreecommitdiffstats
path: root/src/hash_map.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/hash_map.h')
-rw-r--r--src/hash_map.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/hash_map.h b/src/hash_map.h
index 076f6c0..919b6fc 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
@@ -26,7 +27,8 @@ unsigned int MurmurHash2(const void* key, size_t len) {
unsigned int h = seed ^ len;
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;