[][src]Macro safe_arch::insert_i16_from_i32_m128i

macro_rules! insert_i16_from_i32_m128i {
    ($a:expr, $i:expr, $imm:expr) => { ... };
}

Inserts the low 16 bits of an i32 value into an m128i.

The lane to get must be a constant. If you select outside the range 0..8 then the selection is wrapped to be in range (only the lowest 3 bits of the input are used).

let a = m128i::from([0xA_i16, 0xB, 0xC, 0xD, 0, 0, 0, 0]);
//
let b = insert_i16_from_i32_m128i!(a, -1, 0);
assert_eq!(<[i16; 8]>::from(b), [-1, 0xB, 0xC, 0xD, 0, 0, 0, 0]);
// the lane requested is "wrapped" to be a valid index.
assert_eq!(50 & 0b111, 2);
let c = insert_i16_from_i32_m128i!(a, -1, 50);
assert_eq!(<[i16; 8]>::from(c), [0xA, 0xB, -1, 0xD, 0, 0, 0, 0]);