1 #include <klibc/hash.h>
2 #include <lunaix/compiler.h>
5 * @brief Simple string hash function (sdbm)
7 * ref: http://www.cse.yorku.ca/~oz/hash.html
9 * sdbm has lower standard deviation in bucket distribution
10 * than djb2 (previously used) for low bucket size (16, 32).
13 * @return unsigned int
16 strhash_32(const char* str, u32_t truncate_to)
25 hash = (hash << 6) + (hash << 16) + c - hash;
27 return hash >> (HASH_SIZE_BITS - truncate_to);