Merge pull request #2657 from msurovcak/msurovcak-statistics-collon
[oweals/luci.git] / modules / luci-base / src / template_lmo.c
index cd4c609a743f36f42be8853cd0a43e42c61610bc..f7a118c9bbd41a4e8bde6b6dcca740a78787abc7 100644 (file)
@@ -46,14 +46,14 @@ uint32_t sfh_hash(const char *data, int len)
        switch (rem) {
                case 3: hash += sfh_get16(data);
                        hash ^= hash << 16;
-                       hash ^= data[sizeof(uint16_t)] << 18;
+                       hash ^= (signed char)data[sizeof(uint16_t)] << 18;
                        hash += hash >> 11;
                        break;
                case 2: hash += sfh_get16(data);
                        hash ^= hash << 11;
                        hash += hash >> 17;
                        break;
-               case 1: hash += *data;
+               case 1: hash += (signed char)*data;
                        hash ^= hash << 10;
                        hash += hash >> 1;
        }