diff --git a/public/crclib.c b/public/crclib.c index 95013b58..0312f820 100644 --- a/public/crclib.c +++ b/public/crclib.c @@ -457,10 +457,11 @@ returns hash key for string */ uint COM_HashKey( const char *string, uint hashSize ) { - uint i, hashKey = 0; + int hashKey = 5381; + unsigned char i; - for( i = 0; string[i]; i++ ) - hashKey = (hashKey + i) * 37 + Q_tolower( string[i] ); + while(( i = *string++ )) + hashKey = ( hashKey << 5 ) + hashKey + ( i & 0xDF ); - return (hashKey % hashSize); + return hashKey & ( hashSize - 1 ); }