13 #ifndef TLX_MATH_ROL_HEADER 14 #define TLX_MATH_ROL_HEADER 32 return (x << static_cast<uint32_t>(i & 31)) |
33 (x >>
static_cast<uint32_t
>((32 - (i & 31)) & 31));
36 #if (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__)) 39 static inline uint32_t
rol32(
const uint32_t&
x,
int i) {
41 asm (
"roll %%cl,%0" :
"=r" (x1) :
"0" (x1),
"c" (i));
45 #elif defined(_MSC_VER) 48 static inline uint32_t
rol32(
const uint32_t& x,
int i) {
55 static inline uint32_t
rol32(
const uint32_t& x,
int i) {
66 return (x << static_cast<uint64_t>(i & 63)) |
67 (x >>
static_cast<uint64_t
>((64 - (i & 63)) & 63));
70 #if (defined(__GNUC__) || defined(__clang__)) && defined(__x86_64__) 73 static inline uint64_t
rol64(
const uint64_t& x,
int i) {
75 asm (
"rolq %%cl,%0" :
"=r" (x1) :
"0" (x1),
"c" (i));
79 #elif defined(_MSC_VER) 82 static inline uint64_t
rol64(
const uint64_t& x,
int i) {
89 static inline uint64_t
rol64(
const uint64_t& x,
int i) {
101 #endif // !TLX_MATH_ROL_HEADER
static uint64_t rol64_generic(const uint64_t &x, int i)
rol64 - generic implementation
static uint32_t rol32_generic(const uint32_t &x, int i)
rol32 - generic implementation
static uint32_t rol32(const uint32_t &x, int i)
rol32 - generic
static uint64_t rol64(const uint64_t &x, int i)
rol64 - generic