diff options
Diffstat (limited to 'qstd/str.c')
-rw-r--r-- | qstd/str.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -9,3 +9,12 @@ uint64_t fnv1a64(uint8_t* buf, size_t size) { } return hash; } + +uint32_t hash_string(const char* s) { + uint32_t h = 2166136261u; + for (; *s; s++) { + h ^= *(uint8_t*)s; + h *= 16777619; + } + return h; +} |