Skip to content

Commit 1d3c8fd

Browse files
committed
Use max
1 parent 0b9c4e7 commit 1d3c8fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libc/src/__support/CPP/simd.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,19 @@ LIBC_INLINE constexpr static auto extend(cpp::simd<T, N> x) {
8989
template <typename T, size_t N, size_t M, size_t... Indices>
9090
LIBC_INLINE constexpr static cpp::simd<T, N + M>
9191
concat(cpp::simd<T, N> x, cpp::simd<T, M> y, cpp::index_sequence<Indices...>) {
92-
constexpr size_t Length = (N > M ? N : M);
92+
constexpr size_t Size = cpp::max(N, M);
9393
auto remap = [](size_t idx) -> int {
9494
if (idx < N)
9595
return static_cast<int>(idx);
9696
if (idx < N + M)
97-
return static_cast<int>((idx - N) + Length);
97+
return static_cast<int>((idx - N) + Size);
9898
return -1;
9999
};
100100

101101
// Extend the input vectors until they are the same size, then use the indices
102102
// to shuffle in only the indices that correspond to the original values.
103-
auto x_ext = extend<T, N, Length, N>(x);
104-
auto y_ext = extend<T, M, Length, M>(y);
103+
auto x_ext = extend<T, N, Size, N>(x);
104+
auto y_ext = extend<T, M, Size, M>(y);
105105
return __builtin_shufflevector(x_ext, y_ext, remap(Indices)...);
106106
}
107107

0 commit comments

Comments
 (0)