nctref/src/utils.h
2023-08-27 19:48:06 +03:00

18 lines
248 B
C

#ifndef NCTREF_UTILS_H
#define NCTREF_UTILS_H
#include<stddef.h>
inline static size_t djb2(const char *str) {
size_t hash = 5381;
int c;
while((c = *str++)) {
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
}
return hash;
}
#endif