Coverage Report

Created: 2021-02-21 07:20

/src/botan/build/include/botan/internal/rotate.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
* Word Rotation Operations
3
* (C) 1999-2008,2017 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#ifndef BOTAN_WORD_ROTATE_H_
9
#define BOTAN_WORD_ROTATE_H_
10
11
#include <botan/types.h>
12
13
namespace Botan {
14
15
/**
16
* Bit rotation left by a compile-time constant amount
17
* @param input the input word
18
* @return input rotated left by ROT bits
19
*/
20
template<size_t ROT, typename T>
21
inline constexpr T rotl(T input)
22
30.6M
   {
23
30.6M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
30.6M
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
30.6M
   }
Unexecuted instantiation: unsigned int Botan::rotl<3ul, unsigned int>(unsigned int)
unsigned int Botan::rotl<7ul, unsigned int>(unsigned int)
Line
Count
Source
22
2.06k
   {
23
2.06k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
2.06k
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
2.06k
   }
unsigned int Botan::rotl<11ul, unsigned int>(unsigned int)
Line
Count
Source
22
2.06k
   {
23
2.06k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
2.06k
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
2.06k
   }
Unexecuted instantiation: unsigned int Botan::rotl<19ul, unsigned int>(unsigned int)
unsigned int Botan::rotl<5ul, unsigned int>(unsigned int)
Line
Count
Source
22
15.2M
   {
23
15.2M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
15.2M
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
15.2M
   }
unsigned int Botan::rotl<9ul, unsigned int>(unsigned int)
Line
Count
Source
22
22.0k
   {
23
22.0k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
22.0k
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
22.0k
   }
Unexecuted instantiation: unsigned int Botan::rotl<13ul, unsigned int>(unsigned int)
unsigned int Botan::rotl<15ul, unsigned int>(unsigned int)
Line
Count
Source
22
2.06k
   {
23
2.06k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
2.06k
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
2.06k
   }
unsigned int Botan::rotl<12ul, unsigned int>(unsigned int)
Line
Count
Source
22
2.06k
   {
23
2.06k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
2.06k
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
2.06k
   }
unsigned int Botan::rotl<17ul, unsigned int>(unsigned int)
Line
Count
Source
22
2.06k
   {
23
2.06k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
2.06k
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
2.06k
   }
unsigned int Botan::rotl<22ul, unsigned int>(unsigned int)
Line
Count
Source
22
2.06k
   {
23
2.06k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
2.06k
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
2.06k
   }
unsigned int Botan::rotl<14ul, unsigned int>(unsigned int)
Line
Count
Source
22
2.06k
   {
23
2.06k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
2.06k
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
2.06k
   }
unsigned int Botan::rotl<20ul, unsigned int>(unsigned int)
Line
Count
Source
22
22.0k
   {
23
22.0k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
22.0k
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
22.0k
   }
unsigned int Botan::rotl<4ul, unsigned int>(unsigned int)
Line
Count
Source
22
22.0k
   {
23
22.0k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
22.0k
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
22.0k
   }
unsigned int Botan::rotl<16ul, unsigned int>(unsigned int)
Line
Count
Source
22
2.06k
   {
23
2.06k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
2.06k
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
2.06k
   }
unsigned int Botan::rotl<23ul, unsigned int>(unsigned int)
Line
Count
Source
22
2.06k
   {
23
2.06k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
2.06k
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
2.06k
   }
unsigned int Botan::rotl<6ul, unsigned int>(unsigned int)
Line
Count
Source
22
22.0k
   {
23
22.0k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
22.0k
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
22.0k
   }
unsigned int Botan::rotl<10ul, unsigned int>(unsigned int)
Line
Count
Source
22
2.06k
   {
23
2.06k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
2.06k
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
2.06k
   }
unsigned int Botan::rotl<21ul, unsigned int>(unsigned int)
Line
Count
Source
22
2.06k
   {
23
2.06k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
2.06k
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
2.06k
   }
Unexecuted instantiation: unsigned int Botan::rotl<8ul, unsigned int>(unsigned int)
unsigned int Botan::rotl<1ul, unsigned int>(unsigned int)
Line
Count
Source
22
77.4k
   {
23
77.4k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
77.4k
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
77.4k
   }
unsigned int Botan::rotl<30ul, unsigned int>(unsigned int)
Line
Count
Source
22
15.2M
   {
23
15.2M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
15.2M
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
15.2M
   }
Unexecuted instantiation: unsigned long Botan::rotl<1ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<44ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<43ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<21ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<14ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<28ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<20ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<3ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<45ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<61ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<6ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<25ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<8ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<18ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<27ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<36ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<10ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<15ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<56ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<62ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<55ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<39ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<41ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<2ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<46ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<19ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<37ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<33ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<42ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<17ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<49ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<9ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<54ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<30ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<34ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<24ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<13ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<50ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<29ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<35ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<22ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned int Botan::rotl<27ul, unsigned int>(unsigned int)
unsigned int Botan::rotl<18ul, unsigned int>(unsigned int)
Line
Count
Source
22
20.0k
   {
23
20.0k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
24
20.0k
   return static_cast<T>((input << ROT) | (input >> (8*sizeof(T) - ROT)));
25
20.0k
   }
Unexecuted instantiation: unsigned int Botan::rotl<2ul, unsigned int>(unsigned int)
Unexecuted instantiation: unsigned int Botan::rotl<24ul, unsigned int>(unsigned int)
Unexecuted instantiation: unsigned long Botan::rotl<16ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotl<32ul, unsigned long>(unsigned long)
26
27
/**
28
* Bit rotation right by a compile-time constant amount
29
* @param input the input word
30
* @return input rotated right by ROT bits
31
*/
32
template<size_t ROT, typename T>
33
inline constexpr T rotr(T input)
34
609M
   {
35
609M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
609M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
609M
   }
unsigned int Botan::rotr<2ul, unsigned int>(unsigned int)
Line
Count
Source
34
48.7M
   {
35
48.7M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
48.7M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
48.7M
   }
unsigned int Botan::rotr<13ul, unsigned int>(unsigned int)
Line
Count
Source
34
48.7M
   {
35
48.7M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
48.7M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
48.7M
   }
unsigned int Botan::rotr<22ul, unsigned int>(unsigned int)
Line
Count
Source
34
48.7M
   {
35
48.7M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
48.7M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
48.7M
   }
unsigned int Botan::rotr<6ul, unsigned int>(unsigned int)
Line
Count
Source
34
48.7M
   {
35
48.7M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
48.7M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
48.7M
   }
unsigned int Botan::rotr<11ul, unsigned int>(unsigned int)
Line
Count
Source
34
48.7M
   {
35
48.7M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
48.7M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
48.7M
   }
unsigned int Botan::rotr<25ul, unsigned int>(unsigned int)
Line
Count
Source
34
48.7M
   {
35
48.7M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
48.7M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
48.7M
   }
unsigned int Botan::rotr<17ul, unsigned int>(unsigned int)
Line
Count
Source
34
48.7M
   {
35
48.7M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
48.7M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
48.7M
   }
unsigned int Botan::rotr<19ul, unsigned int>(unsigned int)
Line
Count
Source
34
48.7M
   {
35
48.7M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
48.7M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
48.7M
   }
unsigned int Botan::rotr<7ul, unsigned int>(unsigned int)
Line
Count
Source
34
48.7M
   {
35
48.7M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
48.7M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
48.7M
   }
unsigned int Botan::rotr<18ul, unsigned int>(unsigned int)
Line
Count
Source
34
48.7M
   {
35
48.7M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
48.7M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
48.7M
   }
unsigned long Botan::rotr<14ul, unsigned long>(unsigned long)
Line
Count
Source
34
12.0M
   {
35
12.0M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
12.0M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
12.0M
   }
unsigned long Botan::rotr<18ul, unsigned long>(unsigned long)
Line
Count
Source
34
12.0M
   {
35
12.0M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
12.0M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
12.0M
   }
unsigned long Botan::rotr<41ul, unsigned long>(unsigned long)
Line
Count
Source
34
12.0M
   {
35
12.0M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
12.0M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
12.0M
   }
unsigned long Botan::rotr<28ul, unsigned long>(unsigned long)
Line
Count
Source
34
12.0M
   {
35
12.0M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
12.0M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
12.0M
   }
unsigned long Botan::rotr<34ul, unsigned long>(unsigned long)
Line
Count
Source
34
12.0M
   {
35
12.0M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
12.0M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
12.0M
   }
unsigned long Botan::rotr<39ul, unsigned long>(unsigned long)
Line
Count
Source
34
12.0M
   {
35
12.0M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
12.0M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
12.0M
   }
unsigned long Botan::rotr<19ul, unsigned long>(unsigned long)
Line
Count
Source
34
12.0M
   {
35
12.0M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
12.0M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
12.0M
   }
unsigned long Botan::rotr<61ul, unsigned long>(unsigned long)
Line
Count
Source
34
12.0M
   {
35
12.0M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
12.0M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
12.0M
   }
unsigned long Botan::rotr<1ul, unsigned long>(unsigned long)
Line
Count
Source
34
12.0M
   {
35
12.0M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
12.0M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
12.0M
   }
unsigned long Botan::rotr<8ul, unsigned long>(unsigned long)
Line
Count
Source
34
12.0M
   {
35
12.0M
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
12.0M
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
12.0M
   }
Unexecuted instantiation: unsigned long Botan::rotr<16ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<24ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<32ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<40ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<48ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<56ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<35ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<22ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<25ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<29ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<43ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<13ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<50ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<10ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<17ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<30ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<44ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<9ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<54ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<49ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<36ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<33ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<27ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<42ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<46ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<37ul, unsigned long>(unsigned long)
Unexecuted instantiation: unsigned long Botan::rotr<63ul, unsigned long>(unsigned long)
unsigned int Botan::rotr<20ul, unsigned int>(unsigned int)
Line
Count
Source
34
20.0k
   {
35
20.0k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
20.0k
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
20.0k
   }
unsigned int Botan::rotr<4ul, unsigned int>(unsigned int)
Line
Count
Source
34
981k
   {
35
981k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
981k
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
981k
   }
unsigned int Botan::rotr<1ul, unsigned int>(unsigned int)
Line
Count
Source
34
20.0k
   {
35
20.0k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
20.0k
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
20.0k
   }
unsigned int Botan::rotr<9ul, unsigned int>(unsigned int)
Line
Count
Source
34
20.0k
   {
35
20.0k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
20.0k
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
20.0k
   }
unsigned int Botan::rotr<8ul, unsigned int>(unsigned int)
Line
Count
Source
34
10.5k
   {
35
10.5k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
10.5k
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
10.5k
   }
Unexecuted instantiation: unsigned int Botan::rotr<5ul, unsigned int>(unsigned int)
Unexecuted instantiation: unsigned int Botan::rotr<3ul, unsigned int>(unsigned int)
unsigned int Botan::rotr<16ul, unsigned int>(unsigned int)
Line
Count
Source
34
154k
   {
35
154k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
154k
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
154k
   }
unsigned int Botan::rotr<24ul, unsigned int>(unsigned int)
Line
Count
Source
34
10.5k
   {
35
10.5k
   static_assert(ROT > 0 && ROT < 8*sizeof(T), "Invalid rotation constant");
36
10.5k
   return static_cast<T>((input >> ROT) | (input << (8*sizeof(T) - ROT)));
37
10.5k
   }
38
39
/**
40
* Bit rotation left, variable rotation amount
41
* @param input the input word
42
* @param rot the number of bits to rotate, must be between 0 and sizeof(T)*8-1
43
* @return input rotated left by rot bits
44
*/
45
template<typename T>
46
inline constexpr T rotl_var(T input, size_t rot)
47
   {
48
   return rot ? static_cast<T>((input << rot) | (input >> (sizeof(T)*8 - rot))) : input;
49
   }
50
51
/**
52
* Bit rotation right, variable rotation amount
53
* @param input the input word
54
* @param rot the number of bits to rotate, must be between 0 and sizeof(T)*8-1
55
* @return input rotated right by rot bits
56
*/
57
template<typename T>
58
inline constexpr T rotr_var(T input, size_t rot)
59
   {
60
   return rot ? static_cast<T>((input >> rot) | (input << (sizeof(T)*8 - rot))) : input;
61
   }
62
63
#if defined(BOTAN_USE_GCC_INLINE_ASM)
64
65
#if defined(BOTAN_TARGET_ARCH_IS_X86_64) || defined(BOTAN_TARGET_ARCH_IS_X86_32)
66
67
template<>
68
inline uint32_t rotl_var(uint32_t input, size_t rot)
69
0
   {
70
0
   asm("roll %1,%0" : "+r" (input) : "c" (static_cast<uint8_t>(rot)));
71
0
   return input;
72
0
   }
73
74
template<>
75
inline uint32_t rotr_var(uint32_t input, size_t rot)
76
0
   {
77
0
   asm("rorl %1,%0" : "+r" (input) : "c" (static_cast<uint8_t>(rot)));
78
0
   return input;
79
0
   }
80
81
#endif
82
83
#endif
84
85
}
86
87
#endif