Function safe_arch::insert_f32_imm_m128

source ·
pub fn insert_f32_imm_m128<const IMM: i32>(a: m128, b: m128) -> m128
Available with target feature sse4.1 only.
Expand description

Inserts a lane from $b into $a, optionally at a new position.

Also, you can zero out any lanes you like for free as part of the same operation. If you don’t specify the mask argument then no lanes are zeroed.

let a = m128::from_array([1.0, 2.0, 3.0, 4.0]);
let b = m128::from_array([5.0, 6.0, 7.0, 8.0]);
//
let c = insert_f32_imm_m128::<0b00_11_0000>(a, b).to_array();
assert_eq!(c, [1.0, 2.0, 3.0, 5.0]);
//
let c = insert_f32_imm_m128::<0b00_11_0110>(a, b).to_array();
assert_eq!(c, [1.0, 0.0, 0.0, 5.0]);