commit | 3ff870f957d511627690f4d3601987ce40d0d97c | [log] [tgz] |
---|---|---|
author | Jason Simmons <jsimmons@google.com> | Thu Jul 24 12:47:42 2025 -0700 |
committer | Jason Simmons <jsimmons@google.com> | Thu Jul 24 12:47:42 2025 -0700 |
tree | d1533e523d9b454c2c887a81ab9c23789337eacb | |
parent | 182d30b2816f3fada3b7707cf9b0eb7d2e71a111 [diff] |
Cherry pick of "Rework casting in raw_hash_set's IsFull()." This is required by current versions of Clang. See https://github.com/abseil/abseil-cpp/commit/1a31b81c0a467c1c8e229b9fc172a4eb0db5bd85 Change-Id: I0b94e9495e3a0c2cef13b0fb8689f359715acd94 Reviewed-on: https://flutter-review.googlesource.com/c/third_party/abseil-cpp/+/68160 Reviewed-by: John McDole <codefu@google.com>
diff --git a/absl/container/internal/raw_hash_set.h b/absl/container/internal/raw_hash_set.h index 7b33de6..47b5118 100644 --- a/absl/container/internal/raw_hash_set.h +++ b/absl/container/internal/raw_hash_set.h
@@ -571,7 +571,12 @@ // Helpers for checking the state of a control byte. inline bool IsEmpty(ctrl_t c) { return c == ctrl_t::kEmpty; } -inline bool IsFull(ctrl_t c) { return c >= static_cast<ctrl_t>(0); } +inline bool IsFull(ctrl_t c) { + // Cast `c` to the underlying type instead of casting `0` to `ctrl_t` as `0` + // is not a value in the enum. Both ways are equivalent, but this way makes + // linters happier. + return static_cast<std::underlying_type_t<ctrl_t>>(c) >= 0; +} inline bool IsDeleted(ctrl_t c) { return c == ctrl_t::kDeleted; } inline bool IsEmptyOrDeleted(ctrl_t c) { return c < ctrl_t::kSentinel; }