Last active
December 22, 2015 21:29
-
-
Save scriptum/6534072 to your computer and use it in GitHub Desktop.
string hash from cairo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _CAIRO_HASH_INIT_VALUE 5381 | |
unsigned long _cairo_hash_string (const char *c) | |
{ | |
/* This is the djb2 hash. */ | |
unsigned long hash = _CAIRO_HASH_INIT_VALUE; | |
while (c && *c) | |
hash = ((hash << 5) + hash) + *c++; | |
return hash; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment