diff options
author | Vladimír Čunát <vladimir.cunat@nic.cz> | 2019-02-19 19:06:07 +0100 |
---|---|---|
committer | Vladimír Čunát <vladimir.cunat@nic.cz> | 2019-03-05 17:01:41 +0100 |
commit | cd571a9fa26391b9472c0643db7986b15d957f6d (patch) | |
tree | 3a9c59b7e5701e2abc7995a01e1b677ea510a475 /contrib | |
parent | Merge !781: fix flushing of messages to logs in some cases (diff) | |
download | knot-resolver-cd571a9fa26391b9472c0643db7986b15d957f6d.tar.xz knot-resolver-cd571a9fa26391b9472c0643db7986b15d957f6d.zip |
contrib/murmurhash3: fix bad type punning
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/murmurhash3/murmurhash3.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/murmurhash3/murmurhash3.c b/contrib/murmurhash3/murmurhash3.c index 06ed7d84..ac28f699 100644 --- a/contrib/murmurhash3/murmurhash3.c +++ b/contrib/murmurhash3/murmurhash3.c @@ -2,6 +2,7 @@ * by its author, Austin Appleby. */ #include "murmurhash3.h" +#include "string.h" static inline uint32_t fmix(uint32_t h) { @@ -32,12 +33,11 @@ uint32_t hash(const char* data, size_t len_) //---------- // body - const uint32_t * blocks = (const uint32_t*) (data + nblocks * 4); - int i; for(i = -nblocks; i; i++) { - uint32_t k1 = blocks[i]; + uint32_t k1; + memcpy(&k1, data + nblocks * 4 + i * sizeof(k1), sizeof(k1)); k1 *= c1; k1 = rotl32(k1, 15); |