File tree Expand file tree Collapse file tree 3 files changed +3
-36
lines changed
Expand file tree Collapse file tree 3 files changed +3
-36
lines changed Original file line number Diff line number Diff line change @@ -15,34 +15,25 @@ impl<const LANES: usize> LaneCount<LANES> {
1515pub trait SupportedLaneCount : Sealed {
1616 #[ doc( hidden) ]
1717 type BitMask : Copy + Default + AsRef < [ u8 ] > + AsMut < [ u8 ] > ;
18-
19- #[ doc( hidden) ]
20- type IntBitMask ;
2118}
2219
2320impl < const LANES : usize > Sealed for LaneCount < LANES > { }
2421
2522impl SupportedLaneCount for LaneCount < 1 > {
2623 type BitMask = [ u8 ; 1 ] ;
27- type IntBitMask = u8 ;
2824}
2925impl SupportedLaneCount for LaneCount < 2 > {
3026 type BitMask = [ u8 ; 1 ] ;
31- type IntBitMask = u8 ;
3227}
3328impl SupportedLaneCount for LaneCount < 4 > {
3429 type BitMask = [ u8 ; 1 ] ;
35- type IntBitMask = u8 ;
3630}
3731impl SupportedLaneCount for LaneCount < 8 > {
3832 type BitMask = [ u8 ; 1 ] ;
39- type IntBitMask = u8 ;
4033}
4134impl SupportedLaneCount for LaneCount < 16 > {
4235 type BitMask = [ u8 ; 2 ] ;
43- type IntBitMask = u16 ;
4436}
4537impl SupportedLaneCount for LaneCount < 32 > {
4638 type BitMask = [ u8 ; 4 ] ;
47- type IntBitMask = u32 ;
4839}
Original file line number Diff line number Diff line change 9797 #[ inline]
9898 pub fn to_int ( self ) -> Simd < T , LANES > {
9999 unsafe {
100- let mask: <LaneCount < LANES > as SupportedLaneCount >:: IntBitMask =
101- core:: mem:: transmute_copy ( & self ) ;
102100 crate :: intrinsics:: simd_select_bitmask (
103- mask ,
101+ self . 0 ,
104102 Simd :: splat ( T :: TRUE ) ,
105103 Simd :: splat ( T :: FALSE ) ,
106104 )
@@ -109,14 +107,7 @@ where
109107
110108 #[ inline]
111109 pub unsafe fn from_int_unchecked ( value : Simd < T , LANES > ) -> Self {
112- // TODO remove the transmute when rustc is more flexible
113- assert_eq ! (
114- core:: mem:: size_of:: <<LaneCount :: <LANES > as SupportedLaneCount >:: BitMask >( ) ,
115- core:: mem:: size_of:: <<LaneCount :: <LANES > as SupportedLaneCount >:: IntBitMask >( ) ,
116- ) ;
117- let mask: <LaneCount < LANES > as SupportedLaneCount >:: IntBitMask =
118- crate :: intrinsics:: simd_bitmask ( value) ;
119- Self ( core:: mem:: transmute_copy ( & mask) , PhantomData )
110+ Self ( crate :: intrinsics:: simd_bitmask ( value) , PhantomData )
120111 }
121112
122113 #[ cfg( feature = "generic_const_exprs" ) ]
Original file line number Diff line number Diff line change @@ -105,15 +105,8 @@ where
105105 #[ inline]
106106 pub fn to_bitmask ( self ) -> [ u8 ; LaneCount :: < LANES > :: BITMASK_LEN ] {
107107 unsafe {
108- // TODO remove the transmute when rustc can use arrays of u8 as bitmasks
109- assert_eq ! (
110- core:: mem:: size_of:: <<LaneCount :: <LANES > as SupportedLaneCount >:: IntBitMask >( ) ,
111- LaneCount :: <LANES >:: BITMASK_LEN ,
112- ) ;
113- let bitmask: <LaneCount < LANES > as SupportedLaneCount >:: IntBitMask =
114- crate :: intrinsics:: simd_bitmask ( self . 0 ) ;
115108 let mut bitmask: [ u8 ; LaneCount :: < LANES > :: BITMASK_LEN ] =
116- core :: mem :: transmute_copy ( & bitmask ) ;
109+ crate :: intrinsics :: simd_bitmask ( self . 0 ) ;
117110
118111 // There is a bug where LLVM appears to implement this operation with the wrong
119112 // bit order.
@@ -141,14 +134,6 @@ where
141134 }
142135 }
143136
144- // TODO remove the transmute when rustc can use arrays of u8 as bitmasks
145- assert_eq ! (
146- core:: mem:: size_of:: <<LaneCount :: <LANES > as SupportedLaneCount >:: IntBitMask >( ) ,
147- LaneCount :: <LANES >:: BITMASK_LEN ,
148- ) ;
149- let bitmask: <LaneCount < LANES > as SupportedLaneCount >:: IntBitMask =
150- core:: mem:: transmute_copy ( & bitmask) ;
151-
152137 Self :: from_int_unchecked ( crate :: intrinsics:: simd_select_bitmask (
153138 bitmask,
154139 Self :: splat ( true ) . to_int ( ) ,
You can’t perform that action at this time.
0 commit comments