utils: add has_flag to MU_ENABLE_BITOPS

This commit is contained in:
Dirk-Jan C. Binnema 2022-02-26 09:46:06 +02:00
parent 38d08bad85
commit 5417928c1e
1 changed files with 15 additions and 14 deletions

View File

@ -311,8 +311,9 @@ private:
constexpr ET operator~(ET e) { return MU_TO_ENUM(ET, ~(MU_TO_NUM(ET, e))); } \
constexpr bool any_of(ET e) { return MU_TO_NUM(ET, e) != 0; } \
constexpr bool none_of(ET e) { return MU_TO_NUM(ET, e) == 0; } \
constexpr bool has_flag(ET e1, ET e2) { return (e1 & e2) == e2; } \
constexpr ET& operator&=(ET& e1, ET e2) { return e1 = e1 & e2; } \
constexpr ET& operator|=(ET& e1, ET e2) { return e1 = e1 | e2; } \
constexpr ET& operator|=(ET& e1, ET e2) { return e1 = e1 | e2; }
/**
* For unit tests, assert two std::string's are equal.