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

fix enum_fuse shift value calculation (Neargye#386) (#387)

This commit is contained in:
Bastian Schmitz 2024-11-14 00:04:44 +01:00 committed by GitHub
parent c2636e59da
commit 15a085f234
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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 {};