core: hash_cstring: Prepare for M2-Planet.

* src/hash.c (hash_cstring): Prepare for M2-Planet.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2019-10-24 21:19:06 +02:00
parent dd432acbab
commit e24f840106
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
1 changed files with 3 additions and 2 deletions

View File

@ -27,8 +27,9 @@ int
hash_cstring (char const *s, long size)
{
int hash = s[0] * 37;
if (s[0] != 0 && s[1] != 0)
hash = hash + s[1] * 43;
if (s[0] != 0)
if (s[1] != 0)
hash = hash + s[1] * 43;
assert_msg (size != 0, "size");
hash = hash % size;
return hash;