diff --git a/src/core/bitmath_func.hpp b/src/core/bitmath_func.hpp index c4cc4d6153..ffdfb2f616 100644 --- a/src/core/bitmath_func.hpp +++ b/src/core/bitmath_func.hpp @@ -60,7 +60,8 @@ template static inline T SB(T &x, const uint8 s, const uint8 n, const U d) { x &= (T)(~((((T)1U << n) - 1) << s)); - x |= (T)(d << s); + typename std::make_unsigned::type td = d; + x |= (T)(td << s); return x; }