]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/htable.c
kes Correctly detect Ubuntu systems, and add ubuntu platform directory.
[bacula/bacula] / bacula / src / lib / htable.c
index 280939dcf38ba39bc1ccb77bcd0b338c0cb4660d..25cafb9f547eef75722ec3aec6c3d5908b5e5055 100644 (file)
@@ -127,7 +127,8 @@ void htable::hash_index(char *key)
 {
    hash = 0;
    for (char *p=key; *p; p++) {
-      hash += (hash << 3) + (uint32_t)*p;
+//    hash += (hash << 3) + (uint32_t)*p;
+      hash +=  ((hash << 5) | (hash >> (sizeof(hash)*8-5))) + (uint32_t)*p;
    }
    /* Multiply by large prime number, take top bits, mask for remainder */
    index = ((hash * 1103515249) >> rshift) & mask;