[][src]Function safe_arch::pack_i16_to_u8_m256i

#[must_use]pub fn pack_i16_to_u8_m256i(a: m256i, b: m256i) -> m256i
This is supported with target feature avx2 only.

Saturating convert i16 to u8, and pack the values.

  • The values are packed 128 bits at a time: a_low, b_low, a_high, b_high
let a =
  m256i::from([1_i16, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
let b = m256i::from([
  17_i16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
]);
let c: [u8; 32] = pack_i16_to_u8_m256i(a, b).into();
assert_eq!(
  c,
  [
    1_u8, 2, 3, 4, 5, 6, 7, 8, 17, 18, 19, 20, 21, 22, 23, 24, 9, 10, 11, 12,
    13, 14, 15, 16, 25, 26, 27, 28, 29, 30, 31, 32
  ]
);