murmurhash includes an xor with the number of bytes hashed in its finishing
step. Until now, we've only had murmurhash for full words, but an upcoming
commit adds murmurhash for bytes, so the finishing function will need to
take a count of bytes instead.
Signed-off-by: Ben Pfaff <blp@nicira.com>
- return mhash_finish(hash, p - mask->masks.values);
+ return mhash_finish(hash, (p - mask->masks.values) * 4);
}
/* Returns a hash value for the bits of 'flow' where there are 1-bits in
}
/* Returns a hash value for the bits of 'flow' where there are 1-bits in
- return mhash_finish(hash, p - mask->masks.values);
+ return mhash_finish(hash, (p - mask->masks.values) * 4);
}
\f
/* Initializes 'dst' as a copy of 'src'. The caller must eventually free 'dst'
}
\f
/* Initializes 'dst' as a copy of 'src'. The caller must eventually free 'dst'
for (i = 0; i < n_words; i++) {
hash = mhash_add(hash, p[i]);
}
for (i = 0; i < n_words; i++) {
hash = mhash_add(hash, p[i]);
}
- return mhash_finish(hash, n_words);
+ return mhash_finish(hash, n_words * 4);
return hash * 5 + 0xe6546b64;
}
return hash * 5 + 0xe6546b64;
}
-static inline uint32_t mhash_finish(uint32_t hash, size_t n)
+static inline uint32_t mhash_finish(uint32_t hash, size_t n_bytes)
hash ^= hash >> 16;
hash *= 0x85ebca6b;
hash ^= hash >> 13;
hash ^= hash >> 16;
hash *= 0x85ebca6b;
hash ^= hash >> 13;