1 use crate::simd::intrinsics;
2 use crate::simd::{LaneCount, Simd, SupportedLaneCount};
4 macro_rules! implement {
8 impl<const LANES: usize> Simd<$type, LANES>
10 LaneCount<LANES>: SupportedLaneCount,
12 /// Rounds toward zero and converts to the same-width integer type, assuming that
13 /// the value is finite and fits in that type.
20 /// * Be representable in the return type, after truncating off its fractional part
22 pub unsafe fn to_int_unchecked(self) -> Simd<$int_type, LANES> {
23 unsafe { intrinsics::simd_cast(self) }
26 /// Creates a floating-point vector from an integer vector. Rounds values that are
27 /// not exactly representable.
29 pub fn round_from_int(value: Simd<$int_type, LANES>) -> Self {
30 unsafe { intrinsics::simd_cast(value) }
36 implement! { f32, i32 }
37 implement! { f64, i64 }