Created
August 29, 2011 03:12
-
-
Save Corgan/1177706 to your computer and use it in GitHub Desktop.
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
unsigned long HashString(const char *pName) | |
{ | |
const char* pStr = 0; | |
unsigned long hash = 0; | |
unsigned long temp = 0; | |
for(pStr = pName; *pStr; ++pStr) | |
{ | |
hash = (hash << 4) + tolower(*pStr); | |
if (0 != (temp = hash & 0xf0000000)) | |
{ | |
hash = hash ^ (temp >> 24); | |
hash = hash ^ temp; | |
} | |
} | |
return hash; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment