@@ -34,13 +34,13 @@ static constexpr enumType operator^(enumType a, enumType b) noexcept \
3434{ \
3535 return (enumType)((uint64)a ^ (uint64)b); \
3636} \
37- static constexpr enumType operator !(enumType a ) noexcept \
37+ static constexpr enumType operator !(enumType v ) noexcept \
3838{ \
39- return (enumType)!((uint64)a ); \
39+ return (enumType)!((uint64)v ); \
4040} \
41- static constexpr enumType operator ~(enumType a ) noexcept \
41+ static constexpr enumType operator ~(enumType v ) noexcept \
4242{ \
43- return (enumType)~((uint64)a ); \
43+ return (enumType)~((uint64)v ); \
4444} \
4545static constexpr enumType& operator |=(enumType& a, enumType b) noexcept \
4646{ \
@@ -54,13 +54,21 @@ static constexpr enumType& operator^=(enumType& a, enumType b) noexcept \
5454{ \
5555 return a = a ^ b; \
5656} \
57- static constexpr bool hasAnyFlag (enumType a , enumType flags) noexcept \
57+ static constexpr bool hasAnyFlag (enumType v , enumType flags) noexcept \
5858{ \
59- return (uint64)(a & flags); \
59+ return (uint64)(v & flags) ? true : false ; \
6060} \
61- static constexpr bool hasOneFlag (enumType a , enumType flag) noexcept \
61+ static constexpr bool hasOneFlag (enumType v , enumType flag) noexcept \
6262{ \
63- return (uint64)(a & flag) == (uint64)a; \
63+ return (v & flag) == v; \
64+ } \
65+ static constexpr void setFlags (enumType& v, enumType flags) noexcept \
66+ { \
67+ v |= flags; \
68+ } \
69+ static constexpr void unsetFlags (enumType& v, enumType flags) noexcept \
70+ { \
71+ v &= ~flags; \
6472}
6573
6674} // namespace math
0 commit comments