diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-07-05 15:29:45 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-07-05 15:29:45 -0400 |
commit | 95774ee7db1c9d6ac982e42f9971a3aee74b4380 (patch) | |
tree | 970b380e11bc3eacb4171fd80cf739e418f16b9e | |
parent | 24b739381a4f6dc6f36a22cb1899e4fbf1aa0f5e (diff) | |
download | vecmathlib-95774ee7db1c9d6ac982e42f9971a3aee74b4380.zip vecmathlib-95774ee7db1c9d6ac982e42f9971a3aee74b4380.tar.gz |
Improve all() and any() implementations
-rw-r--r-- | vec_sse_double2.h | 10 | ||||
-rw-r--r-- | vec_sse_float4.h | 6 |
2 files changed, 4 insertions, 12 deletions
diff --git a/vec_sse_double2.h b/vec_sse_double2.h index cc107b2..2467c7f 100644 --- a/vec_sse_double2.h +++ b/vec_sse_double2.h @@ -108,24 +108,18 @@ namespace vecmathlib { bool all() const { - // return (*this)[0] && (*this)[1]; #if defined __AVX__ return ! (! *this).any(); #else - boolvec x = *this; - x = x && _mm_shuffle_pd(x.v, x.v, _MM_SHUFFLE2(0,1)); - return x[0]; + return (*this)[0] && (*this)[1]; #endif } bool any() const { - // return (*this)[0] || (*this)[1]; #if defined __AVX__ return ! _mm_testz_pd(v, v); #else - boolvec x = *this; - x = x || _mm_shuffle_pd(x.v, x.v, _MM_SHUFFLE2(0,1)); - return x[0]; + return (*this)[0] || (*this)[1]; #endif } diff --git a/vec_sse_float4.h b/vec_sse_float4.h index dc3ecb6..b514146 100644 --- a/vec_sse_float4.h +++ b/vec_sse_float4.h @@ -117,8 +117,7 @@ namespace vecmathlib { #else boolvec x = *this; x = x && _mm_shuffle_ps(x.v, x.v, _MM_SHUFFLE(1,0,3,2)); - x = x && _mm_shuffle_ps(x.v, x.v, _MM_SHUFFLE(2,3,0,1)); - return x[0]; + return x[0] && x[2]; #endif } bool any() const @@ -129,8 +128,7 @@ namespace vecmathlib { #else boolvec x = *this; x = x || _mm_shuffle_ps(x.v, x.v, _MM_SHUFFLE(1,0,3,2)); - x = x || _mm_shuffle_ps(x.v, x.v, _MM_SHUFFLE(2,3,0,1)); - return x[0]; + return x[0] || x[2]; #endif } |