|
@@ -40,62 +40,62 @@
|
|
|
#define AK_ENUM_BITWISE_FRIEND_OPERATORS(Enum) \
|
|
|
_AK_ENUM_BITWISE_OPERATORS_INTERNAL(Enum, friend)
|
|
|
|
|
|
-#define _AK_ENUM_BITWISE_OPERATORS_INTERNAL(Enum, Prefix) \
|
|
|
- \
|
|
|
- [[nodiscard]] Prefix constexpr inline Enum operator|(Enum lhs, Enum rhs) \
|
|
|
- { \
|
|
|
- using Type = UnderlyingType<Enum>; \
|
|
|
- return static_cast<Enum>( \
|
|
|
- static_cast<Type>(lhs) | static_cast<Type>(rhs)); \
|
|
|
- } \
|
|
|
- \
|
|
|
- [[nodiscard]] Prefix constexpr inline Enum operator&(Enum lhs, Enum rhs) \
|
|
|
- { \
|
|
|
- using Type = UnderlyingType<Enum>; \
|
|
|
- return static_cast<Enum>( \
|
|
|
- static_cast<Type>(lhs) & static_cast<Type>(rhs)); \
|
|
|
- } \
|
|
|
- \
|
|
|
- [[nodiscard]] Prefix constexpr inline Enum operator^(Enum lhs, Enum rhs) \
|
|
|
- { \
|
|
|
- using Type = UnderlyingType<Enum>; \
|
|
|
- return static_cast<Enum>( \
|
|
|
- static_cast<Type>(lhs) ^ static_cast<Type>(rhs)); \
|
|
|
- } \
|
|
|
- \
|
|
|
- [[nodiscard]] Prefix constexpr inline Enum operator~(Enum rhs) \
|
|
|
- { \
|
|
|
- using Type = UnderlyingType<Enum>; \
|
|
|
- return static_cast<Enum>( \
|
|
|
- ~static_cast<Type>(rhs)); \
|
|
|
- } \
|
|
|
- \
|
|
|
- Prefix constexpr inline Enum& operator|=(Enum& lhs, Enum rhs) \
|
|
|
- { \
|
|
|
- using Type = UnderlyingType<Enum>; \
|
|
|
- lhs = static_cast<Enum>( \
|
|
|
- static_cast<Type>(lhs) | static_cast<Type>(rhs)); \
|
|
|
- return lhs; \
|
|
|
- } \
|
|
|
- \
|
|
|
- Prefix constexpr inline Enum& operator&=(Enum& lhs, Enum rhs) \
|
|
|
- { \
|
|
|
- using Type = UnderlyingType<Enum>; \
|
|
|
- lhs = static_cast<Enum>( \
|
|
|
- static_cast<Type>(lhs) & static_cast<Type>(rhs)); \
|
|
|
- return lhs; \
|
|
|
- } \
|
|
|
- \
|
|
|
- Prefix constexpr inline Enum& operator^=(Enum& lhs, Enum rhs) \
|
|
|
- { \
|
|
|
- using Type = UnderlyingType<Enum>; \
|
|
|
- lhs = static_cast<Enum>( \
|
|
|
- static_cast<Type>(lhs) ^ static_cast<Type>(rhs)); \
|
|
|
- return lhs; \
|
|
|
- } \
|
|
|
- \
|
|
|
- Prefix constexpr inline bool has_flag(Enum value, Enum mask) \
|
|
|
- { \
|
|
|
- using Type = UnderlyingType<Enum>; \
|
|
|
- return static_cast<Type>(value & mask) != 0; \
|
|
|
+#define _AK_ENUM_BITWISE_OPERATORS_INTERNAL(Enum, Prefix) \
|
|
|
+ \
|
|
|
+ [[nodiscard]] Prefix constexpr Enum operator|(Enum lhs, Enum rhs) \
|
|
|
+ { \
|
|
|
+ using Type = UnderlyingType<Enum>; \
|
|
|
+ return static_cast<Enum>( \
|
|
|
+ static_cast<Type>(lhs) | static_cast<Type>(rhs)); \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ [[nodiscard]] Prefix constexpr Enum operator&(Enum lhs, Enum rhs) \
|
|
|
+ { \
|
|
|
+ using Type = UnderlyingType<Enum>; \
|
|
|
+ return static_cast<Enum>( \
|
|
|
+ static_cast<Type>(lhs) & static_cast<Type>(rhs)); \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ [[nodiscard]] Prefix constexpr Enum operator^(Enum lhs, Enum rhs) \
|
|
|
+ { \
|
|
|
+ using Type = UnderlyingType<Enum>; \
|
|
|
+ return static_cast<Enum>( \
|
|
|
+ static_cast<Type>(lhs) ^ static_cast<Type>(rhs)); \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ [[nodiscard]] Prefix constexpr Enum operator~(Enum rhs) \
|
|
|
+ { \
|
|
|
+ using Type = UnderlyingType<Enum>; \
|
|
|
+ return static_cast<Enum>( \
|
|
|
+ ~static_cast<Type>(rhs)); \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ Prefix constexpr Enum& operator|=(Enum& lhs, Enum rhs) \
|
|
|
+ { \
|
|
|
+ using Type = UnderlyingType<Enum>; \
|
|
|
+ lhs = static_cast<Enum>( \
|
|
|
+ static_cast<Type>(lhs) | static_cast<Type>(rhs)); \
|
|
|
+ return lhs; \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ Prefix constexpr Enum& operator&=(Enum& lhs, Enum rhs) \
|
|
|
+ { \
|
|
|
+ using Type = UnderlyingType<Enum>; \
|
|
|
+ lhs = static_cast<Enum>( \
|
|
|
+ static_cast<Type>(lhs) & static_cast<Type>(rhs)); \
|
|
|
+ return lhs; \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ Prefix constexpr Enum& operator^=(Enum& lhs, Enum rhs) \
|
|
|
+ { \
|
|
|
+ using Type = UnderlyingType<Enum>; \
|
|
|
+ lhs = static_cast<Enum>( \
|
|
|
+ static_cast<Type>(lhs) ^ static_cast<Type>(rhs)); \
|
|
|
+ return lhs; \
|
|
|
+ } \
|
|
|
+ \
|
|
|
+ Prefix constexpr bool has_flag(Enum value, Enum mask) \
|
|
|
+ { \
|
|
|
+ using Type = UnderlyingType<Enum>; \
|
|
|
+ return static_cast<Type>(value & mask) != 0; \
|
|
|
}
|