File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 1
1
#![ cfg_attr( not( feature = "std" ) , no_std) ]
2
2
#![ feature(
3
3
const_fn_trait_bound,
4
+ convert_float_to_int,
4
5
decl_macro,
5
6
platform_intrinsics,
6
7
repr_simd,
Original file line number Diff line number Diff line change 1
1
use crate :: simd:: intrinsics;
2
- use crate :: simd:: { LaneCount , Simd , SupportedLaneCount } ;
2
+ use crate :: simd:: { LaneCount , Simd , SimdElement , SupportedLaneCount } ;
3
+ use core:: convert:: FloatToInt ;
3
4
4
5
macro_rules! implement {
5
6
{
6
- $type: ty, $int_type : ty
7
+ $type: ty
7
8
} => {
8
9
impl <const LANES : usize > Simd <$type, LANES >
9
10
where
@@ -19,12 +20,16 @@ macro_rules! implement {
19
20
/// * Not be infinite
20
21
/// * Be representable in the return type, after truncating off its fractional part
21
22
#[ inline]
22
- pub unsafe fn to_int_unchecked( self ) -> Simd <$int_type, LANES > {
23
+ pub unsafe fn to_int_unchecked<I >( self ) -> Simd <I , LANES >
24
+ where
25
+ $type: FloatToInt <I >,
26
+ I : SimdElement ,
27
+ {
23
28
unsafe { intrinsics:: simd_cast( self ) }
24
29
}
25
30
}
26
31
}
27
32
}
28
33
29
- implement ! { f32 , i32 }
30
- implement ! { f64 , i64 }
34
+ implement ! { f32 }
35
+ implement ! { f64 }
You can’t perform that action at this time.
0 commit comments