forked from mirror/OpenTTD
Fix: [NewGRF] Make VA2 operator 11 (ror) behave well-defined when rotating by 0 bits.
This commit is contained in:
committed by
Niels Martin Hansen
parent
b3dc90af58
commit
18ca3e8660
@@ -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));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user