How did you notice this problem? Did the hash unit tests catch it? If not, could we extend them in some way so that they would?
Acked-by: Ethan Jackson <et...@nicira.com> On Fri, Dec 14, 2012 at 4:33 PM, Ben Pfaff <b...@nicira.com> wrote: > With rotates instead of shifts, the upper and lower 16 bits of the returned > hash are always the same. > > Signed-off-by: Ben Pfaff <b...@nicira.com> > --- > lib/hash.h | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/lib/hash.h b/lib/hash.h > index 701e686..96866c4 100644 > --- a/lib/hash.h > +++ b/lib/hash.h > @@ -152,11 +152,11 @@ static inline uint32_t mhash_add(uint32_t hash, > uint32_t data) > static inline uint32_t mhash_finish(uint32_t hash, size_t n) > { > hash ^= n * 4; > - hash ^= hash_rot(hash, 16); > + hash ^= hash >> 16; > hash *= 0x85ebca6b; > - hash ^= hash_rot(hash, 13); > + hash ^= hash >> 13; > hash *= 0xc2b2ae35; > - hash ^= hash_rot(hash, 16); > + hash ^= hash >> 16; > return hash; > } > > -- > 1.7.2.5 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev