@@ -7,6 +7,7 @@ use core::ops::{Shl, Shr};
7
7
8
8
mod assign;
9
9
mod deref;
10
+ mod unary;
10
11
11
12
impl < I , T , const LANES : usize > core:: ops:: Index < I > for Simd < T , LANES >
12
13
where
@@ -65,25 +66,6 @@ macro_rules! impl_ref_ops {
65
66
fn $fn( $self_tok, $rhs_arg: $rhs_arg_ty) -> Self :: Output $body
66
67
}
67
68
} ;
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
- }
87
69
}
88
70
89
71
/// Automatically implements operators over vectors and scalars for a particular vector.
@@ -119,34 +101,6 @@ macro_rules! impl_op {
119
101
impl_op! { @binary $scalar, BitXor :: bitxor, simd_xor }
120
102
} ;
121
103
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
-
150
104
// generic binary op with assignment when output is `Self`
151
105
{ @binary $scalar: ty, $trait: ident :: $trait_fn: ident, $intrinsic: ident } => {
152
106
impl_ref_ops! {
@@ -204,7 +158,6 @@ macro_rules! impl_float_ops {
204
158
impl_op! { impl Mul for $scalar }
205
159
impl_op! { impl Div for $scalar }
206
160
impl_op! { impl Rem for $scalar }
207
- impl_op! { impl Neg for $scalar }
208
161
) *
209
162
} ;
210
163
}
@@ -219,7 +172,6 @@ macro_rules! impl_unsigned_int_ops {
219
172
impl_op! { impl BitAnd for $scalar }
220
173
impl_op! { impl BitOr for $scalar }
221
174
impl_op! { impl BitXor for $scalar }
222
- impl_op! { impl Not for $scalar }
223
175
224
176
// Integers panic on divide by 0
225
177
impl_ref_ops! {
@@ -441,9 +393,6 @@ macro_rules! impl_unsigned_int_ops {
441
393
macro_rules! impl_signed_int_ops {
442
394
{ $( $scalar: ty) ,* } => {
443
395
impl_unsigned_int_ops! { $( $scalar) ,* }
444
- $( // scalar
445
- impl_op! { impl Neg for $scalar }
446
- ) *
447
396
} ;
448
397
}
449
398
0 commit comments