Skip to content

Commit

Permalink
fix out of bounds index when float_v is scalar
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber authored and amadio committed May 9, 2022
1 parent dbf04af commit 96919a6
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions tests/casts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,25 +393,13 @@ TEST(fullConversion)/*{{{*/
}/*}}}*/
#endif // Vc_DEFAULT_TYPES

TEST(referenceConstruction)
TEST_TYPES(V, referenceConstruction, AllTypes)
{
float_v a = float_v::Random();
V a = V::Random();
V r(a[0]);

Vc::float_v r(a[2]);

for (size_t i = 0; i < float_v::Size; ++i) {
COMPARE(r[i], static_cast<float>(a[2])) << "i = " << i;
}
}

TEST(referenceConstructionSimdArray)
{
float_v a = float_v::Random();

Vc::SimdArray<float, Vc::float_v::size()> r2(a[2]);

for (size_t i = 0; i < float_v::Size; ++i) {
COMPARE(r2[i], static_cast<float>(a[2])) << "i = " << i;
for (size_t i = 0; i < V::Size; ++i) {
COMPARE(r[i], static_cast<float>(a[0])) << "i = " << i;
}
}

Expand Down

0 comments on commit 96919a6

Please sign in to comment.