diff options
-rw-r--r-- | vec_avx_fp16_16.h | 8 | ||||
-rw-r--r-- | vec_avx_fp8_32.h | 8 | ||||
-rw-r--r-- | vec_pseudo.h | 8 | ||||
-rw-r--r-- | vec_sse_double1.h | 4 | ||||
-rw-r--r-- | vec_sse_float1.h | 4 | ||||
-rw-r--r-- | vec_test.h | 8 |
6 files changed, 20 insertions, 20 deletions
diff --git a/vec_avx_fp16_16.h b/vec_avx_fp16_16.h index 5511188..e792dc8 100644 --- a/vec_avx_fp16_16.h +++ b/vec_avx_fp16_16.h @@ -122,14 +122,14 @@ namespace vecmathlib { bool all() const { - bool r = true; - for (int n=0; n<size; ++n) r = r && (*this)[n]; + bool r = (*this)[0]; + for (int n=1; n<size; ++n) r = r && (*this)[n]; return r; } bool any() const { - bool r = false; - for (int n=0; n<size; ++n) r = r || (*this)[n]; + bool r = (*this)[0];; + for (int n=1; n<size; ++n) r = r || (*this)[n]; return r; } diff --git a/vec_avx_fp8_32.h b/vec_avx_fp8_32.h index 9f28fb9..887d010 100644 --- a/vec_avx_fp8_32.h +++ b/vec_avx_fp8_32.h @@ -138,14 +138,14 @@ namespace vecmathlib { bool all() const { - bool r = true; - for (int n=0; n<size; ++n) r = r && (*this)[n]; + bool r = (*this)[0]; + for (int n=1; n<size; ++n) r = r && (*this)[n]; return r; } bool any() const { - bool r = false; - for (int n=0; n<size; ++n) r = r || (*this)[n]; + bool r = (*this)[0];; + for (int n=1; n<size; ++n) r = r || (*this)[n]; return r; } diff --git a/vec_pseudo.h b/vec_pseudo.h index 4e74379..c83322f 100644 --- a/vec_pseudo.h +++ b/vec_pseudo.h @@ -105,14 +105,14 @@ namespace vecmathlib { bool all() const { - bool res = true; - for (int d=0; d<size; ++d) res = res && v[d]; + bool res = v[0]; + for (int d=1; d<size; ++d) res = res && v[d]; return res; } bool any() const { - bool res = false; - for (int d=0; d<size; ++d) res = res || v[d]; + bool res = v[0]; + for (int d=1; d<size; ++d) res = res || v[d]; return res; } diff --git a/vec_sse_double1.h b/vec_sse_double1.h index 7ed23e5..d06cc57 100644 --- a/vec_sse_double1.h +++ b/vec_sse_double1.h @@ -94,8 +94,8 @@ namespace vecmathlib { boolvec operator==(boolvec x) const { return bool(v) == bool(x.v); } boolvec operator!=(boolvec x) const { return bool(v) != bool(x.v); } - bool all() const { return v; } - bool any() const { return v; } + bool all() const { return *this; } + bool any() const { return *this; } diff --git a/vec_sse_float1.h b/vec_sse_float1.h index a439a02..e4c8aaf 100644 --- a/vec_sse_float1.h +++ b/vec_sse_float1.h @@ -94,8 +94,8 @@ namespace vecmathlib { boolvec operator==(boolvec x) const { return bool(v) == bool(x.v); } boolvec operator!=(boolvec x) const { return bool(v) != bool(x.v); } - bool all() const { return v; } - bool any() const { return v; } + bool all() const { return *this; } + bool any() const { return *this; } @@ -102,14 +102,14 @@ namespace vecmathlib { bool all() const { - bool res = true; - for (int d=0; d<size; ++d) res = res && v[d]; + bool res = v[0]; + for (int d=1; d<size; ++d) res = res && v[d]; return res; } bool any() const { - bool res = false; - for (int d=0; d<size; ++d) res = res || v[d]; + bool res = v[0]; + for (int d=1; d<size; ++d) res = res || v[d]; return res; } |