Hashing strings for hash tables usually involves a prime number. It breaks down the raw hash into one bucket and therefore defines the size of the hash table. Chosing a prime number as hash table size will greatly reduce the number of collisions.
mdnsd uses two hash table sizes, defined by LPRIME and SPRIME. While LPRIME is defined to 1009, which is a prime number, SPRIME is defined to 108 - obviously not a prime number. Since I could not find any reason for this in code or history, this commit sets the value of SPRIME to 109 so that it actually is a prime number. Since using prime numbers just makes sense for hash table sizes.
Hashing strings for hash tables usually involves a prime number. It breaks down the raw hash into one bucket and therefore defines the size of the hash table. Chosing a prime number as hash table size will greatly reduce the number of collisions.
mdnsd uses two hash table sizes, defined by
LPRIME
andSPRIME
. WhileLPRIME
is defined to 1009, which is a prime number,SPRIME
is defined to 108 - obviously not a prime number. Since I could not find any reason for this in code or history, this commit sets the value ofSPRIME
to 109 so that it actually is a prime number. Since using prime numbers just makes sense for hash table sizes.