diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/support/bits.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/support/bits.h b/src/support/bits.h index 5d3502b81..1fba58bf1 100644 --- a/src/support/bits.h +++ b/src/support/bits.h @@ -66,14 +66,14 @@ int CountLeadingZeroes(T v) { return CountLeadingZeroes(typename std::make_unsigned<T>::type(v)); } -template <typename T> -inline static T RotateLeft(T val, T count) { +template <typename T, typename U> +inline static T RotateLeft(T val, U count) { T mask = sizeof(T) * CHAR_BIT - 1; count &= mask; return (val << count) | (val >> (-count & mask)); } -template <typename T> -inline static T RotateRight(T val, T count) { +template <typename T, typename U> +inline static T RotateRight(T val, U count) { T mask = sizeof(T) * CHAR_BIT - 1; count &= mask; return (val >> count) | (val << (-count & mask)); |