Skip to content

Commit b737274

Browse files
grebecopybara-github
authored andcommitted
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
1 parent 953cec7 commit b737274

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

absl/container/internal/raw_hash_set.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,9 @@ inline h2_t H2(size_t hash) { return hash & 0x7F; }
571571

572572
// Helpers for checking the state of a control byte.
573573
inline bool IsEmpty(ctrl_t c) { return c == ctrl_t::kEmpty; }
574-
inline bool IsFull(ctrl_t c) { return c >= static_cast<ctrl_t>(0); }
574+
inline bool IsFull(ctrl_t c) {
575+
return static_cast<std::underlying_type_t<ctrl_t>>(c) >= 0;
576+
}
575577
inline bool IsDeleted(ctrl_t c) { return c == ctrl_t::kDeleted; }
576578
inline bool IsEmptyOrDeleted(ctrl_t c) { return c < ctrl_t::kSentinel; }
577579

0 commit comments

Comments
 (0)