Skip to content

Commit

Permalink
Fix underlying flags size
Browse files Browse the repository at this point in the history
  • Loading branch information
arBmind committed Aug 22, 2024
1 parent e9eb45b commit 0ad5f46
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/flags19.lib/flags19/FlagsOf.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ using enum19::meta_enum_for;
namespace details {

template<size_t maxBit> constexpr auto storageTypeForMaxBit() {
if constexpr (maxBit <= sizeof(uint8_t)) {
if constexpr (maxBit <= 8 * sizeof(uint8_t)) {
return uint8_t{};
}
else if constexpr (maxBit <= sizeof(uint16_t)) {
else if constexpr (maxBit <= 8 * sizeof(uint16_t)) {
return uint16_t{};
}
else if constexpr (maxBit <= sizeof(uint32_t)) {
else if constexpr (maxBit <= 8 * sizeof(uint32_t)) {
return uint32_t{};
}
else if constexpr (maxBit <= sizeof(uint64_t)) {
else if constexpr (maxBit <= 8 * sizeof(uint64_t)) {
return uint64_t{};
}
else {
static_assert(maxBit > sizeof(uint64_t), "not supported right now");
static_assert(maxBit > 8 * sizeof(uint64_t), "not supported right now");
}
}

Expand Down

0 comments on commit 0ad5f46

Please sign in to comment.