summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-08-08 21:48:07 -0400
committerJeffrey Walton <noloader@gmail.com>2018-08-08 21:48:07 -0400
commit13b6dac31d3f90c4b2930bcba6a90cc6cc6d4b32 (patch)
tree401310fb501e0f99e2b20dc2f5cd5f9107c66f48
parentce5b6c9e237c49d67f19ca2e30efc7aa1a2f23a5 (diff)
downloadcryptopp-git-13b6dac31d3f90c4b2930bcba6a90cc6cc6d4b32.tar.gz
Remove temporary variable
-rw-r--r--ppc-simd.h32
-rw-r--r--validat1.cpp17
2 files changed, 16 insertions, 33 deletions
diff --git a/ppc-simd.h b/ppc-simd.h
index a9c0c608..6fc52848 100644
--- a/ppc-simd.h
+++ b/ppc-simd.h
@@ -169,7 +169,6 @@ template <unsigned int C, class T>
inline T VectorShiftLeft(const T& vec)
{
const T zero = {0};
-#if CRYPTOPP_BIG_ENDIAN
if (C >= 16)
{
// Out of range
@@ -177,19 +176,12 @@ inline T VectorShiftLeft(const T& vec)
}
else
{
- return (T)vec_sld((uint8x16_p)vec, (uint8x16_p)zero, C);
- }
+#if CRYPTOPP_BIG_ENDIAN
+ return (T)vec_sld((uint8x16_p)vec, (uint8x16_p)zero, C);
#else
- if (C >= 16)
- {
- // Out of range
- return zero;
- }
- else
- {
- return (T)vec_sld((uint8x16_p)zero, (uint8x16_p)vec, 16-C);
- }
+ return (T)vec_sld((uint8x16_p)zero, (uint8x16_p)vec, 16-C);
#endif
+ }
}
// Full specializations for 0 over uint8x16_p to uint64x2_p
@@ -238,7 +230,6 @@ template <unsigned int C, class T>
inline T VectorShiftRight(const T& vec)
{
const T zero = {0};
-#if CRYPTOPP_BIG_ENDIAN
if (C >= 16)
{
// Out of range
@@ -246,19 +237,12 @@ inline T VectorShiftRight(const T& vec)
}
else
{
- return (T)vec_sld((uint8x16_p)zero, (uint8x16_p)vec, 16-C);
- }
+#if CRYPTOPP_BIG_ENDIAN
+ return (T)vec_sld((uint8x16_p)zero, (uint8x16_p)vec, 16-C);
#else
- if (C >= 16)
- {
- // Out of range
- return zero;
- }
- else
- {
- return (T)vec_sld((uint8x16_p)vec, (uint8x16_p)zero, C);
- }
+ return (T)vec_sld((uint8x16_p)vec, (uint8x16_p)zero, C);
#endif
+ }
}
// Full specializations for 0 over uint8x16_p to uint64x2_p
diff --git a/validat1.cpp b/validat1.cpp
index 93cb9986..4a602425 100644
--- a/validat1.cpp
+++ b/validat1.cpp
@@ -1141,11 +1141,10 @@ bool TestAltivecOps()
uint8x16_p val = {0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff};
- uint8x16_p t;
- pass2 = (VectorEqual(val, t=VectorShiftLeft<0>(val))) && pass2;
+ pass2 = (VectorEqual(val, VectorShiftLeft<0>(val))) && pass2;
CRYPTOPP_ASSERT(pass2);
- pass2 = (VectorEqual(val, t=VectorShiftRight<0>(val))) && pass2;
+ pass2 = (VectorEqual(val, VectorShiftRight<0>(val))) && pass2;
CRYPTOPP_ASSERT(pass2);
uint8x16_p lsh1 = {0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,
@@ -1153,9 +1152,9 @@ bool TestAltivecOps()
uint8x16_p rsh1 = {0x00,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff};
- pass2 = (VectorEqual(lsh1, t=VectorShiftLeft<1>(val))) && pass2;
+ pass2 = (VectorEqual(lsh1, VectorShiftLeft<1>(val))) && pass2;
CRYPTOPP_ASSERT(pass2);
- pass2 = (VectorEqual(rsh1, t=VectorShiftRight<1>(val))) && pass2;
+ pass2 = (VectorEqual(rsh1, VectorShiftRight<1>(val))) && pass2;
CRYPTOPP_ASSERT(pass2);
uint8x16_p lsh15 = {0xff,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,
@@ -1163,9 +1162,9 @@ bool TestAltivecOps()
uint8x16_p rsh15 = {0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0xff};
- pass2 = (VectorEqual(lsh15, t=VectorShiftLeft<15>(val))) && pass2;
+ pass2 = (VectorEqual(lsh15, VectorShiftLeft<15>(val))) && pass2;
CRYPTOPP_ASSERT(pass2);
- pass2 = (VectorEqual(rsh15, t=VectorShiftRight<15>(val))) && pass2;
+ pass2 = (VectorEqual(rsh15, VectorShiftRight<15>(val))) && pass2;
CRYPTOPP_ASSERT(pass2);
uint8x16_p lsh16 = {0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,
@@ -1173,9 +1172,9 @@ bool TestAltivecOps()
uint8x16_p rsh16 = {0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00};
- pass2 = (VectorEqual(lsh16, t=VectorShiftLeft<16>(val))) && pass2;
+ pass2 = (VectorEqual(lsh16, VectorShiftLeft<16>(val))) && pass2;
CRYPTOPP_ASSERT(pass2);
- pass2 = (VectorEqual(rsh16, t=VectorShiftRight<16>(val))) && pass2;
+ pass2 = (VectorEqual(rsh16, VectorShiftRight<16>(val))) && pass2;
CRYPTOPP_ASSERT(pass2);
if (!pass2)