diff options
author | peter1138 <peter1138@openttd.org> | 2019-04-21 21:01:42 +0100 |
---|---|---|
committer | PeterN <peter@fuzzle.org> | 2019-04-21 22:31:12 +0100 |
commit | ac1e1a272fbba07195c1bf7613a886b692fb159d (patch) | |
tree | b284e1138d132a3576215f3230970795a72a32d2 /src/core | |
parent | c17736b493bccad5aeb51fd3b490d79ec7b60a7a (diff) | |
download | openttd-ac1e1a272fbba07195c1bf7613a886b692fb159d.tar.xz |
Fix: Replace int with std::underlying_type in DECLARE_ENUM_AS_BIT_SET.
This fixes 64 bit uses of this macro.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/enum_type.hpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/enum_type.hpp b/src/core/enum_type.hpp index 35a0cb292..920cb514a 100644 --- a/src/core/enum_type.hpp +++ b/src/core/enum_type.hpp @@ -31,13 +31,13 @@ /** Operators to allow to work with enum as with type safe bit set in C++ */ # define DECLARE_ENUM_AS_BIT_SET(mask_t) \ - inline mask_t operator | (mask_t m1, mask_t m2) {return (mask_t)((int)m1 | m2);} \ - inline mask_t operator & (mask_t m1, mask_t m2) {return (mask_t)((int)m1 & m2);} \ - inline mask_t operator ^ (mask_t m1, mask_t m2) {return (mask_t)((int)m1 ^ m2);} \ + inline mask_t operator | (mask_t m1, mask_t m2) {return (mask_t)((std::underlying_type<mask_t>::type)m1 | m2);} \ + inline mask_t operator & (mask_t m1, mask_t m2) {return (mask_t)((std::underlying_type<mask_t>::type)m1 & m2);} \ + inline mask_t operator ^ (mask_t m1, mask_t m2) {return (mask_t)((std::underlying_type<mask_t>::type)m1 ^ m2);} \ inline mask_t& operator |= (mask_t& m1, mask_t m2) {m1 = m1 | m2; return m1;} \ inline mask_t& operator &= (mask_t& m1, mask_t m2) {m1 = m1 & m2; return m1;} \ inline mask_t& operator ^= (mask_t& m1, mask_t m2) {m1 = m1 ^ m2; return m1;} \ - inline mask_t operator ~(mask_t m) {return (mask_t)(~(int)m);} + inline mask_t operator ~(mask_t m) {return (mask_t)(~(std::underlying_type<mask_t>::type)m);} /** |