13 #ifndef TLX_MATH_ROR_HEADER 14 #define TLX_MATH_ROR_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
ror32(
const uint32_t& x,
int i) {
41 asm (
"rorl %%cl,%0" :
"=r" (x1) :
"0" (x1),
"c" (i));
45 #elif defined(_MSC_VER) 48 static inline uint32_t
ror32(
const uint32_t& x,
int i) {
55 static inline uint32_t
ror32(
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
ror64(
const uint64_t& x,
int i) {
75 asm (
"rorq %%cl,%0" :
"=r" (x1) :
"0" (x1),
"c" (i));
79 #elif defined(_MSC_VER) 82 static inline uint64_t
ror64(
const uint64_t& x,
int i) {
89 static inline uint64_t
ror64(
const uint64_t& x,
int i) {
101 #endif // !TLX_MATH_ROR_HEADER
static uint32_t ror32_generic(const uint32_t &x, int i)
ror32 - generic implementation
static uint64_t ror64_generic(const uint64_t &x, int i)
ror64 - generic implementation
static uint32_t ror32(const uint32_t &x, int i)
ror32 - generic
static uint64_t ror64(const uint64_t &x, int i)
ror64 - generic