diff options
author | Jarno Rajahalme <jrajahalme@nicira.com> | 2014-07-04 07:57:18 -0700 |
---|---|---|
committer | Jarno Rajahalme <jrajahalme@nicira.com> | 2014-07-04 07:57:18 -0700 |
commit | 33c6a1b9d4584afc0ac89b25edf666000ad938a7 (patch) | |
tree | 557ed4144028f5f2fc34b05c3c8220855cd8c406 /lib/hash.c | |
parent | 9f361d6b29fb88080e203be3a41b6abbc4351612 (diff) | |
download | openvswitch-33c6a1b9d4584afc0ac89b25edf666000ad938a7.tar.gz |
lib/hash: Abstract hash interface.
Use generic names hash_add() and hash_finish() instead of mhash_*
equivalents. This makes future changes to hash implentations more
localized.
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/hash.c')
-rw-r--r-- | lib/hash.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/hash.c b/lib/hash.c index 8f34493b5..349f54a48 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -22,7 +22,7 @@ uint32_t hash_3words(uint32_t a, uint32_t b, uint32_t c) { - return mhash_finish(mhash_add(mhash_add(mhash_add(a, 0), b), c), 12); + return hash_finish(hash_add(hash_add(hash_add(a, 0), b), c), 12); } /* Returns the hash of the 'n' bytes at 'p', starting from 'basis'. */ @@ -35,7 +35,7 @@ hash_bytes(const void *p_, size_t n, uint32_t basis) hash = basis; while (n >= 4) { - hash = mhash_add(hash, get_unaligned_u32(p)); + hash = hash_add(hash, get_unaligned_u32(p)); n -= 4; p += 1; } @@ -44,10 +44,10 @@ hash_bytes(const void *p_, size_t n, uint32_t basis) uint32_t tmp = 0; memcpy(&tmp, p, n); - hash = mhash_add__(hash, tmp); + hash = hash_add(hash, tmp); } - return mhash_finish(hash, orig_n); + return hash_finish(hash, orig_n); } /* Returns the hash of the 'n' 32-bit words at 'p', starting from 'basis'. @@ -60,9 +60,9 @@ hash_words(const uint32_t p[], size_t n_words, uint32_t basis) hash = basis; for (i = 0; i < n_words; i++) { - hash = mhash_add(hash, p[i]); + hash = hash_add(hash, p[i]); } - return mhash_finish(hash, n_words * 4); + return hash_finish(hash, n_words * 4); } uint32_t |