|
|
|
@ -457,10 +457,11 @@ returns hash key for string
@@ -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 ); |
|
|
|
|
} |
|
|
|
|