Commit b7372748 by Paul Rigge Committed by Copybara-Service

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
parent 953cec75
...@@ -571,7 +571,9 @@ inline h2_t H2(size_t hash) { return hash & 0x7F; } ...@@ -571,7 +571,9 @@ inline h2_t H2(size_t hash) { return hash & 0x7F; }
// Helpers for checking the state of a control byte. // Helpers for checking the state of a control byte.
inline bool IsEmpty(ctrl_t c) { return c == ctrl_t::kEmpty; } 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 IsDeleted(ctrl_t c) { return c == ctrl_t::kDeleted; }
inline bool IsEmptyOrDeleted(ctrl_t c) { return c < ctrl_t::kSentinel; } inline bool IsEmptyOrDeleted(ctrl_t c) { return c < ctrl_t::kSentinel; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment