aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-03-23 14:26:00 -0700
committerChris Robinson <[email protected]>2020-03-23 14:26:00 -0700
commit5d0f90fed0bd9f6516d5b0ce94fa6d58057c2e48 (patch)
tree0cd2a9a2c8962c3583c999146a26d2284c5ceb67
parent41b4c0669736deec9c850557e28e168f738c4381 (diff)
Avoid ## in a macro
Cppcheck thinks it's an invalid use of it
-rw-r--r--common/albyte.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/common/albyte.h b/common/albyte.h
index b74659ba..fe8cdb4f 100644
--- a/common/albyte.h
+++ b/common/albyte.h
@@ -35,21 +35,21 @@ template<typename T, REQUIRES(std::is_integral<T>::value)>
inline al::byte& operator>>=(al::byte &lhs, T rhs) noexcept
{ lhs = lhs >> rhs; return lhs; }
-#define AL_DECL_OP(op) \
+#define AL_DECL_OP(op, opeq) \
template<typename T, REQUIRES(std::is_integral<T>::value)> \
inline constexpr al::byte operator op (al::byte lhs, T rhs) noexcept \
{ return al::byte(to_integer<unsigned int>(lhs) op static_cast<unsigned int>(rhs)); } \
template<typename T, REQUIRES(std::is_integral<T>::value)> \
-inline al::byte& operator op##= (al::byte &lhs, T rhs) noexcept \
+inline al::byte& operator opeq (al::byte &lhs, T rhs) noexcept \
{ lhs = lhs op rhs; return lhs; } \
inline constexpr al::byte operator op (al::byte lhs, al::byte rhs) noexcept \
{ return al::byte(lhs op to_integer<unsigned int>(rhs)); } \
-inline al::byte& operator op##= (al::byte &lhs, al::byte rhs) noexcept \
+inline al::byte& operator opeq (al::byte &lhs, al::byte rhs) noexcept \
{ lhs = lhs op rhs; return lhs; }
-AL_DECL_OP(|)
-AL_DECL_OP(&)
-AL_DECL_OP(^)
+AL_DECL_OP(|, |=)
+AL_DECL_OP(&, &=)
+AL_DECL_OP(^, ^=)
#undef AL_DECL_OP