Remove the misguided extension here that reserved two special values in
the hash_code. I'm not sure what I was thinking here, the use cases for
special values are in the *keys*, not in the hashes of those keys.
We can always resurrect this if needed, or clients can accomplish the
same goal themselves. This makes the general case somewhat faster (~5
cycles faster on my machine) and smaller with less branching.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151865 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/ADT/HashingTest.cpp b/unittests/ADT/HashingTest.cpp
index 07c0f31..a6a0034 100644
--- a/unittests/ADT/HashingTest.cpp
+++ b/unittests/ADT/HashingTest.cpp
@@ -53,7 +53,6 @@
EXPECT_EQ(hash_value(42), hash_value(x));
EXPECT_NE(hash_value(42), hash_value(y));
EXPECT_NE(hash_value(42), hash_value(p));
- EXPECT_NE(hash_code::get_null_code(), hash_value(p));
EXPECT_EQ(hash_value(71), hash_value(i));
EXPECT_EQ(hash_value(71), hash_value(ci));
EXPECT_EQ(hash_value(71), hash_value(vi));
@@ -75,13 +74,10 @@
// Leave this uninitialized in the hope that valgrind will catch bad reads.
int dummy;
hash_code dummy_hash = hash_combine_range(&dummy, &dummy);
- EXPECT_NE(hash_code::get_null_code(), dummy_hash);
- EXPECT_NE(hash_code::get_invalid_code(), dummy_hash);
+ EXPECT_NE(hash_code(0), dummy_hash);
const int arr1[] = { 1, 2, 3 };
hash_code arr1_hash = hash_combine_range(begin(arr1), end(arr1));
- EXPECT_NE(hash_code::get_null_code(), arr1_hash);
- EXPECT_NE(hash_code::get_invalid_code(), arr1_hash);
EXPECT_NE(dummy_hash, arr1_hash);
EXPECT_EQ(arr1_hash, hash_combine_range(begin(arr1), end(arr1)));
@@ -96,22 +92,16 @@
const int arr2[] = { 3, 2, 1 };
hash_code arr2_hash = hash_combine_range(begin(arr2), end(arr2));
- EXPECT_NE(hash_code::get_null_code(), arr2_hash);
- EXPECT_NE(hash_code::get_invalid_code(), arr2_hash);
EXPECT_NE(dummy_hash, arr2_hash);
EXPECT_NE(arr1_hash, arr2_hash);
const int arr3[] = { 1, 1, 2, 3 };
hash_code arr3_hash = hash_combine_range(begin(arr3), end(arr3));
- EXPECT_NE(hash_code::get_null_code(), arr3_hash);
- EXPECT_NE(hash_code::get_invalid_code(), arr3_hash);
EXPECT_NE(dummy_hash, arr3_hash);
EXPECT_NE(arr1_hash, arr3_hash);
const int arr4[] = { 1, 2, 3, 3 };
hash_code arr4_hash = hash_combine_range(begin(arr4), end(arr4));
- EXPECT_NE(hash_code::get_null_code(), arr4_hash);
- EXPECT_NE(hash_code::get_invalid_code(), arr4_hash);
EXPECT_NE(dummy_hash, arr4_hash);
EXPECT_NE(arr1_hash, arr4_hash);