utils: rework MU_ENABLE_BITOPS using C++20 code

Instead of macros, we using C++20 concepts to define the helpers to deal with
bitops on enum-class conveniently.

x# Please enter the commit message for your changes. Lines starting
This commit is contained in:
Dirk-Jan C. Binnema
2026-01-27 23:05:35 +02:00
committed by Seth Ladygo
parent 911ade8b73
commit ab6017d5a9
2 changed files with 48 additions and 18 deletions

View File

@ -260,12 +260,16 @@ test_join()
}
namespace Mu {
enum struct Bits { None = 0, Bit1 = 1 << 0, Bit2 = 1 << 1 };
MU_ENABLE_BITOPS(Bits);
}
static void
test_define_bitmap()
{
using namespace Mu;
g_assert_cmpuint((guint)Bits::None, ==, (guint)0);
g_assert_cmpuint((guint)Bits::Bit1, ==, (guint)1);
g_assert_cmpuint((guint)Bits::Bit2, ==, (guint)2);