diff options
author | 2016-05-22 15:24:21 -0700 | |
---|---|---|
committer | 2016-05-22 15:24:21 -0700 | |
commit | 22cfb658464526d15b6b2ae603b798adf1941895 (patch) | |
tree | 28142174a3d12b44075e0312ea641e2372864a59 /src/core/lib/support | |
parent | 62a0b5941b413a88e3589ec4b0191f6eb55e3b11 (diff) | |
parent | 336292d2f38b9883e2002f1f1c89704b971d62a6 (diff) |
Merge github.com:grpc/grpc into error
Diffstat (limited to 'src/core/lib/support')
-rw-r--r-- | src/core/lib/support/murmur_hash.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/core/lib/support/murmur_hash.c b/src/core/lib/support/murmur_hash.c index 5711fff0c0..7137c1f313 100644 --- a/src/core/lib/support/murmur_hash.c +++ b/src/core/lib/support/murmur_hash.c @@ -33,6 +33,8 @@ #include "src/core/lib/support/murmur_hash.h" +#include <string.h> + #define ROTL32(x, r) ((x) << (r)) | ((x) >> (32 - (r))) #define FMIX32(h) \ @@ -42,10 +44,6 @@ (h) *= 0xc2b2ae35; \ (h) ^= (h) >> 16; -/* Block read - if your platform needs to do endian-swapping or can only - handle aligned reads, do the conversion here */ -#define GETBLOCK32(p, i) (p)[(i)] - uint32_t gpr_murmur_hash3(const void *key, size_t len, uint32_t seed) { const uint8_t *data = (const uint8_t *)key; const size_t nblocks = len / 4; @@ -62,7 +60,7 @@ uint32_t gpr_murmur_hash3(const void *key, size_t len, uint32_t seed) { /* body */ for (i = -(int)nblocks; i; i++) { - k1 = GETBLOCK32(blocks, i); + memcpy(&k1, blocks + i, sizeof(uint32_t)); k1 *= c1; k1 = ROTL32(k1, 15); |