diff options
Diffstat (limited to 'lib/misc.c')
-rw-r--r-- | lib/misc.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/misc.c b/lib/misc.c new file mode 100644 index 0000000..3ea41a5 --- /dev/null +++ b/lib/misc.c @@ -0,0 +1,24 @@ +/** + * \file lib/misc.c + */ + +#include "system.h" +#include "lib/misc.h" +#include "debug.h" + +unsigned int hashFunctionString(const char * string) +{ + /* Jenkins One-at-a-time hash */ + unsigned int hash = 0xe4721b68; + + while (*string != '\0') { + hash += *string; + hash += (hash << 10); + hash ^= (hash >> 6); + string++; + } + hash += (hash << 3); + hash ^= (hash >> 11); + hash += (hash << 15); + return hash; +} |