aboutsummaryrefslogtreecommitdiff
path: root/absl/container/internal/raw_hash_set.h
diff options
context:
space:
mode:
authorPaul Rigge <rigge@google.com>2024-02-28 11:38:24 -0800
committerCopybara-Service <copybara-worker@google.com>2024-02-28 11:39:10 -0800
commitb7372748dcdc35f40c12742cb57947a409e7f0b7 (patch)
treeef41be8ed2a3a83e5eed22c198b9564d34f46462 /absl/container/internal/raw_hash_set.h
parent953cec754aca513df7163abb8859c6b81dc9b202 (diff)
downloadabseil-b7372748dcdc35f40c12742cb57947a409e7f0b7.tar.gz
abseil-b7372748dcdc35f40c12742cb57947a409e7f0b7.tar.bz2
abseil-b7372748dcdc35f40c12742cb57947a409e7f0b7.zip
Rework casting in raw_hash_set's `IsFull()`.
Instead of casting an int to the enum type where the int does not have an associated enum value, cast the enum to its underlying type. This should be no functional change but make some linters happier. PiperOrigin-RevId: 611172311 Change-Id: I9ae10f8fa2029014236f60a90ee2ab2273c66fa5
Diffstat (limited to 'absl/container/internal/raw_hash_set.h')
-rw-r--r--absl/container/internal/raw_hash_set.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/absl/container/internal/raw_hash_set.h b/absl/container/internal/raw_hash_set.h
index 7b33de63..07ff79af 100644
--- a/absl/container/internal/raw_hash_set.h
+++ b/absl/container/internal/raw_hash_set.h
@@ -571,7 +571,9 @@ inline h2_t H2(size_t hash) { return hash & 0x7F; }
// 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) {
+ 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; }