1
0
Fork 0
mirror of https://github.com/Neargye/magic_enum.git synced 2026-01-09 23:34:23 +00:00

fix enum_fuse shift value calculation (Neargye#386)

This commit is contained in:
Bastian Schmitz 2024-11-02 13:48:41 +01:00
parent a72a0536c7
commit 5c5d41b87c

View file

@ -42,7 +42,7 @@ template <typename E>
constexpr optional<std::uintmax_t> fuse_one_enum(optional<std::uintmax_t> hash, E value) noexcept {
if (hash) {
if (const auto index = enum_index(value)) {
return (*hash << log2(enum_count<E>() + 1)) | *index;
return (*hash << log2((enum_count<E>() << 1) - 1)) | *index;
}
}
return {};