Skip to content

Commit

Permalink
fix enum_fuse shift value calculation (#386) (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
bshm authored Nov 13, 2024
1 parent c2636e5 commit 15a085f
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 15a085f

Please sign in to comment.