Showing the changes to src/include (2 of 4 files). Show all
Unified · Split
| @@ -76,12 +76,12 @@ namespace disvm · 75 unmodified lines | |||
| 76 | 76 | ||
| 77 | // Adopted from 'winnt.h' in the Windows SDK | 77 | // Adopted from 'winnt.h' in the Windows SDK |
| 78 | #define DEFINE_ENUM_FLAG_OPERATORS(TYPE) \ | 78 | #define DEFINE_ENUM_FLAG_OPERATORS(TYPE) \ |
| 79 | inline 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)); } \ | 79 | constexpr 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)); } \ |
| 80 | inline TYPE &operator |= (TYPE &a, TYPE b) { a = a | b; return a; } \ | 80 | inline TYPE &operator |= (TYPE &a, TYPE b) { a = a | b; return a; } \ |
| 81 | inline 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)); } \ | 81 | constexpr 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)); } \ |
| 82 | inline TYPE &operator &= (TYPE &a, TYPE b) { a = a & b; return a; } \ | 82 | inline TYPE &operator &= (TYPE &a, TYPE b) { a = a & b; return a; } \ |
| 83 | inline 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)); } \ | 83 | constexpr 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)); } \ |
| 84 | inline TYPE &operator ^= (TYPE &a, TYPE b) { a = a ^ b; return a; } \ | 84 | inline TYPE &operator ^= (TYPE &a, TYPE b) { a = a ^ b; return a; } \ |
| 85 | inline TYPE operator ~ (TYPE a) { return static_cast<TYPE>(~static_cast<std::underlying_type_t<TYPE>>(a)); } | 85 | constexpr 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_ |
| @@ -57,7 +57,7 @@ namespace disvm · 56 unmodified lines | |||
| 57 | template<typename CB> | 57 | template<typename CB> |
| 58 | void enum_pointer_fields(const type_descriptor_t &type_desc, void *data, CB callback) | 58 | void enum_pointer_fields(const type_descriptor_t &type_desc, void *data, CB callback) |
| 59 | { | 59 | { |
| 60 | assert(data != nullptr && callback != nullptr); | 60 | assert(data != nullptr); |
| 61 | 61 | ||
| 62 | auto memory = reinterpret_cast<word_t *>(data); | 62 | auto memory = reinterpret_cast<word_t *>(data); |
| 63 | for (auto i = word_t{ 0 }; i < type_desc.map_in_bytes; ++i, memory += 8) | 63 | for (auto i = word_t{ 0 }; i < type_desc.map_in_bytes; ++i, memory += 8) |