2021-07-19 19:13:24 -04:00
|
|
|
#![feature(portable_simd)]
|
2022-03-11 00:12:40 +01:00
|
|
|
use core_simd::i16x2;
|
2021-07-19 19:13:24 -04:00
|
|
|
|
2021-02-13 14:19:16 -05:00
|
|
|
#[macro_use]
|
2021-02-13 15:42:04 -05:00
|
|
|
mod ops_macros;
|
2021-08-07 20:38:41 +00:00
|
|
|
impl_signed_tests! { i16 }
|
2022-03-11 00:12:40 +01:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn max_is_not_lexicographic() {
|
|
|
|
let a = i16x2::splat(10);
|
|
|
|
let b = i16x2::from_array([-4, 12]);
|
|
|
|
assert_eq!(a.max(b), i16x2::from_array([10, 12]));
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn min_is_not_lexicographic() {
|
|
|
|
let a = i16x2::splat(10);
|
|
|
|
let b = i16x2::from_array([12, -4]);
|
|
|
|
assert_eq!(a.min(b), i16x2::from_array([10, -4]));
|
|
|
|
}
|
2022-03-12 18:32:28 -05:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn clamp_is_not_lexicographic() {
|
|
|
|
let a = i16x2::splat(10);
|
|
|
|
let lo = i16x2::from_array([-12, -4]);
|
|
|
|
let up = i16x2::from_array([-4, 12]);
|
|
|
|
assert_eq!(a.clamp(lo, up), i16x2::from_array([-4, 10]));
|
|
|
|
|
|
|
|
let x = i16x2::from_array([1, 10]);
|
|
|
|
let y = x.clamp(i16x2::splat(0), i16x2::splat(9));
|
|
|
|
assert_eq!(y, i16x2::from_array([1, 9]));
|
|
|
|
}
|