Skip to content

Commit

Permalink
Fix MaskBool initialization on SSE
Browse files Browse the repository at this point in the history
Fixes #255
  • Loading branch information
amyspark authored and amadio committed Sep 3, 2021
1 parent 811e2ee commit b84dcd0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Vc/sse/mask.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ template <typename T> class Mask<T, VectorAbi::Sse>
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 <typename U>
static Vc_INTRINSIC void set(Mask &m, int i,
Expand Down
11 changes: 11 additions & 0 deletions tests/mask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b84dcd0

Please sign in to comment.