Fix need for permissive.-------------- This line and the following will be ignored...
[m6w6/libmemcached] / libhashkit / hsieh.c
index c688add6c6d914bac9c0ca11a56fc1f5e194df61..ba46ed2cdf71c3b59e1f43691703885722c7c4f5 100644 (file)
@@ -43,16 +43,18 @@ uint32_t hashkit_hsieh(const char *key, size_t key_length, void *context __attri
   {
   case 3: hash += get16bits (key);
           hash ^= hash << 16;
-          hash ^= key[sizeof (uint16_t)] << 18;
+          hash ^= (uint32_t)key[sizeof (uint16_t)] << 18;
           hash += hash >> 11;
           break;
   case 2: hash += get16bits (key);
           hash ^= hash << 11;
           hash += hash >> 17;
           break;
-  case 1: hash += *key;
+  case 1: hash += (unsigned char)(*key);
           hash ^= hash << 10;
           hash += hash >> 1;
+  default:
+          break;
   }
 
   /* Force "avalanching" of final 127 bits */