Botan: Botan::SIMD_Scalar Class Reference

Botan 1.10.16

Public Member Functions | Static Public Member Functions | List of all members
Botan::SIMD_Scalar Class Reference

`#include <simd_scalar.h>`

## Public Member Functions
SIMD_Scalar | andc (const SIMD_Scalar &other)
SIMD_Scalar | bswap () const
SIMD_Scalar | operator & (const SIMD_Scalar &other)
void | operator &= (const SIMD_Scalar &other)
SIMD_Scalar | operator+ (const SIMD_Scalar &other) const
void | operator+= (const SIMD_Scalar &other)
SIMD_Scalar | operator- (const SIMD_Scalar &other) const
void | operator-= (const SIMD_Scalar &other)
SIMD_Scalar | operator<< (size_t shift) const
SIMD_Scalar | operator>> (size_t shift) const
SIMD_Scalar | operator^ (const SIMD_Scalar &other) const
void | operator^= (const SIMD_Scalar &other)
void | operator|= (const SIMD_Scalar &other)
SIMD_Scalar | operator~ () const
void | rotate_left (size_t rot)
void | rotate_right (size_t rot)
| SIMD_Scalar (const u32bit B[4])
| SIMD_Scalar (u32bit B0, u32bit B1, u32bit B2, u32bit B3)
| SIMD_Scalar (u32bit B)
void | store_be (byte out[]) const
void | store_le (byte out[]) const

## Static Public Member Functions
static bool | enabled ()
static SIMD_Scalar | load_be (const void *in)
static SIMD_Scalar | load_le (const void *in)
static void | transpose (SIMD_Scalar &B0, SIMD_Scalar &B1, SIMD_Scalar &B2, SIMD_Scalar &B3)

## Detailed Description

Fake SIMD, using plain scalar operations Often still faster than iterative on superscalar machines

Definition at line 20 of file simd_scalar.h.

## Constructor & Destructor Documentation

## ◆ SIMD_Scalar() [1/3]

Botan::SIMD_Scalar::SIMD_Scalar | ( | const u32bit | B[4] | ) |
| inline

Definition at line 25 of file simd_scalar.h.

Referenced by andc(), bswap(), load_be(), load_le(), operator &(), operator+(), operator-(), operator<<(), operator>>(), operator^(), and operator~().

26 {
27 R0 = B[0];
28 R1 = B[1];
29 R2 = B[2];
30 R3 = B[3];
31 }

## ◆ SIMD_Scalar() [2/3]

Botan::SIMD_Scalar::SIMD_Scalar | ( | u32bit | B0,
|  | u32bit | B1,
|  | u32bit | B2,
|  | u32bit | B3
| ) |  |
| inline

Definition at line 33 of file simd_scalar.h.

34 {
35 R0 = B0;
36 R1 = B1;
37 R2 = B2;
38 R3 = B3;
39 }

## ◆ SIMD_Scalar() [3/3]

Botan::SIMD_Scalar::SIMD_Scalar | ( | u32bit | B | ) |
| inline

Definition at line 41 of file simd_scalar.h.

42 {
43 R0 = B;
44 R1 = B;
45 R2 = B;
46 R3 = B;
47 }

## Member Function Documentation

## ◆ andc()

SIMD_Scalar Botan::SIMD_Scalar::andc | ( | const SIMD_Scalar & | other | ) |
| inline

Definition at line 187 of file simd_scalar.h.

References SIMD_Scalar().

188 {
189 return SIMD_Scalar(~R0 & other.R0,
190 ~R1 & other.R1,
191 ~R2 & other.R2,
192 ~R3 & other.R3);
193 }
Botan::SIMD_Scalar::SIMD_Scalar
SIMD_Scalar(const u32bit B[4])
Definition: simd_scalar.h:25

## ◆ bswap()

SIMD_Scalar Botan::SIMD_Scalar::bswap | ( |  | ) | const
| inline

Definition at line 195 of file simd_scalar.h.

References Botan::reverse_bytes(), and SIMD_Scalar().

196 {
197 return SIMD_Scalar(reverse_bytes(R0),
198 reverse_bytes(R1),
199 reverse_bytes(R2),
200 reverse_bytes(R3));
201 }
Botan::SIMD_Scalar::SIMD_Scalar
SIMD_Scalar(const u32bit B[4])
Definition: simd_scalar.h:25
Botan::reverse_bytes
u16bit reverse_bytes(u16bit val)
Definition: bswap.h:24

## ◆ enabled()

static bool Botan::SIMD_Scalar::enabled | ( |  | ) |
| inlinestatic

Definition at line 23 of file simd_scalar.h.

23 { return true; }

## ◆ load_be()

static SIMD_Scalar Botan::SIMD_Scalar::load_be | ( | const void * | in | ) |
| inlinestatic

Definition at line 58 of file simd_scalar.h.

References Botan::load_be< u32bit >(), and SIMD_Scalar().

59 {
60 const byte* in_b = static_cast<const byte*>(in);
61 return SIMD_Scalar(Botan::load_be<u32bit>(in_b, 0),
62 Botan::load_be<u32bit>(in_b, 1),
63 Botan::load_be<u32bit>(in_b, 2),
64 Botan::load_be<u32bit>(in_b, 3));
65 }
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::load_be< u32bit >
u32bit load_be< u32bit >(const byte in[], size_t off)
Definition: loadstor.h:166
Botan::SIMD_Scalar::SIMD_Scalar
SIMD_Scalar(const u32bit B[4])
Definition: simd_scalar.h:25

## ◆ load_le()

static SIMD_Scalar Botan::SIMD_Scalar::load_le | ( | const void * | in | ) |
| inlinestatic

Definition at line 49 of file simd_scalar.h.

References Botan::load_le< u32bit >(), and SIMD_Scalar().

50 {
51 const byte* in_b = static_cast<const byte*>(in);
52 return SIMD_Scalar(Botan::load_le<u32bit>(in_b, 0),
53 Botan::load_le<u32bit>(in_b, 1),
54 Botan::load_le<u32bit>(in_b, 2),
55 Botan::load_le<u32bit>(in_b, 3));
56 }
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::load_le< u32bit >
u32bit load_le< u32bit >(const byte in[], size_t off)
Definition: loadstor.h:183
Botan::SIMD_Scalar::SIMD_Scalar
SIMD_Scalar(const u32bit B[4])
Definition: simd_scalar.h:25

## ◆ operator &()

SIMD_Scalar Botan::SIMD_Scalar::operator& | ( | const SIMD_Scalar & | other | ) |
| inline

Definition at line 149 of file simd_scalar.h.

References SIMD_Scalar().

150 {
151 return SIMD_Scalar(R0 & other.R0,
152 R1 & other.R1,
153 R2 & other.R2,
154 R3 & other.R3);
155 }
Botan::SIMD_Scalar::SIMD_Scalar
SIMD_Scalar(const u32bit B[4])
Definition: simd_scalar.h:25

## ◆ operator &=()

void Botan::SIMD_Scalar::operator&= | ( | const SIMD_Scalar & | other | ) |
| inline

Definition at line 157 of file simd_scalar.h.

158 {
159 R0 &= other.R0;
160 R1 &= other.R1;
161 R2 &= other.R2;
162 R3 &= other.R3;
163 }

## ◆ operator+()

SIMD_Scalar Botan::SIMD_Scalar::operator+ | ( | const SIMD_Scalar & | other | ) | const
| inline

Definition at line 101 of file simd_scalar.h.

References SIMD_Scalar().

102 {
103 return SIMD_Scalar(R0 + other.R0,
104 R1 + other.R1,
105 R2 + other.R2,
106 R3 + other.R3);
107 }
Botan::SIMD_Scalar::SIMD_Scalar
SIMD_Scalar(const u32bit B[4])
Definition: simd_scalar.h:25

## ◆ operator+=()

void Botan::SIMD_Scalar::operator+= | ( | const SIMD_Scalar & | other | ) |
| inline

Definition at line 93 of file simd_scalar.h.

94 {
95 R0 += other.R0;
96 R1 += other.R1;
97 R2 += other.R2;
98 R3 += other.R3;
99 }

## ◆ operator-()

SIMD_Scalar Botan::SIMD_Scalar::operator- | ( | const SIMD_Scalar & | other | ) | const
| inline

Definition at line 117 of file simd_scalar.h.

References SIMD_Scalar().

118 {
119 return SIMD_Scalar(R0 - other.R0,
120 R1 - other.R1,
121 R2 - other.R2,
122 R3 - other.R3);
123 }
Botan::SIMD_Scalar::SIMD_Scalar
SIMD_Scalar(const u32bit B[4])
Definition: simd_scalar.h:25

## ◆ operator-=()

void Botan::SIMD_Scalar::operator-= | ( | const SIMD_Scalar & | other | ) |
| inline

Definition at line 109 of file simd_scalar.h.

110 {
111 R0 -= other.R0;
112 R1 -= other.R1;
113 R2 -= other.R2;
114 R3 -= other.R3;
115 }

## ◆ operator<<()

SIMD_Scalar Botan::SIMD_Scalar::operator<< | ( | size_t | shift | ) | const
| inline

Definition at line 165 of file simd_scalar.h.

References SIMD_Scalar().

166 {
167 return SIMD_Scalar(R0 << shift,
168 R1 << shift,
169 R2 << shift,
170 R3 << shift);
171 }
Botan::SIMD_Scalar::SIMD_Scalar
SIMD_Scalar(const u32bit B[4])
Definition: simd_scalar.h:25

## ◆ operator>>()

SIMD_Scalar Botan::SIMD_Scalar::operator>> | ( | size_t | shift | ) | const
| inline

Definition at line 173 of file simd_scalar.h.

References SIMD_Scalar().

174 {
175 return SIMD_Scalar(R0 >> shift,
176 R1 >> shift,
177 R2 >> shift,
178 R3 >> shift);
179 }
Botan::SIMD_Scalar::SIMD_Scalar
SIMD_Scalar(const u32bit B[4])
Definition: simd_scalar.h:25

## ◆ operator^()

SIMD_Scalar Botan::SIMD_Scalar::operator^ | ( | const SIMD_Scalar & | other | ) | const
| inline

Definition at line 133 of file simd_scalar.h.

References SIMD_Scalar().

134 {
135 return SIMD_Scalar(R0 ^ other.R0,
136 R1 ^ other.R1,
137 R2 ^ other.R2,
138 R3 ^ other.R3);
139 }
Botan::SIMD_Scalar::SIMD_Scalar
SIMD_Scalar(const u32bit B[4])
Definition: simd_scalar.h:25

## ◆ operator^=()

void Botan::SIMD_Scalar::operator^= | ( | const SIMD_Scalar & | other | ) |
| inline

Definition at line 125 of file simd_scalar.h.

126 {
127 R0 ^= other.R0;
128 R1 ^= other.R1;
129 R2 ^= other.R2;
130 R3 ^= other.R3;
131 }

## ◆ operator|=()

void Botan::SIMD_Scalar::operator|= | ( | const SIMD_Scalar & | other | ) |
| inline

Definition at line 141 of file simd_scalar.h.

142 {
143 R0 |= other.R0;
144 R1 |= other.R1;
145 R2 |= other.R2;
146 R3 |= other.R3;
147 }

## ◆ operator~()

SIMD_Scalar Botan::SIMD_Scalar::operator~ | ( |  | ) | const
| inline

Definition at line 181 of file simd_scalar.h.

References SIMD_Scalar().

182 {
183 return SIMD_Scalar(~R0, ~R1, ~R2, ~R3);
184 }
Botan::SIMD_Scalar::SIMD_Scalar
SIMD_Scalar(const u32bit B[4])
Definition: simd_scalar.h:25

## ◆ rotate_left()

void Botan::SIMD_Scalar::rotate_left | ( | size_t | rot | ) |
| inline

Definition at line 77 of file simd_scalar.h.

References Botan::rotate_left().

78 {
79 R0 = Botan::rotate_left(R0, rot);
80 R1 = Botan::rotate_left(R1, rot);
81 R2 = Botan::rotate_left(R2, rot);
82 R3 = Botan::rotate_left(R3, rot);
83 }
Botan::rotate_left
T rotate_left(T input, size_t rot)
Definition: rotate.h:21

## ◆ rotate_right()

void Botan::SIMD_Scalar::rotate_right | ( | size_t | rot | ) |
| inline

Definition at line 85 of file simd_scalar.h.

References Botan::rotate_right().

86 {
87 R0 = Botan::rotate_right(R0, rot);
88 R1 = Botan::rotate_right(R1, rot);
89 R2 = Botan::rotate_right(R2, rot);
90 R3 = Botan::rotate_right(R3, rot);
91 }
Botan::rotate_right
T rotate_right(T input, size_t rot)
Definition: rotate.h:34

## ◆ store_be()

void Botan::SIMD_Scalar::store_be | ( | byte | out[] | ) | const
| inline

Definition at line 72 of file simd_scalar.h.

References Botan::store_be().

73 {
74 Botan::store_be(out, R0, R1, R2, R3);
75 }
Botan::store_be
void store_be(u16bit in, byte out[2])
Definition: loadstor.h:412

## ◆ store_le()

void Botan::SIMD_Scalar::store_le | ( | byte | out[] | ) | const
| inline

Definition at line 67 of file simd_scalar.h.

References Botan::store_le().

68 {
69 Botan::store_le(out, R0, R1, R2, R3);
70 }
Botan::store_le
void store_le(u16bit in, byte out[2])
Definition: loadstor.h:427

## ◆ transpose()

static void Botan::SIMD_Scalar::transpose | ( | SIMD_Scalar & | B0,
|  | SIMD_Scalar & | B1,
|  | SIMD_Scalar & | B2,
|  | SIMD_Scalar & | B3
| ) |  |
| inlinestatic

Definition at line 203 of file simd_scalar.h.

205 {
206 SIMD_Scalar T0(B0.R0, B1.R0, B2.R0, B3.R0);
207 SIMD_Scalar T1(B0.R1, B1.R1, B2.R1, B3.R1);
208 SIMD_Scalar T2(B0.R2, B1.R2, B2.R2, B3.R2);
209 SIMD_Scalar T3(B0.R3, B1.R3, B2.R3, B3.R3);
210
211 B0 = T0;
212 B1 = T1;
213 B2 = T2;
214 B3 = T3;
215 }
Botan::SIMD_Scalar::SIMD_Scalar
SIMD_Scalar(const u32bit B[4])
Definition: simd_scalar.h:25

The documentation for this class was generated from the following file:

- src/simd/simd_scalar/simd_scalar.h