Skip to content

Commit

Permalink
Fix MaskBool initialization on SSE
Browse files Browse the repository at this point in the history
  • Loading branch information
amyspark committed Sep 2, 2021
1 parent 811e2ee commit 9130778
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Vc/sse/mask.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef VC_SSE_MASK_H_
#define VC_SSE_MASK_H_

#include <cmath>

#include "intrinsics.h"
#include "../common/maskbool.h"
#include "detail.h"
Expand Down Expand Up @@ -222,7 +224,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
9 changes: 9 additions & 0 deletions tests/mask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,15 @@ 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;
VERIFY(r[0] == true);
}

/*}}}*/

// vim: foldmethod=marker

0 comments on commit 9130778

Please sign in to comment.