Simplify to_int_unchecked

This commit is contained in:
Caleb Zulawski 2023-05-20 17:28:05 -04:00
parent 6626cd8249
commit f4ee1ab711

View File

@ -56,10 +56,9 @@ pub trait SimdFloat: Copy + Sealed {
/// which saturates on conversion. /// which saturates on conversion.
/// ///
/// [cast]: Simd::cast /// [cast]: Simd::cast
unsafe fn to_int_unchecked<I>(self) -> Self::Cast<I> unsafe fn to_int_unchecked<I: SimdCast>(self) -> Self::Cast<I>
where where
Self::Scalar: core::convert::FloatToInt<I> + SimdCast, Self::Scalar: core::convert::FloatToInt<I>;
I: SimdCast;
/// Raw transmutation to an unsigned integer vector type with the /// Raw transmutation to an unsigned integer vector type with the
/// same size and number of lanes. /// same size and number of lanes.
@ -263,10 +262,9 @@ fn cast<T: SimdCast>(self) -> Self::Cast<T>
#[inline] #[inline]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
unsafe fn to_int_unchecked<I>(self) -> Self::Cast<I> unsafe fn to_int_unchecked<I: SimdCast>(self) -> Self::Cast<I>
where where
Self::Scalar: core::convert::FloatToInt<I> + SimdCast, Self::Scalar: core::convert::FloatToInt<I>,
I: SimdCast,
{ {
// Safety: supported types are guaranteed by SimdCast, the caller is responsible for the extra invariants // Safety: supported types are guaranteed by SimdCast, the caller is responsible for the extra invariants
unsafe { intrinsics::simd_cast(self) } unsafe { intrinsics::simd_cast(self) }