From 5c5d41b87cff4140f2f8c895513bf8b7fa394f54 Mon Sep 17 00:00:00 2001 From: Bastian Schmitz Date: Sat, 2 Nov 2024 13:48:41 +0100 Subject: [PATCH] fix enum_fuse shift value calculation (Neargye#386) --- include/magic_enum/magic_enum_fuse.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/magic_enum/magic_enum_fuse.hpp b/include/magic_enum/magic_enum_fuse.hpp index 73c876e12..7811eacc4 100644 --- a/include/magic_enum/magic_enum_fuse.hpp +++ b/include/magic_enum/magic_enum_fuse.hpp @@ -42,7 +42,7 @@ template constexpr optional fuse_one_enum(optional hash, E value) noexcept { if (hash) { if (const auto index = enum_index(value)) { - return (*hash << log2(enum_count() + 1)) | *index; + return (*hash << log2((enum_count() << 1) - 1)) | *index; } } return {};