summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/bitmath_func.hpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/bitmath_func.hpp b/src/core/bitmath_func.hpp
index 31e679b00..fd05aa3f5 100644
--- a/src/core/bitmath_func.hpp
+++ b/src/core/bitmath_func.hpp
@@ -302,6 +302,7 @@ static inline bool HasAtMostOneBit(T value)
template <typename T>
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 uint8 n)
template <typename T>
static inline T ROR(const T x, const uint8 n)
{
+ if (n == 0) return x;
return (T)(x >> n | x << (sizeof(x) * 8 - n));
}