Commit 2de8f04c by Alan Mishchenko

Suggested bug fix in st__strhash().

parent 59f3389c
......@@ -448,14 +448,13 @@ int
int
st__strhash(const char *string, int modulus)
{
int val = 0;
int c;
while ((c = *string++) != '\0') {
unsigned char * ustring = (unsigned char *)string;
unsigned c, val = 0;
assert( modulus > 0 );
while ((c = *ustring++) != '\0') {
val = val*997 + c;
}
return ((val < 0) ? -val : val)%modulus;
return (int)(val%modulus);
}
int
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment