From 2a638b8d22be66bb631b2273a72cd4c8451de065 Mon Sep 17 00:00:00 2001 From: Alex Wang Date: Fri, 27 Feb 2015 09:07:18 -0800 Subject: [PATCH] test-hash: Remove the check_word_hash() for hash_bytes128_cb. The original test fails on big-endian system due to the hash function performing not as well when input is uint32_t. In reality, users should only use hash_bytes128() to hash words larger than 128 bits (e.g. struct flow). Besides, we do check the 1-bit set case for 16 128-bit words in following test case. Therefore, the cleanest way to fix the failure in big-endian system seems to be just removing the check_word_hash() test for hash_bytes128_cb. Signed-off-by: Alex Wang Acked-by: Ben Pfaff --- lib/hash.h | 1 + tests/test-hash.c | 10 ---------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/hash.h b/lib/hash.h index 9253760b546..65c52b986e3 100644 --- a/lib/hash.h +++ b/lib/hash.h @@ -33,6 +33,7 @@ hash_rot(uint32_t x, int k) } uint32_t hash_bytes(const void *, size_t n_bytes, uint32_t basis); +/* The hash input must be a word larger than 128 bits. */ void hash_bytes128(const void *_, size_t n_bytes, uint32_t basis, ovs_u128 *out); diff --git a/tests/test-hash.c b/tests/test-hash.c index fee6a5c3bc5..5032d323bb3 100644 --- a/tests/test-hash.c +++ b/tests/test-hash.c @@ -69,15 +69,6 @@ hash_int_cb(uint32_t input) return hash_int(input, 0); } -static uint32_t -hash_bytes128_cb(uint32_t input) -{ - ovs_u128 hash; - - hash_bytes128(&input, sizeof input, 0, &hash); - return hash.u64.lo; -} - static void check_word_hash(uint32_t (*hash)(uint32_t), const char *name, int min_unique) @@ -249,7 +240,6 @@ test_hash_main(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) * function. */ check_word_hash(hash_int_cb, "hash_int", 12); - check_word_hash(hash_bytes128_cb, "hash_bytes128", 12); /* Check that all hashes computed with hash_bytes128 with 1-bit (or no * 1-bits) set within 16 128-bit words have different values in their