History

Various perf and style fixes

arr committed 9 years ago

Commit 08c36e01 parent b1b22c24 files · +29 −23Browse files

Showing the changes to src/include/utils.h (1 of 4 files). Show all

Unified · Split

src/include/utils.h+4−4
@@ -76,12 +76,12 @@ namespace disvm · 75 unmodified lines
76 76
77// Adopted from 'winnt.h' in the Windows SDK77// Adopted from 'winnt.h' in the Windows SDK
78#define DEFINE_ENUM_FLAG_OPERATORS(TYPE) \78#define DEFINE_ENUM_FLAG_OPERATORS(TYPE) \
79inline TYPE operator | (TYPE a, TYPE b) { return static_cast<TYPE>(static_cast<std::underlying_type_t<TYPE>>(a) | static_cast<std::underlying_type_t<TYPE>>(b)); } \79constexpr TYPE operator | (TYPE a, TYPE b) { return static_cast<TYPE>(static_cast<std::underlying_type_t<TYPE>>(a) | static_cast<std::underlying_type_t<TYPE>>(b)); } \
80inline TYPE &operator |= (TYPE &a, TYPE b) { a = a | b; return a; } \80inline TYPE &operator |= (TYPE &a, TYPE b) { a = a | b; return a; } \
81inline TYPE operator & (TYPE a, TYPE b) { return static_cast<TYPE>(static_cast<std::underlying_type_t<TYPE>>(a) & static_cast<std::underlying_type_t<TYPE>>(b)); } \81constexpr TYPE operator & (TYPE a, TYPE b) { return static_cast<TYPE>(static_cast<std::underlying_type_t<TYPE>>(a) & static_cast<std::underlying_type_t<TYPE>>(b)); } \
82inline TYPE &operator &= (TYPE &a, TYPE b) { a = a & b; return a; } \82inline TYPE &operator &= (TYPE &a, TYPE b) { a = a & b; return a; } \
83inline TYPE operator ^ (TYPE a, TYPE b) { return static_cast<TYPE>(static_cast<std::underlying_type_t<TYPE>>(a) ^ static_cast<std::underlying_type_t<TYPE>>(b)); } \83constexpr TYPE operator ^ (TYPE a, TYPE b) { return static_cast<TYPE>(static_cast<std::underlying_type_t<TYPE>>(a) ^ static_cast<std::underlying_type_t<TYPE>>(b)); } \
84inline TYPE &operator ^= (TYPE &a, TYPE b) { a = a ^ b; return a; } \84inline TYPE &operator ^= (TYPE &a, TYPE b) { a = a ^ b; return a; } \
85inline TYPE operator ~ (TYPE a) { return static_cast<TYPE>(~static_cast<std::underlying_type_t<TYPE>>(a)); }85constexpr TYPE operator ~ (TYPE a) { return static_cast<TYPE>(~static_cast<std::underlying_type_t<TYPE>>(a)); }
86 86
87#endif // _DISVM_SRC_INCLUDE_UTILS_H_87#endif // _DISVM_SRC_INCLUDE_UTILS_H_