8#ifndef BOTAN_WORD_ROTATE_H_
9#define BOTAN_WORD_ROTATE_H_
11#include <botan/types.h>
20template <
size_t ROT,
typename T>
22 requires(ROT > 0 && ROT < 8 *
sizeof(
T))
24 return static_cast<T>((input << ROT) | (input >> (8 *
sizeof(
T) - ROT)));
32template <
size_t ROT,
typename T>
34 requires(ROT > 0 && ROT < 8 *
sizeof(
T))
36 return static_cast<T>((input >> ROT) | (input << (8 *
sizeof(
T) - ROT)));
42template <
size_t R1,
size_t R2,
size_t S,
typename T>
50template <
size_t R1,
size_t R2,
size_t R3,
typename T>
63 return rot ?
static_cast<T>((input << rot) | (input >> (
sizeof(
T) * 8 - rot))) : input;
74 return rot ?
static_cast<T>((input >> rot) | (input << (
sizeof(
T) * 8 - rot))) : input;
77#if defined(BOTAN_USE_GCC_INLINE_ASM) && defined(BOTAN_TARGET_CPU_IS_X86_FAMILY)
80inline uint32_t
rotl_var(uint32_t input,
size_t rot) {
81 asm(
"roll %1,%0" :
"+r"(input) :
"c"(
static_cast<uint8_t
>(rot)) :
"cc");
86inline uint32_t
rotr_var(uint32_t input,
size_t rot) {
87 asm(
"rorl %1,%0" :
"+r"(input) :
"c"(
static_cast<uint8_t
>(rot)) :
"cc");
constexpr T rotl(T input)
constexpr T rotr(T input)
constexpr T rotl_var(T input, size_t rot)
constexpr T rotr_var(T input, size_t rot)