/* Returns the Jenkins hash of the 'n' bytes at 'p', starting from 'basis'.
*
- * Use jhash_bytes() instead, unless you're computing a hash function whose
+ * Use hash_bytes() instead, unless you're computing a hash function whose
* value is exposed "on the wire" so we don't want to change it. */
uint32_t
jhash_bytes(const void *p_, size_t n, uint32_t basis)
{
- const uint8_t *p = p_;
+ const uint32_t *p = p_;
uint32_t a, b, c;
a = b = c = 0xdeadbeef + n + basis;
while (n >= 12) {
- a += get_unaligned_u32((uint32_t *) p);
- b += get_unaligned_u32((uint32_t *) (p + 4));
- c += get_unaligned_u32((uint32_t *) (p + 8));
+ a += get_unaligned_u32(p);
+ b += get_unaligned_u32(p + 1);
+ c += get_unaligned_u32(p + 2);
jhash_mix(&a, &b, &c);
n -= 12;
- p += 12;
+ p += 3;
}
if (n) {