Botan
1.11.15
|
#include <simd_scalar.h>
Public Member Functions | |
SIMD_Scalar< T, N > | andc (const SIMD_Scalar< T, N > &other) |
SIMD_Scalar< T, N > | bswap () const |
SIMD_Scalar< T, N > | operator& (const SIMD_Scalar< T, N > &other) |
void | operator&= (const SIMD_Scalar< T, N > &other) |
SIMD_Scalar< T, N > | operator+ (const SIMD_Scalar< T, N > &other) const |
void | operator+= (const SIMD_Scalar< T, N > &other) |
SIMD_Scalar< T, N > | operator- (const SIMD_Scalar< T, N > &other) const |
void | operator-= (const SIMD_Scalar< T, N > &other) |
SIMD_Scalar< T, N > | operator<< (size_t shift) const |
SIMD_Scalar< T, N > | operator>> (size_t shift) const |
SIMD_Scalar< T, N > | operator^ (const SIMD_Scalar< T, N > &other) const |
void | operator^= (const SIMD_Scalar< T, N > &other) |
void | operator|= (const SIMD_Scalar< T, N > &other) |
SIMD_Scalar< T, N > | operator~ () const |
void | rotate_left (size_t rot) |
void | rotate_right (size_t rot) |
SIMD_Scalar () | |
SIMD_Scalar (const T B[N]) | |
SIMD_Scalar (T B) | |
void | store_be (byte out[]) const |
void | store_le (byte out[]) const |
Static Public Member Functions | |
static bool | enabled () |
static SIMD_Scalar< T, N > | load_be (const void *in) |
static SIMD_Scalar< T, N > | load_le (const void *in) |
static size_t | size () |
static void | transpose (SIMD_Scalar< T, N > &B0, SIMD_Scalar< T, N > &B1, SIMD_Scalar< T, N > &B2, SIMD_Scalar< T, N > &B3) |
Fake SIMD, using plain scalar operations Often still faster than iterative on superscalar machines
Definition at line 21 of file simd_scalar.h.
Botan::SIMD_Scalar< T, N >::SIMD_Scalar | ( | ) | [inline] |
Definition at line 28 of file simd_scalar.h.
{ /* uninitialized */ }
Botan::SIMD_Scalar< T, N >::SIMD_Scalar | ( | const T | B[N] | ) | [inline] |
Definition at line 30 of file simd_scalar.h.
References Botan::SIMD_Scalar< T, N >::size().
{ for(size_t i = 0; i != size(); ++i) m_v[i] = B[i]; }
Botan::SIMD_Scalar< T, N >::SIMD_Scalar | ( | T | B | ) | [inline] |
Definition at line 36 of file simd_scalar.h.
References Botan::SIMD_Scalar< T, N >::size().
{ for(size_t i = 0; i != size(); ++i) m_v[i] = B; }
SIMD_Scalar<T,N> Botan::SIMD_Scalar< T, N >::andc | ( | const SIMD_Scalar< T, N > & | other | ) | [inline] |
Definition at line 171 of file simd_scalar.h.
References Botan::SIMD_Scalar< T, N >::size().
{ SIMD_Scalar<T,N> out; for(size_t i = 0; i != size(); ++i) out.m_v[i] = (~m_v[i]) & other.m_v[i]; return out; }
SIMD_Scalar<T,N> Botan::SIMD_Scalar< T, N >::bswap | ( | ) | const [inline] |
Definition at line 179 of file simd_scalar.h.
References Botan::reverse_bytes(), and Botan::SIMD_Scalar< T, N >::size().
{ SIMD_Scalar<T,N> out; for(size_t i = 0; i != size(); ++i) out.m_v[i] = reverse_bytes(m_v[i]); return out; }
static bool Botan::SIMD_Scalar< T, N >::enabled | ( | ) | [inline, static] |
Definition at line 24 of file simd_scalar.h.
{ return true; }
static SIMD_Scalar<T,N> Botan::SIMD_Scalar< T, N >::load_be | ( | const void * | in | ) | [inline, static] |
Definition at line 53 of file simd_scalar.h.
References Botan::SIMD_Scalar< T, N >::size().
static SIMD_Scalar<T,N> Botan::SIMD_Scalar< T, N >::load_le | ( | const void * | in | ) | [inline, static] |
Definition at line 42 of file simd_scalar.h.
References Botan::SIMD_Scalar< T, N >::size().
SIMD_Scalar<T,N> Botan::SIMD_Scalar< T, N >::operator& | ( | const SIMD_Scalar< T, N > & | other | ) | [inline] |
Definition at line 139 of file simd_scalar.h.
{ SIMD_Scalar<T,N> out = *this; out &= other; return out; }
void Botan::SIMD_Scalar< T, N >::operator&= | ( | const SIMD_Scalar< T, N > & | other | ) | [inline] |
Definition at line 133 of file simd_scalar.h.
References Botan::SIMD_Scalar< T, N >::size().
{ for(size_t i = 0; i != size(); ++i) m_v[i] &= other.m_v[i]; }
SIMD_Scalar<T,N> Botan::SIMD_Scalar< T, N >::operator+ | ( | const SIMD_Scalar< T, N > & | other | ) | const [inline] |
Definition at line 100 of file simd_scalar.h.
{ SIMD_Scalar<T,N> out = *this; out += other; return out; }
void Botan::SIMD_Scalar< T, N >::operator+= | ( | const SIMD_Scalar< T, N > & | other | ) | [inline] |
Definition at line 88 of file simd_scalar.h.
References Botan::SIMD_Scalar< T, N >::size().
{ for(size_t i = 0; i != size(); ++i) m_v[i] += other.m_v[i]; }
SIMD_Scalar<T,N> Botan::SIMD_Scalar< T, N >::operator- | ( | const SIMD_Scalar< T, N > & | other | ) | const [inline] |
Definition at line 107 of file simd_scalar.h.
{ SIMD_Scalar<T,N> out = *this; out -= other; return out; }
void Botan::SIMD_Scalar< T, N >::operator-= | ( | const SIMD_Scalar< T, N > & | other | ) | [inline] |
Definition at line 94 of file simd_scalar.h.
References Botan::SIMD_Scalar< T, N >::size().
{ for(size_t i = 0; i != size(); ++i) m_v[i] -= other.m_v[i]; }
SIMD_Scalar<T,N> Botan::SIMD_Scalar< T, N >::operator<< | ( | size_t | shift | ) | const [inline] |
Definition at line 146 of file simd_scalar.h.
References Botan::SIMD_Scalar< T, N >::size().
{ SIMD_Scalar<T,N> out = *this; for(size_t i = 0; i != size(); ++i) out.m_v[i] <<= shift; return out; }
SIMD_Scalar<T,N> Botan::SIMD_Scalar< T, N >::operator>> | ( | size_t | shift | ) | const [inline] |
Definition at line 154 of file simd_scalar.h.
References Botan::SIMD_Scalar< T, N >::size().
{ SIMD_Scalar<T,N> out = *this; for(size_t i = 0; i != size(); ++i) out.m_v[i] >>= shift; return out; }
SIMD_Scalar<T,N> Botan::SIMD_Scalar< T, N >::operator^ | ( | const SIMD_Scalar< T, N > & | other | ) | const [inline] |
Definition at line 120 of file simd_scalar.h.
{ SIMD_Scalar<T,N> out = *this; out ^= other; return out; }
void Botan::SIMD_Scalar< T, N >::operator^= | ( | const SIMD_Scalar< T, N > & | other | ) | [inline] |
Definition at line 114 of file simd_scalar.h.
References Botan::SIMD_Scalar< T, N >::size().
{ for(size_t i = 0; i != size(); ++i) m_v[i] ^= other.m_v[i]; }
void Botan::SIMD_Scalar< T, N >::operator|= | ( | const SIMD_Scalar< T, N > & | other | ) | [inline] |
Definition at line 127 of file simd_scalar.h.
References Botan::SIMD_Scalar< T, N >::size().
{ for(size_t i = 0; i != size(); ++i) m_v[i] |= other.m_v[i]; }
SIMD_Scalar<T,N> Botan::SIMD_Scalar< T, N >::operator~ | ( | ) | const [inline] |
Definition at line 162 of file simd_scalar.h.
References Botan::SIMD_Scalar< T, N >::size().
{ SIMD_Scalar<T,N> out = *this; for(size_t i = 0; i != size(); ++i) out.m_v[i] = ~out.m_v[i]; return out; }
void Botan::SIMD_Scalar< T, N >::rotate_left | ( | size_t | rot | ) | [inline] |
Definition at line 76 of file simd_scalar.h.
References Botan::rotate_left(), and Botan::SIMD_Scalar< T, N >::size().
{ for(size_t i = 0; i != size(); ++i) m_v[i] = Botan::rotate_left(m_v[i], rot); }
void Botan::SIMD_Scalar< T, N >::rotate_right | ( | size_t | rot | ) | [inline] |
Definition at line 82 of file simd_scalar.h.
References Botan::rotate_right(), and Botan::SIMD_Scalar< T, N >::size().
{ for(size_t i = 0; i != size(); ++i) m_v[i] = Botan::rotate_right(m_v[i], rot); }
static size_t Botan::SIMD_Scalar< T, N >::size | ( | ) | [inline, static] |
Definition at line 26 of file simd_scalar.h.
Referenced by Botan::SIMD_Scalar< T, N >::andc(), Botan::SIMD_Scalar< T, N >::bswap(), Botan::SIMD_Scalar< T, N >::load_be(), Botan::SIMD_Scalar< T, N >::load_le(), Botan::SIMD_Scalar< T, N >::operator&=(), Botan::SIMD_Scalar< T, N >::operator+=(), Botan::SIMD_Scalar< T, N >::operator-=(), Botan::SIMD_Scalar< T, N >::operator<<(), Botan::SIMD_Scalar< T, N >::operator>>(), Botan::SIMD_Scalar< T, N >::operator^=(), Botan::SIMD_Scalar< T, N >::operator|=(), Botan::SIMD_Scalar< T, N >::operator~(), Botan::SIMD_Scalar< T, N >::rotate_left(), Botan::SIMD_Scalar< T, N >::rotate_right(), Botan::SIMD_Scalar< T, N >::SIMD_Scalar(), Botan::SIMD_Scalar< T, N >::store_be(), and Botan::SIMD_Scalar< T, N >::store_le().
{ return N; }
void Botan::SIMD_Scalar< T, N >::store_be | ( | byte | out[] | ) | const [inline] |
Definition at line 70 of file simd_scalar.h.
References Botan::SIMD_Scalar< T, N >::size(), and Botan::store_be().
{ for(size_t i = 0; i != size(); ++i) Botan::store_be(m_v[i], out + i*sizeof(T)); }
void Botan::SIMD_Scalar< T, N >::store_le | ( | byte | out[] | ) | const [inline] |
Definition at line 64 of file simd_scalar.h.
References Botan::SIMD_Scalar< T, N >::size(), and Botan::store_le().
{ for(size_t i = 0; i != size(); ++i) Botan::store_le(m_v[i], out + i*sizeof(T)); }
static void Botan::SIMD_Scalar< T, N >::transpose | ( | SIMD_Scalar< T, N > & | B0, |
SIMD_Scalar< T, N > & | B1, | ||
SIMD_Scalar< T, N > & | B2, | ||
SIMD_Scalar< T, N > & | B3 | ||
) | [inline, static] |
Definition at line 187 of file simd_scalar.h.
{
static_assert(N == 4, "4x4 transpose");
SIMD_Scalar<T,N> T0({B0.m_v[0], B1.m_v[0], B2.m_v[0], B3.m_v[0]});
SIMD_Scalar<T,N> T1({B0.m_v[1], B1.m_v[1], B2.m_v[1], B3.m_v[1]});
SIMD_Scalar<T,N> T2({B0.m_v[2], B1.m_v[2], B2.m_v[2], B3.m_v[2]});
SIMD_Scalar<T,N> T3({B0.m_v[3], B1.m_v[3], B2.m_v[3], B3.m_v[3]});
B0 = T0;
B1 = T1;
B2 = T2;
B3 = T3;
}