Function core::arch::x86::_mm_extract_ps1.27.0[][src]

pub unsafe fn _mm_extract_ps<const IMM8: i32>(a: __m128) -> i32
This is supported on x86 and target feature sse4.1 only.
Expand description

Extracts a single-precision (32-bit) floating-point element from a, selected with IMM8. The returned i32 stores the float’s bit-pattern, and may be converted back to a floating point number via casting.

Example

let mut float_store = vec![1.0, 1.0, 2.0, 3.0];
unsafe {
    let simd_floats = _mm_set_ps(2.5, 5.0, 7.5, 10.0);
    let x: i32 = _mm_extract_ps::<2>(simd_floats);
    float_store.push(f32::from_bits(x as u32));
}
assert_eq!(float_store, vec![1.0, 1.0, 2.0, 3.0, 5.0]);
Run

Intel’s documentation