[][src]Function safe_arch::add_horizontal_saturating_i16_m256i

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

Horizontal saturating a + b with lanes as i16.

  • The results are interleaved 128-bits at a time: a.low, b.low, a.high, b.high
let a = m256i::from([i16::MAX; 16]);
let b = m256i::from([i16::MIN; 16]);
let c: [i16; 16] = add_horizontal_saturating_i16_m256i(a, b).into();
assert_eq!(
  c,
  [
    i16::MAX, i16::MAX, i16::MAX, i16::MAX,
    i16::MIN, i16::MIN, i16::MIN, i16::MIN,
    i16::MAX, i16::MAX, i16::MAX, i16::MAX,
    i16::MIN, i16::MIN, i16::MIN, i16::MIN,
  ]
);