From b84dcd0a65d8dc5de6a2bd4d367882b3748f812c Mon Sep 17 00:00:00 2001 From: "L. E. Segovia" Date: Thu, 2 Sep 2021 23:11:45 +0000 Subject: [PATCH] Fix MaskBool initialization on SSE Fixes VcDevel/Vc#255 --- Vc/sse/mask.h | 2 +- tests/mask.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Vc/sse/mask.h b/Vc/sse/mask.h index 23c1ec2b1..42596a928 100644 --- a/Vc/sse/mask.h +++ b/Vc/sse/mask.h @@ -222,7 +222,7 @@ template class Mask friend reference; static Vc_INTRINSIC Vc_PURE value_type get(const Mask &m, int i) noexcept { - return MaskBool(m.d.m(i)); + return m.toInt() & (1 << i); } template static Vc_INTRINSIC void set(Mask &m, int i, diff --git a/tests/mask.cpp b/tests/mask.cpp index 0523c1c06..ca3f1e320 100644 --- a/tests/mask.cpp +++ b/tests/mask.cpp @@ -478,6 +478,17 @@ TEST_TYPES(V, testCompareOperators, AllVectors) /*{{{*/ VERIFY(!(k2 != k2)) << k << k2; } } + +TEST_TYPES(V, testMaskDefined, AllVectors) +{ + V a(1); + V b(2); + auto r = a < b; + auto s = a > b; + VERIFY(r[0] == true); + VERIFY(s[0] == false); +} + /*}}}*/ // vim: foldmethod=marker