summaryrefslogtreecommitdiff
path: root/ppc_simd.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2020-05-11 22:51:36 -0400
committerJeffrey Walton <noloader@gmail.com>2020-05-11 22:51:36 -0400
commit1fa7f45ee25fb015c95f43ccdaffc66fc48df691 (patch)
treecb3cd74ec44e7096e883f9322e2d10a65c15a8ba /ppc_simd.h
parent5ce8a3e7f6e0b47ffa975c4ef5a3e7d4844cd47b (diff)
downloadcryptopp-git-1fa7f45ee25fb015c95f43ccdaffc66fc48df691.tar.gz
Re-add VecReverse for PowerPC
Diffstat (limited to 'ppc_simd.h')
-rw-r--r--ppc_simd.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/ppc_simd.h b/ppc_simd.h
index 9011724d..cbe64b0e 100644
--- a/ppc_simd.h
+++ b/ppc_simd.h
@@ -230,6 +230,26 @@ inline uint32x4_p VecOne()
/// \tparam T vector type
/// \param data the vector
/// \returns vector
+/// \details VecReverseLE() reverses the bytes in a vector
+/// \par Wraps
+/// vec_perm
+/// \since Crypto++ 6.0
+template <class T>
+inline T VecReverse(const T data)
+{
+#if defined(CRYPTOPP_BIG_ENDIAN)
+ const uint8x16_p mask = {15,14,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0};
+ return (T)vec_perm(data, data, mask);
+#else
+ const uint8x16_p mask = {0,1,2,3, 4,5,6,7, 8,9,10,11, 12,13,14,15};
+ return (T)vec_perm(data, data, mask);
+#endif
+}
+
+/// \brief Reverse bytes in a vector
+/// \tparam T vector type
+/// \param data the vector
+/// \returns vector
/// \details VecReverseLE() reverses the bytes in a vector on
/// little-endian systems.
/// \par Wraps