Skip to content

Commit 472133b

Browse files
AntoinePrvserge-sans-paille
authored andcommitted
Fix neon rhsift uint64_t
1 parent e076eb7 commit 472133b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

include/xsimd/arch/xsimd_neon.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2681,9 +2681,12 @@ namespace xsimd
26812681
}
26822682

26832683
template <class A, class T, detail::enable_sized_unsigned_t<T, 8> = 0>
2684-
XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& lhs, batch<as_signed_integer_t<T>, A> const& rhs, requires_arch<neon>) noexcept
2684+
XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<neon> req) noexcept
26852685
{
2686-
return vshlq_u64(lhs, neg(rhs, neon {}).data);
2686+
// Blindly converting to signed since out of bounds shifts are UB anyways
2687+
assert(detail::all_positive(rhs));
2688+
using S = std::make_signed_t<T>;
2689+
return vshlq_u64(lhs, neg(batch<S, A>(vreinterpretq_s64_u64(rhs)), req).data);
26872690
}
26882691

26892692
template <class A, class T, detail::enable_sized_signed_t<T, 8> = 0>

0 commit comments

Comments
 (0)