Hello!
Please, can someone show me, if possible on example, how to we get that:
((hash << 5) + hash) + c = hash * 33 + c
Meaning:
((hash << 5) + hash) =hash * 33
Many thanks!!!
1 2 3 4 5 6 7 8 9 10 11
|
unsigned long
hash(unsigned char *str)
{
unsigned long hash = 5381;
int c;
while (c = *str++)
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
return hash;
}
|
Last edited on