mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2025-02-17 03:48:38 +00:00
Update comments
This commit is contained in:
parent
194307308c
commit
a4ebb75538
12
gcm-simd.cpp
12
gcm-simd.cpp
@ -168,9 +168,10 @@ using CryptoPP::uint64x2_p;
|
||||
using CryptoPP::VectorAnd;
|
||||
using CryptoPP::VectorShiftRight;
|
||||
|
||||
// _mm_clmulepi64_si128(a, b, 0x00)
|
||||
// High dwords of 'a' and 'b' are masked out.
|
||||
inline uint64x2_p VMULL_00(uint64x2_p a, uint64x2_p b)
|
||||
{
|
||||
// Multiplies low dwords
|
||||
#if defined(__xlc__) || defined(__xlC__)
|
||||
const uint64x2_p m = {0xffffffffffffffffull, 0};
|
||||
return __vpmsumd (VectorAnd(a, m), VectorAnd(b, m));
|
||||
@ -180,9 +181,10 @@ inline uint64x2_p VMULL_00(uint64x2_p a, uint64x2_p b)
|
||||
#endif
|
||||
}
|
||||
|
||||
// _mm_clmulepi64_si128(a, b, 0x01)
|
||||
// High dword of 'a' is masked out. High dword of 'b' is shifted down.
|
||||
inline uint64x2_p VMULL_01(uint64x2_p a, uint64x2_p b)
|
||||
{
|
||||
// Multiplies high and low dwords
|
||||
#if defined(__xlc__) || defined(__xlC__)
|
||||
const uint64x2_p m = {0xffffffffffffffffull, 0};
|
||||
return __vpmsumd (VectorAnd(a, m), VectorShiftRight<8>(b));
|
||||
@ -192,9 +194,10 @@ inline uint64x2_p VMULL_01(uint64x2_p a, uint64x2_p b)
|
||||
#endif
|
||||
}
|
||||
|
||||
// _mm_clmulepi64_si128(a, b, 0x10)
|
||||
// High dword of 'a' is shifted down. High dword of 'b' is masked out.
|
||||
inline uint64x2_p VMULL_10(uint64x2_p a, uint64x2_p b)
|
||||
{
|
||||
// Multiplies high and low dwords
|
||||
#if defined(__xlc__) || defined(__xlC__)
|
||||
const uint64x2_p m = {0xffffffffffffffffull, 0};
|
||||
return __vpmsumd (VectorShiftRight<8>(a), VectorAnd(b, m));
|
||||
@ -204,9 +207,10 @@ inline uint64x2_p VMULL_10(uint64x2_p a, uint64x2_p b)
|
||||
#endif
|
||||
}
|
||||
|
||||
// _mm_clmulepi64_si128(a, b, 0x11)
|
||||
// Low dwords of 'a' and 'b' are masked out.
|
||||
inline uint64x2_p VMULL_11(uint64x2_p a, uint64x2_p b)
|
||||
{
|
||||
// Multiplies high dwords
|
||||
#if defined(__xlc__) || defined(__xlC__)
|
||||
const uint64x2_p m = {0, 0xffffffffffffffffull};
|
||||
return __vpmsumd (VectorAnd(a, m), VectorAnd(b, m));
|
||||
|
14
ppc-simd.h
14
ppc-simd.h
@ -90,6 +90,20 @@ inline T1 VectorPermute(const T1& vec1, const T1& vec2, const T2& mask)
|
||||
return (T1)vec_perm(vec1, vec2, (uint8x16_p)mask);
|
||||
}
|
||||
|
||||
/// \brief AND two vectors
|
||||
/// \tparam T1 vector type
|
||||
/// \tparam T2 vector type
|
||||
/// \param vec1 the first vector
|
||||
/// \param vec2 the second vector
|
||||
/// \details VectorAnd returns a new vector from vec1 and vec2. The return
|
||||
/// vector is the same type as vec1.
|
||||
/// \since Crypto++ 6.0
|
||||
template <class T1, class T2>
|
||||
inline T1 VectorAnd(const T1& vec1, const T2& vec2)
|
||||
{
|
||||
return (T1)vec_and(vec1, (T1)vec2);
|
||||
}
|
||||
|
||||
/// \brief XOR two vectors
|
||||
/// \tparam T1 vector type
|
||||
/// \tparam T2 vector type
|
||||
|
Loading…
x
Reference in New Issue
Block a user