From ac1e1a272fbba07195c1bf7613a886b692fb159d Mon Sep 17 00:00:00 2001 From: peter1138 Date: Sun, 21 Apr 2019 21:01:42 +0100 Subject: Fix: Replace int with std::underlying_type in DECLARE_ENUM_AS_BIT_SET. This fixes 64 bit uses of this macro. --- src/core/enum_type.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core') 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::type)m1 | m2);} \ + inline mask_t operator & (mask_t m1, mask_t m2) {return (mask_t)((std::underlying_type::type)m1 & m2);} \ + inline mask_t operator ^ (mask_t m1, mask_t m2) {return (mask_t)((std::underlying_type::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::type)m);} /** -- cgit v1.2.3-70-g09d2