Skip to content

Commit

Permalink
Don't rely on lvalue ref in gather test
Browse files Browse the repository at this point in the history
Refs: gh-115
Signed-off-by: Matthias Kretz <kretz@kde.org>
  • Loading branch information
mattkretz committed Mar 30, 2016
1 parent bc05b97 commit a3baffe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/gather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ TEST_TYPES(Vec, maskedGatherArray, ALL_TYPES)
}

It indexes = It::IndexesFromZero();
alignas(It::MemoryAlignment)
std::array<typename It::EntryType, It::size()> indexArray;
indexes.store(&indexArray[0], Vc::Aligned);
for_all_masks(Vec, m) {
const Vec a(mem, indexes, m);
for (size_t i = 0; i < Vec::Size; ++i) {
Expand All @@ -59,13 +62,13 @@ TEST_TYPES(Vec, maskedGatherArray, ALL_TYPES)
}

// test with array of indexes instead of index-vector:
const Vec c(mem, &indexes[0], m);
const Vec c(mem, indexArray, m);
for (size_t i = 0; i < Vec::Size; ++i) {
COMPARE(a[i], m[i] ? mem[i] : 0) << " i = " << i << ", m = " << m;
}

b = x;
b.gather(mem, &indexes[0], m);
b.gather(mem, indexArray, m);
for (size_t i = 0; i < Vec::Size; ++i) {
COMPARE(b[i], m[i] ? mem[i] : x) << " i = " << i << ", m = " << m;
}
Expand Down

0 comments on commit a3baffe

Please sign in to comment.