[−][src]Function safe_arch::sign_apply_i8_m128i
#[must_use]pub fn sign_apply_i8_m128i(a: m128i, b: m128i) -> m128i
Applies the sign of i8
values in b
to the values in a
.
- If
b
is negative: thea
value is negated. - Else If
b
is 0: thea
value becomes 0. - Else the
a
value is unchanged.
let a = m128i::from([0_i8, 1, -2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -15]); let b = m128i::from([-1_i8, 1, 1, -1, -1, 1, 1, 1, 1, 0, 0, -1, -1, 0, 0, 1]); let c: [i8; 16] = sign_apply_i8_m128i(a, b).into(); assert_eq!(c, [0_i8, 1, -2, -3, -4, 5, 6, 7, 8, 0, 0, -11, -12, 0, 0, -15]);