diff options
author | Anders Björklund <anders@psqr.se> | 2016-11-13 16:51:46 +0100 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2017-02-12 14:57:13 +0100 |
commit | f1ac8e7dd2f818a6d29d5f38e944cac93288ee80 (patch) | |
tree | 2048613a4728f78d00bb2aaa828daa4fc3fb924c | |
parent | 03a296baf6834c8934addc92691cd86cf8655381 (diff) | |
download | ccache-f1ac8e7dd2f818a6d29d5f38e944cac93288ee80.tar.gz |
Undefined: avoid shift warning in murmurhash
murmurhashneutral2.c:18:16: runtime error: left shift of 169 by 24 places cannot be represented in type 'int'
-rw-r--r-- | murmurhashneutral2.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/murmurhashneutral2.c b/murmurhashneutral2.c index b568af65..53319dfb 100644 --- a/murmurhashneutral2.c +++ b/murmurhashneutral2.c @@ -13,9 +13,9 @@ murmurhashneutral2(const void *key, int len, unsigned int seed) while (len >= 4) { unsigned int k = data[0]; - k |= data[1] << 8; - k |= data[2] << 16; - k |= data[3] << 24; + k |= ((unsigned int) data[1]) << 8; + k |= ((unsigned int) data[2]) << 16; + k |= ((unsigned int) data[3]) << 24; k *= m; k ^= k >> r; @@ -30,9 +30,9 @@ murmurhashneutral2(const void *key, int len, unsigned int seed) switch (len) { - case 3: h ^= data[2] << 16; - case 2: h ^= data[1] << 8; - case 1: h ^= data[0]; + case 3: h ^= ((unsigned int) data[2]) << 16; + case 2: h ^= ((unsigned int) data[1]) << 8; + case 1: h ^= ((unsigned int) data[0]); h *= m; }; |