diff --git a/sha-simd.cpp b/sha-simd.cpp index be4ef2aa..765a8ed7 100644 --- a/sha-simd.cpp +++ b/sha-simd.cpp @@ -1063,8 +1063,7 @@ static inline uint32x4_p8 VectorMaj(const uint32x4_p8 x, const uint32x4_p8 y, const uint32x4_p8 z) { // The trick below is due to Andy Polyakov and Jack Lloyd - const uint32x4_p8 xy = vec_xor(x, y); - return vec_sel(y, z, xy); + return vec_sel(y, z, vec_xor(x, y)); } static inline @@ -1112,10 +1111,8 @@ uint32x4_p8 VectorPack(const uint32x4_p8 a, const uint32x4_p8 b, const uint32x4_p8 c, const uint32x4_p8 d) { const uint8x16_p8 m1 = {0,1,2,3, 16,17,18,19, 0,0,0,0, 0,0,0,0}; - const uint8x16_p8 m2 = {0,1,2,3, 4,5,6,7, 16,17,18,19, 0,0,0,0}; - const uint8x16_p8 m3 = {0,1,2,3, 4,5,6,7, 8,9,10,11, 16,17,18,19}; - - return vec_perm(vec_perm(vec_perm(a,b,m1),c,m2),d,m3); + const uint8x16_p8 m2 = {0,1,2,3, 4,5,6,7, 16,17,18,19, 20,21,22,23}; + return vec_perm(vec_perm(a,b,m1), vec_perm(c,d,m1), m2); } template static inline @@ -1373,8 +1370,7 @@ static inline uint64x2_p8 VectorMaj(const uint64x2_p8 x, const uint64x2_p8 y, const uint64x2_p8 z) { // The trick below is due to Andy Polyakov and Jack Lloyd - const uint64x2_p8 xy = vec_xor(x, y); - return vec_sel(y, z, xy); + return vec_sel(y, z, vec_xor(x, y)); } static inline