Skip to content

Commit 600be41

Browse files
jan-wassenbergcopybara-github
authored andcommitted
gcc8 fixes (casts, negate directly)
PiperOrigin-RevId: 502904327
1 parent 1ce5013 commit 600be41

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

hwy/tests/reduction_test.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ struct TestSumOfLanes {
3535
template <typename T, size_t N, int P,
3636
hwy::EnableIf<IsSigned<T>() && ((N & 1) == 0)>* = nullptr>
3737
HWY_NOINLINE void SignedEvenLengthVectorTests(Simd<T, N, P> d) {
38-
const T pairs = static_cast<T>(Lanes(d)) / static_cast<T>(2);
38+
const T pairs = static_cast<T>(Lanes(d)) / T{2};
3939

4040
// Lanes are the repeated sequence -2, 1, [...]; each pair sums to -1,
4141
// so the eventual total is just -(N/2).
4242
Vec<decltype(d)> v =
43-
InterleaveLower(Set(d, static_cast<T>(-2)), Set(d, static_cast<T>(1)));
44-
HWY_ASSERT_VEC_EQ(d, Set(d, pairs * static_cast<T>(-1)), SumOfLanes(d, v));
43+
InterleaveLower(Set(d, static_cast<T>(-2)), Set(d, T{1}));
44+
HWY_ASSERT_VEC_EQ(d, Set(d, static_cast<T>(-pairs)), SumOfLanes(d, v));
4545

4646
// Similar test with a positive result.
47-
v = InterleaveLower(Set(d, static_cast<T>(-2)), Set(d, static_cast<T>(4)));
48-
HWY_ASSERT_VEC_EQ(d, Set(d, pairs * static_cast<T>(2)), SumOfLanes(d, v));
47+
v = InterleaveLower(Set(d, static_cast<T>(-2)), Set(d, T{4}));
48+
HWY_ASSERT_VEC_EQ(d, Set(d, static_cast<T>(pairs * 2)), SumOfLanes(d, v));
4949
}
5050

5151
template <typename T, class D>

0 commit comments

Comments
 (0)