Skip to content

Commit c98b053

Browse files
[test] Simplify shuffle_test while pleasing gcc static analysis
The extra initialization is redundant with the call to std::fill, but GCC 13 seems to ignore it. And it's just tests so not performance critical.
1 parent 6b61b1a commit c98b053

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/test_shuffle.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -620,13 +620,13 @@ struct shuffle_test
620620
void transpose()
621621
{
622622
B b_lhs = B::load_unaligned(lhs.data());
623-
std::array<B, size> b_matrix;
624-
for (size_t i = 0; i < size; ++i)
625-
b_matrix[i] = b_lhs;
626-
std::array<value_type, size * size> ref_matrix;
627-
for (size_t i = 0; i < size; ++i)
628-
for (size_t j = 0; j < size; ++j)
629-
ref_matrix[i * size + j] = lhs[i];
623+
std::array<B, size> b_matrix = {}; // FIXME: useless but pleases gcc 13
624+
std::fill(b_matrix.begin(), b_matrix.end(), b_lhs);
625+
626+
std::array<value_type, size * size> ref_matrix = {}; // FIXME: useless but pleases gcc 13
627+
auto ref_matrix_iter = ref_matrix.begin();
628+
for (size_t i = 0; i < size; ++i, ref_matrix_iter += size)
629+
std::fill(ref_matrix_iter, ref_matrix_iter + size, lhs[i]);
630630

631631
INFO("transpose");
632632
xsimd::transpose(b_matrix.data(), b_matrix.data() + b_matrix.size());

0 commit comments

Comments
 (0)