1 use crate::simd::intrinsics;
2 use crate::simd::{LaneCount, Simd, SimdElement, SupportedLaneCount};
3 use core::ops::{Neg, Not}; // unary ops
6 ($(impl<const LANES: usize> Neg for Simd<$scalar:ty, LANES>)*) => {
7 $(impl<const LANES: usize> Neg for Simd<$scalar, LANES>
10 LaneCount<LANES>: SupportedLaneCount,
15 #[must_use = "operator returns a new vector without mutating the input"]
16 fn neg(self) -> Self::Output {
17 // Safety: `self` is a signed vector
18 unsafe { intrinsics::simd_neg(self) }
25 impl<const LANES: usize> Neg for Simd<f32, LANES>
27 impl<const LANES: usize> Neg for Simd<f64, LANES>
29 impl<const LANES: usize> Neg for Simd<i8, LANES>
31 impl<const LANES: usize> Neg for Simd<i16, LANES>
33 impl<const LANES: usize> Neg for Simd<i32, LANES>
35 impl<const LANES: usize> Neg for Simd<i64, LANES>
37 impl<const LANES: usize> Neg for Simd<isize, LANES>
41 ($(impl<const LANES: usize> Not for Simd<$scalar:ty, LANES>)*) => {
42 $(impl<const LANES: usize> Not for Simd<$scalar, LANES>
45 LaneCount<LANES>: SupportedLaneCount,
50 #[must_use = "operator returns a new vector without mutating the input"]
51 fn not(self) -> Self::Output {
52 self ^ (Simd::splat(!(0 as $scalar)))
59 impl<const LANES: usize> Not for Simd<i8, LANES>
61 impl<const LANES: usize> Not for Simd<i16, LANES>
63 impl<const LANES: usize> Not for Simd<i32, LANES>
65 impl<const LANES: usize> Not for Simd<i64, LANES>
67 impl<const LANES: usize> Not for Simd<isize, LANES>
69 impl<const LANES: usize> Not for Simd<u8, LANES>
71 impl<const LANES: usize> Not for Simd<u16, LANES>
73 impl<const LANES: usize> Not for Simd<u32, LANES>
75 impl<const LANES: usize> Not for Simd<u64, LANES>
77 impl<const LANES: usize> Not for Simd<usize, LANES>