[ovs-dev] [hash.h cleanups 1/3] lib/hash.h: fix hash_2words

Andy Zhou azhou at nicira.com
Fri Mar 28 04:50:35 UTC 2014


From: Andy Zhou <andy at bubblewrapp.com>

Number of bytes in 2 words should be 8, instead of 4 bytes,
to better follow the mhash_finish() API. It is unlikely the fix
will improve the quality of hashing results.

Signed-off-by: Andy Zhou <azhou at nicira.com>
---
 lib/hash.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/hash.h b/lib/hash.h
index f8a72ed..0e8edf3 100644
--- a/lib/hash.h
+++ b/lib/hash.h
@@ -115,7 +115,7 @@ static inline uint32_t hash_pointer(const void *p, uint32_t basis)
 
 static inline uint32_t hash_2words(uint32_t x, uint32_t y)
 {
-    return mhash_finish(mhash_add(mhash_add(x, 0), y), 4);
+    return mhash_finish(mhash_add(mhash_add(x, 0), y), 8);
 }
 
 #ifdef __cplusplus
-- 
1.7.9.5




More information about the dev mailing list