Skip to content

Commit

Permalink
fix enum_fuse shift value calculation (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianschmitz-vorwerk committed Nov 2, 2024
1 parent a72a053 commit 5c5d41b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/magic_enum/magic_enum_fuse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
Expand Down

0 comments on commit 5c5d41b

Please sign in to comment.