]> git.proxmox.com Git - rustc.git/blob - vendor/packed_simd_2/src/api/math/float/abs.rs
New upstream version 1.74.1+dfsg1
[rustc.git] / vendor / packed_simd_2 / src / api / math / float / abs.rs
1 //! Implements vertical (lane-wise) floating-point `abs`.
2
3 macro_rules! impl_math_float_abs {
4 ([$elem_ty:ident; $elem_count:expr]: $id:ident | $test_tt:tt) => {
5 impl $id {
6 /// Absolute value.
7 #[inline]
8 pub fn abs(self) -> Self {
9 use crate::codegen::math::float::abs::Abs;
10 Abs::abs(self)
11 }
12 }
13
14 test_if!{
15 $test_tt:
16 paste::item! {
17 pub mod [<$id _math_abs>] {
18 use super::*;
19 #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
20 fn abs() {
21 let o = $id::splat(1 as $elem_ty);
22 assert_eq!(o, o.abs());
23
24 let mo = $id::splat(-1 as $elem_ty);
25 assert_eq!(o, mo.abs());
26 }
27 }
28 }
29 }
30 };
31 }