Util: Make operator|= and &= constexpr for bitwise enums

Maintains parity with hecl's version of the macro, etc.
This commit is contained in:
Lioncash 2020-04-05 10:00:09 -04:00
parent 35e5c7c90f
commit 1b813f0c70
1 changed files with 2 additions and 2 deletions

View File

@ -48,12 +48,12 @@
using T = std::underlying_type_t<type>; \ using T = std::underlying_type_t<type>; \
return type(static_cast<T>(a) & static_cast<T>(b)); \ return type(static_cast<T>(a) & static_cast<T>(b)); \
} \ } \
inline type& operator|=(type& a, const type& b) { \ constexpr type& operator|=(type& a, type b) { \
using T = std::underlying_type_t<type>; \ using T = std::underlying_type_t<type>; \
a = type(static_cast<T>(a) | static_cast<T>(b)); \ a = type(static_cast<T>(a) | static_cast<T>(b)); \
return a; \ return a; \
} \ } \
inline type& operator&=(type& a, const type& b) { \ constexpr type& operator&=(type& a, type b) { \
using T = std::underlying_type_t<type>; \ using T = std::underlying_type_t<type>; \
a = type(static_cast<T>(a) & static_cast<T>(b)); \ a = type(static_cast<T>(a) & static_cast<T>(b)); \
return a; \ return a; \