From 15a085f234da152c11bddc224e6f1c0c0a22956c Mon Sep 17 00:00:00 2001 From: Bastian Schmitz Date: Thu, 14 Nov 2024 00:04:44 +0100 Subject: [PATCH] fix enum_fuse shift value calculation (Neargye#386) (#387) --- 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 {};