summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Björklund <anders@psqr.se>2016-11-13 16:51:46 +0100
committerJoel Rosdahl <joel@rosdahl.net>2017-02-12 14:57:13 +0100
commitf1ac8e7dd2f818a6d29d5f38e944cac93288ee80 (patch)
tree2048613a4728f78d00bb2aaa828daa4fc3fb924c
parent03a296baf6834c8934addc92691cd86cf8655381 (diff)
downloadccache-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.c12
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;
};