Codechange: replace ROR/ROL with std::rotr/rotl

This commit is contained in:
Rubidium
2024-01-17 20:58:06 +01:00
committed by rubidium42
parent f457be5a27
commit 47c0184a0b
7 changed files with 10 additions and 41 deletions

View File

@@ -288,38 +288,6 @@ inline bool HasAtMostOneBit(T value)
return (value & (value - 1)) == 0;
}
/**
* ROtate \a x Left by \a n
*
* @note Assumes a byte has 8 bits
* @param x The value which we want to rotate
* @param n The number how many we want to rotate
* @pre n < sizeof(T) * 8
* @return A bit rotated number
*/
template <typename T>
inline T ROL(const T x, const uint8_t n)
{
if (n == 0) return x;
return (T)(x << n | x >> (sizeof(x) * 8 - n));
}
/**
* ROtate \a x Right by \a n
*
* @note Assumes a byte has 8 bits
* @param x The value which we want to rotate
* @param n The number how many we want to rotate
* @pre n < sizeof(T) * 8
* @return A bit rotated number
*/
template <typename T>
inline T ROR(const T x, const uint8_t n)
{
if (n == 0) return x;
return (T)(x >> n | x << (sizeof(x) * 8 - n));
}
/**
* Iterable ensemble of each set bit in a value.
* @tparam Tbitpos Type of the position variable.