meta: add c++ wrapper of core module
This commit is contained in:
46
core-mm/include/blue/core/misc.hpp
Normal file
46
core-mm/include/blue/core/misc.hpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef BLUE_CORE_MISC_HPP_
|
||||
#define BLUE_CORE_MISC_HPP_
|
||||
|
||||
#define Z__B_ENUM_CLASS_BITWISE_OPS(enum_name) \
|
||||
inline constexpr enum_name operator&(enum_name x, enum_name y) \
|
||||
{ \
|
||||
return static_cast<enum_name>( \
|
||||
static_cast<int>(x) & static_cast<int>(y)); \
|
||||
} \
|
||||
\
|
||||
inline constexpr enum_name operator|(enum_name x, enum_name y) \
|
||||
{ \
|
||||
return static_cast<enum_name>( \
|
||||
static_cast<int>(x) | static_cast<int>(y)); \
|
||||
} \
|
||||
\
|
||||
inline constexpr enum_name operator^(enum_name x, enum_name y) \
|
||||
{ \
|
||||
return static_cast<enum_name>( \
|
||||
static_cast<int>(x) ^ static_cast<int>(y)); \
|
||||
} \
|
||||
\
|
||||
inline constexpr enum_name operator~(enum_name x) \
|
||||
{ \
|
||||
return static_cast<enum_name>(~static_cast<int>(x)); \
|
||||
} \
|
||||
\
|
||||
inline enum_name &operator&=(enum_name &x, enum_name y) \
|
||||
{ \
|
||||
x = x & y; \
|
||||
return x; \
|
||||
} \
|
||||
\
|
||||
inline enum_name &operator|=(enum_name &x, enum_name y) \
|
||||
{ \
|
||||
x = x | y; \
|
||||
return x; \
|
||||
} \
|
||||
\
|
||||
inline enum_name &operator^=(enum_name &x, enum_name y) \
|
||||
{ \
|
||||
x = x ^ y; \
|
||||
return x; \
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user