diff options
Diffstat (limited to 'absl/numeric')
-rw-r--r-- | absl/numeric/BUILD.bazel | 1 | ||||
-rw-r--r-- | absl/numeric/int128.h | 6 | ||||
-rw-r--r-- | absl/numeric/int128_test.cc | 1 |
3 files changed, 8 insertions, 0 deletions
diff --git a/absl/numeric/BUILD.bazel b/absl/numeric/BUILD.bazel index f49571ebb3e1..324ce6695e40 100644 --- a/absl/numeric/BUILD.bazel +++ b/absl/numeric/BUILD.bazel @@ -49,6 +49,7 @@ cc_test( ":int128", "//absl/base", "//absl/base:core_headers", + "//absl/hash:hash_testing", "//absl/meta:type_traits", "@com_google_googletest//:gtest_main", ], diff --git a/absl/numeric/int128.h b/absl/numeric/int128.h index 2d131b8bda1c..79b62a758669 100644 --- a/absl/numeric/int128.h +++ b/absl/numeric/int128.h @@ -192,6 +192,12 @@ class // Returns the highest value for a 128-bit unsigned integer. friend constexpr uint128 Uint128Max(); + // Support for absl::Hash. + template <typename H> + friend H AbslHashValue(H h, uint128 v) { + return H::combine(std::move(h), Uint128High64(v), Uint128Low64(v)); + } + private: constexpr uint128(uint64_t high, uint64_t low); diff --git a/absl/numeric/int128_test.cc b/absl/numeric/int128_test.cc index 1eb3e0ec8961..dfe3475aca06 100644 --- a/absl/numeric/int128_test.cc +++ b/absl/numeric/int128_test.cc @@ -23,6 +23,7 @@ #include "gtest/gtest.h" #include "absl/base/internal/cycleclock.h" +#include "absl/hash/hash_testing.h" #include "absl/meta/type_traits.h" #if defined(_MSC_VER) && _MSC_VER == 1900 |