1#[cfg(not(all(any(target_arch = "x86", target_arch = "x86_64"), feature = "simd")))]
2#[inline(always)]
3pub fn fract(value: f32) -> f32 {
4 value - super::trunc(value)
5}
6
7#[cfg(all(any(target_arch = "x86", target_arch = "x86_64"), feature = "simd"))]
8#[inline(always)]
9pub fn fract(value: f32) -> f32 {
10 #[cfg(target_arch = "x86")]
11 use core::arch::x86::*;
12 #[cfg(target_arch = "x86_64")]
13 use core::arch::x86_64::*;
14
15 unsafe {
16 let packed: __m128 = _mm_set_ss(value);
17 _mm_cvtss_f32(_mm_sub_ps(a:packed, b:_mm_cvtepi32_ps(_mm_cvttps_epi32(packed))))
18 }
19}
20