1 #include <klibc/hash.h>
2 #include <lunaix/compiler.h>
5 * @brief Simple string hash function
7 * ref: https://stackoverflow.com/a/7666577
10 * @return unsigned int
13 strhash_32(const char* str, u32_t truncate_to)
22 hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
24 return hash >> (HASH_SIZE_BITS - truncate_to);