diff --git a/src/core/bitmath_func.hpp b/src/core/bitmath_func.hpp --- a/src/core/bitmath_func.hpp +++ b/src/core/bitmath_func.hpp @@ -302,6 +302,7 @@ static inline bool HasAtMostOneBit(T val template static inline T ROL(const T x, const uint8 n) { + if (n == 0) return x; return (T)(x << n | x >> (sizeof(x) * 8 - n)); } @@ -317,6 +318,7 @@ static inline T ROL(const T x, const uin template static inline T ROR(const T x, const uint8 n) { + if (n == 0) return x; return (T)(x >> n | x << (sizeof(x) * 8 - n)); }