X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fjhash.c;h=c59b51b6113d7af780cd59a40311d03ee7654222;hb=28c5588e8e1a8d091c5d2275232c35f2968a97fa;hp=4ec2871d71b00ee14f65720edf131e1bb7061a75;hpb=c49d1dd1686277277cb742ec0fc93749214de391;p=sliver-openvswitch.git diff --git a/lib/jhash.c b/lib/jhash.c index 4ec2871d7..c59b51b61 100644 --- a/lib/jhash.c +++ b/lib/jhash.c @@ -91,23 +91,23 @@ jhash_words(const uint32_t *p, size_t n, uint32_t basis) /* 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) {