Skip to content

Commit e235ad1

Browse files
Make sure shuffle and swizzle constant mask indices are unsigned
Fix #1135
1 parent a64668d commit e235ad1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

include/xsimd/types/xsimd_api.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,6 +2124,7 @@ namespace xsimd
21242124
shuffle(batch<T, A> const& x, batch<T, A> const& y, batch_constant<Vt, A, Values...> mask) noexcept
21252125
{
21262126
static_assert(sizeof(T) == sizeof(Vt), "consistent mask");
2127+
static_assert(std::is_unsigned<Vt>::value, "mask must hold unsigned indices");
21272128
detail::static_check_supported_config<T, A>();
21282129
return kernel::shuffle<A>(x, y, mask, A {});
21292130
}
@@ -2433,6 +2434,7 @@ namespace xsimd
24332434
XSIMD_INLINE batch<std::complex<T>, A> swizzle(batch<std::complex<T>, A> const& x, batch_constant<Vt, A, Values...> mask) noexcept
24342435
{
24352436
static_assert(sizeof(T) == sizeof(Vt), "consistent mask");
2437+
static_assert(std::is_unsigned<Vt>::value, "mask must hold unsigned indices");
24362438
detail::static_check_supported_config<T, A>();
24372439
return kernel::swizzle<A>(x, mask, A {});
24382440
}

0 commit comments

Comments
 (0)