@@ -228,22 +228,16 @@ pub(crate) trait FloatSIMDUtils {
228228 // value, not by retaining the binary representation.
229229 type UInt ;
230230 fn cast_from_int ( i : Self :: UInt ) -> Self ;
231+ }
231232
233+ #[ cfg( test) ]
234+ pub ( crate ) trait FloatSIMDScalarUtils : FloatSIMDUtils {
232235 type Scalar ;
236+
233237 fn replace ( self , index : usize , new_value : Self :: Scalar ) -> Self ;
234238 fn extract ( self , index : usize ) -> Self :: Scalar ;
235239}
236240
237- /// Implement functions available in std builds but missing from core primitives
238- #[ cfg( not( std) ) ]
239- // False positive: We are following `std` here.
240- #[ allow( clippy:: wrong_self_convention) ]
241- pub ( crate ) trait Float : Sized {
242- fn is_nan ( self ) -> bool ;
243- fn is_infinite ( self ) -> bool ;
244- fn is_finite ( self ) -> bool ;
245- }
246-
247241/// Implement functions on f32/f64 to give them APIs similar to SIMD types
248242pub ( crate ) trait FloatAsSIMD : Sized {
249243 const LEN : usize = 1 ;
@@ -265,50 +259,19 @@ impl IntAsSIMD for u64 {}
265259
266260pub ( crate ) trait BoolAsSIMD : Sized {
267261 fn any ( self ) -> bool ;
268- fn all ( self ) -> bool ;
269- fn none ( self ) -> bool ;
270262}
271263
272264impl BoolAsSIMD for bool {
273265 #[ inline( always) ]
274266 fn any ( self ) -> bool {
275267 self
276268 }
277-
278- #[ inline( always) ]
279- fn all ( self ) -> bool {
280- self
281- }
282-
283- #[ inline( always) ]
284- fn none ( self ) -> bool {
285- !self
286- }
287269}
288270
289271macro_rules! scalar_float_impl {
290272 ( $ty: ident, $uty: ident) => {
291- #[ cfg( not( std) ) ]
292- impl Float for $ty {
293- #[ inline]
294- fn is_nan( self ) -> bool {
295- self != self
296- }
297-
298- #[ inline]
299- fn is_infinite( self ) -> bool {
300- self == :: core:: $ty:: INFINITY || self == :: core:: $ty:: NEG_INFINITY
301- }
302-
303- #[ inline]
304- fn is_finite( self ) -> bool {
305- !( self . is_nan( ) || self . is_infinite( ) )
306- }
307- }
308-
309273 impl FloatSIMDUtils for $ty {
310274 type Mask = bool ;
311- type Scalar = $ty;
312275 type UInt = $uty;
313276
314277 #[ inline( always) ]
@@ -351,6 +314,11 @@ macro_rules! scalar_float_impl {
351314 fn cast_from_int( i: Self :: UInt ) -> Self {
352315 i as $ty
353316 }
317+ }
318+
319+ #[ cfg( test) ]
320+ impl FloatSIMDScalarUtils for $ty {
321+ type Scalar = $ty;
354322
355323 #[ inline]
356324 fn replace( self , index: usize , new_value: Self :: Scalar ) -> Self {
@@ -380,7 +348,6 @@ macro_rules! simd_impl {
380348 where LaneCount <LANES >: SupportedLaneCount
381349 {
382350 type Mask = Mask <<$fty as SimdElement >:: Mask , LANES >;
383- type Scalar = $fty;
384351 type UInt = Simd <$uty, LANES >;
385352
386353 #[ inline( always) ]
@@ -429,6 +396,14 @@ macro_rules! simd_impl {
429396 fn cast_from_int( i: Self :: UInt ) -> Self {
430397 i. cast( )
431398 }
399+ }
400+
401+ #[ cfg( test) ]
402+ impl <const LANES : usize > FloatSIMDScalarUtils for Simd <$fty, LANES >
403+ where
404+ LaneCount <LANES >: SupportedLaneCount ,
405+ {
406+ type Scalar = $fty;
432407
433408 #[ inline]
434409 fn replace( mut self , index: usize , new_value: Self :: Scalar ) -> Self {
0 commit comments