Commit 7f6a85f9 authored by Geoff Simmons's avatar Geoff Simmons

Simplify expression of the PH hash function.

parent 4610ad8a
......@@ -104,12 +104,12 @@ hash(const struct hash * const restrict hash,
assert((len >> 2) <= hash->l);
for (e = s + l; s < e; k += 2, s += 2)
h += (*s + *k) * (*(s+1) + *(k+1));
h += (s[0] + k[0]) * (s[1] + k[1]);
/* When the subject length is not an exact multiple of 8. */
if ((len & 0x07) != 0) {
memcpy(tail, e, (void *)(subject + len) - (void *)e);
h += (*tail + *k) * (*(tail+1) + *(k+1));
h += (tail[0] + k[0]) * (tail[1] + k[1]);
}
return ((h >> 32) & hash->mask);
......
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