@@ -118,34 +118,6 @@ macro_rules! impl_op {
118118 }
119119 }
120120 }
121-
122- impl_ref_ops! {
123- impl <const LANES : usize > core:: ops:: $trait<$scalar> for Simd <$scalar, LANES >
124- where
125- LaneCount <LANES >: SupportedLaneCount ,
126- {
127- type Output = Self ;
128-
129- #[ inline]
130- fn $trait_fn( self , rhs: $scalar) -> Self :: Output {
131- core:: ops:: $trait:: $trait_fn( self , Self :: splat( rhs) )
132- }
133- }
134- }
135-
136- impl_ref_ops! {
137- impl <const LANES : usize > core:: ops:: $trait<Simd <$scalar, LANES >> for $scalar
138- where
139- LaneCount <LANES >: SupportedLaneCount ,
140- {
141- type Output = Simd <$scalar, LANES >;
142-
143- #[ inline]
144- fn $trait_fn( self , rhs: Simd <$scalar, LANES >) -> Self :: Output {
145- core:: ops:: $trait:: $trait_fn( Simd :: splat( self ) , rhs)
146- }
147- }
148- }
149121 } ;
150122}
151123
@@ -202,43 +174,6 @@ macro_rules! impl_unsigned_int_ops {
202174 }
203175 }
204176
205- impl_ref_ops! {
206- impl <const LANES : usize > core:: ops:: Div <$scalar> for Simd <$scalar, LANES >
207- where
208- LaneCount <LANES >: SupportedLaneCount ,
209- {
210- type Output = Self ;
211-
212- #[ inline]
213- fn div( self , rhs: $scalar) -> Self :: Output {
214- if rhs == 0 {
215- panic!( "attempt to divide by zero" ) ;
216- }
217- if <$scalar>:: MIN != 0 &&
218- self . as_array( ) . iter( ) . any( |x| * x == <$scalar>:: MIN ) &&
219- rhs == -1 as _ {
220- panic!( "attempt to divide with overflow" ) ;
221- }
222- let rhs = Self :: splat( rhs) ;
223- unsafe { intrinsics:: simd_div( self , rhs) }
224- }
225- }
226- }
227-
228- impl_ref_ops! {
229- impl <const LANES : usize > core:: ops:: Div <Simd <$scalar, LANES >> for $scalar
230- where
231- LaneCount <LANES >: SupportedLaneCount ,
232- {
233- type Output = Simd <$scalar, LANES >;
234-
235- #[ inline]
236- fn div( self , rhs: Simd <$scalar, LANES >) -> Self :: Output {
237- Simd :: splat( self ) / rhs
238- }
239- }
240- }
241-
242177 // remainder panics on zero divisor
243178 impl_ref_ops! {
244179 impl <const LANES : usize > core:: ops:: Rem <Self > for Simd <$scalar, LANES >
@@ -268,43 +203,6 @@ macro_rules! impl_unsigned_int_ops {
268203 }
269204 }
270205
271- impl_ref_ops! {
272- impl <const LANES : usize > core:: ops:: Rem <$scalar> for Simd <$scalar, LANES >
273- where
274- LaneCount <LANES >: SupportedLaneCount ,
275- {
276- type Output = Self ;
277-
278- #[ inline]
279- fn rem( self , rhs: $scalar) -> Self :: Output {
280- if rhs == 0 {
281- panic!( "attempt to calculate the remainder with a divisor of zero" ) ;
282- }
283- if <$scalar>:: MIN != 0 &&
284- self . as_array( ) . iter( ) . any( |x| * x == <$scalar>:: MIN ) &&
285- rhs == -1 as _ {
286- panic!( "attempt to calculate the remainder with overflow" ) ;
287- }
288- let rhs = Self :: splat( rhs) ;
289- unsafe { intrinsics:: simd_rem( self , rhs) }
290- }
291- }
292- }
293-
294- impl_ref_ops! {
295- impl <const LANES : usize > core:: ops:: Rem <Simd <$scalar, LANES >> for $scalar
296- where
297- LaneCount <LANES >: SupportedLaneCount ,
298- {
299- type Output = Simd <$scalar, LANES >;
300-
301- #[ inline]
302- fn rem( self , rhs: Simd <$scalar, LANES >) -> Self :: Output {
303- Simd :: splat( self ) % rhs
304- }
305- }
306- }
307-
308206 // shifts panic on overflow
309207 impl_ref_ops! {
310208 impl <const LANES : usize > core:: ops:: Shl <Self > for Simd <$scalar, LANES >
@@ -328,24 +226,6 @@ macro_rules! impl_unsigned_int_ops {
328226 }
329227 }
330228
331- impl_ref_ops! {
332- impl <const LANES : usize > core:: ops:: Shl <$scalar> for Simd <$scalar, LANES >
333- where
334- LaneCount <LANES >: SupportedLaneCount ,
335- {
336- type Output = Self ;
337-
338- #[ inline]
339- fn shl( self , rhs: $scalar) -> Self :: Output {
340- if invalid_shift_rhs( rhs) {
341- panic!( "attempt to shift left with overflow" ) ;
342- }
343- let rhs = Self :: splat( rhs) ;
344- unsafe { intrinsics:: simd_shl( self , rhs) }
345- }
346- }
347- }
348-
349229 impl_ref_ops! {
350230 impl <const LANES : usize > core:: ops:: Shr <Self > for Simd <$scalar, LANES >
351231 where
@@ -367,24 +247,6 @@ macro_rules! impl_unsigned_int_ops {
367247 }
368248 }
369249 }
370-
371- impl_ref_ops! {
372- impl <const LANES : usize > core:: ops:: Shr <$scalar> for Simd <$scalar, LANES >
373- where
374- LaneCount <LANES >: SupportedLaneCount ,
375- {
376- type Output = Self ;
377-
378- #[ inline]
379- fn shr( self , rhs: $scalar) -> Self :: Output {
380- if invalid_shift_rhs( rhs) {
381- panic!( "attempt to shift with overflow" ) ;
382- }
383- let rhs = Self :: splat( rhs) ;
384- unsafe { intrinsics:: simd_shr( self , rhs) }
385- }
386- }
387- }
388250 ) *
389251 } ;
390252}
0 commit comments