@@ -7,6 +7,7 @@ use core::ops::{Shl, Shr};
77
88mod assign;
99mod deref;
10+ mod unary;
1011
1112impl < I , T , const LANES : usize > core:: ops:: Index < I > for Simd < T , LANES >
1213where
@@ -65,25 +66,6 @@ macro_rules! impl_ref_ops {
6566 fn $fn( $self_tok, $rhs_arg: $rhs_arg_ty) -> Self :: Output $body
6667 }
6768 } ;
68-
69- // unary op
70- {
71- impl <const $lanes: ident: usize > core:: ops:: $trait: ident for $type: ty
72- where
73- LaneCount <$lanes2: ident>: SupportedLaneCount ,
74- {
75- type Output = $output: ty;
76- fn $fn: ident( $self_tok: ident) -> Self :: Output $body: tt
77- }
78- } => {
79- impl <const $lanes: usize > core:: ops:: $trait for $type
80- where
81- LaneCount <$lanes2>: SupportedLaneCount ,
82- {
83- type Output = $output;
84- fn $fn( $self_tok) -> Self :: Output $body
85- }
86- }
8769}
8870
8971/// Automatically implements operators over vectors and scalars for a particular vector.
@@ -119,34 +101,6 @@ macro_rules! impl_op {
119101 impl_op! { @binary $scalar, BitXor :: bitxor, simd_xor }
120102 } ;
121103
122- { impl Not for $scalar: ty } => {
123- impl_ref_ops! {
124- impl <const LANES : usize > core:: ops:: Not for Simd <$scalar, LANES >
125- where
126- LaneCount <LANES >: SupportedLaneCount ,
127- {
128- type Output = Self ;
129- fn not( self ) -> Self :: Output {
130- self ^ Self :: splat( !<$scalar>:: default ( ) )
131- }
132- }
133- }
134- } ;
135-
136- { impl Neg for $scalar: ty } => {
137- impl_ref_ops! {
138- impl <const LANES : usize > core:: ops:: Neg for Simd <$scalar, LANES >
139- where
140- LaneCount <LANES >: SupportedLaneCount ,
141- {
142- type Output = Self ;
143- fn neg( self ) -> Self :: Output {
144- unsafe { intrinsics:: simd_neg( self ) }
145- }
146- }
147- }
148- } ;
149-
150104 // generic binary op with assignment when output is `Self`
151105 { @binary $scalar: ty, $trait: ident :: $trait_fn: ident, $intrinsic: ident } => {
152106 impl_ref_ops! {
@@ -204,7 +158,6 @@ macro_rules! impl_float_ops {
204158 impl_op! { impl Mul for $scalar }
205159 impl_op! { impl Div for $scalar }
206160 impl_op! { impl Rem for $scalar }
207- impl_op! { impl Neg for $scalar }
208161 ) *
209162 } ;
210163}
@@ -219,7 +172,6 @@ macro_rules! impl_unsigned_int_ops {
219172 impl_op! { impl BitAnd for $scalar }
220173 impl_op! { impl BitOr for $scalar }
221174 impl_op! { impl BitXor for $scalar }
222- impl_op! { impl Not for $scalar }
223175
224176 // Integers panic on divide by 0
225177 impl_ref_ops! {
@@ -441,9 +393,6 @@ macro_rules! impl_unsigned_int_ops {
441393macro_rules! impl_signed_int_ops {
442394 { $( $scalar: ty) ,* } => {
443395 impl_unsigned_int_ops! { $( $scalar) ,* }
444- $( // scalar
445- impl_op! { impl Neg for $scalar }
446- ) *
447396 } ;
448397}
449398
0 commit comments