Skip to content

Commit 2d98794

Browse files
committed
Common: EnumFlags fix max rep.
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 98b08da commit 2d98794

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Common/Utils/include/CommonUtils/EnumFlags.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,14 @@ struct FlagsHelper final {
154154
}
155155
return values;
156156
}
157-
static constexpr auto Values{getValues(std::make_index_sequence<MaxScan - MinScan - MarginScan>())}; // Enum Values
158-
static constexpr auto count() noexcept { return Values.size(); } // Number of enum members
159-
static constexpr auto Min_v{Values.front()}; // Enum first entry
160-
static constexpr auto Max_v{Values.back()}; // Enum last entry
161-
static constexpr auto Min_u_v{static_cast<size_t>(Min_v)}; // Enum first entry as size_t
162-
static constexpr auto Max_u_v{static_cast<size_t>(Max_v)}; // Enum last entry as size_t
163-
static constexpr bool isContinuous() noexcept { return (Max_u_v - Min_u_v + 1) == count(); } // Is the enum continuous
164-
static constexpr uint64_t MaxRep{(Max_u_v >= 64) ? std::numeric_limits<uint64_t>::max() : (1ULL << Max_u_v) - 1}; // largest representable value
157+
static constexpr auto Values{getValues(std::make_index_sequence<MaxScan - MinScan - MarginScan>())}; // Enum Values
158+
static constexpr auto count() noexcept { return Values.size(); } // Number of enum members
159+
static constexpr auto Min_v{Values.front()}; // Enum first entry
160+
static constexpr auto Max_v{Values.back()}; // Enum last entry
161+
static constexpr auto Min_u_v{static_cast<size_t>(Min_v)}; // Enum first entry as size_t
162+
static constexpr auto Max_u_v{static_cast<size_t>(Max_v)}; // Enum last entry as size_t
163+
static constexpr bool isContinuous() noexcept { return (Max_u_v - Min_u_v + 1) == count(); } // Is the enum continuous
164+
static constexpr auto MaxRep{((1 << (Max_u_v - Min_u_v + 1)) - 1) << Min_u_v}; // largest representable value
165165

166166
template <E e>
167167
static constexpr std::string_view getName()

0 commit comments

Comments
 (0)