#pragma once #include #include #include #include typedef int32_t BOOL; #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #if defined(__cplusplus) && (__cplusplus >= 201402L) #include #define WUT_ENUM_BITMASK_TYPE(_type) \ extern "C++" { \ namespace \ { \ constexpr inline _type \ operator~(_type lhs) \ { \ return static_cast<_type>(~static_cast>(lhs)); \ } \ constexpr inline _type \ operator&(_type lhs, _type rhs) \ { \ return static_cast<_type>(static_cast>(lhs) & static_cast>(rhs)); \ } \ constexpr inline _type \ operator|(_type lhs, _type rhs) \ { \ return static_cast<_type>(static_cast>(lhs) | static_cast>(rhs)); \ } \ constexpr inline _type \ operator^(_type lhs, _type rhs) \ { \ return static_cast<_type>(static_cast>(lhs) ^ static_cast>(rhs)); \ } \ inline _type & \ operator&=(_type &lhs, _type rhs) \ { \ return reinterpret_cast<_type &>(reinterpret_cast &>(lhs) &= static_cast>(rhs)); \ } \ inline _type & \ operator|=(_type &lhs, _type rhs) \ { \ return reinterpret_cast<_type &>(reinterpret_cast &>(lhs) |= static_cast>(rhs)); \ } \ inline _type & \ operator^=(_type &lhs, _type rhs) \ { \ return reinterpret_cast<_type &>(reinterpret_cast &>(lhs) ^= static_cast>(rhs)); \ } \ } \ } #else #define WUT_ENUM_BITMASK_TYPE(_type) #endif