File tree 3 files changed +3
-36
lines changed
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> {
15
15
pub trait SupportedLaneCount : Sealed {
16
16
#[ doc( hidden) ]
17
17
type BitMask : Copy + Default + AsRef < [ u8 ] > + AsMut < [ u8 ] > ;
18
-
19
- #[ doc( hidden) ]
20
- type IntBitMask ;
21
18
}
22
19
23
20
impl < const LANES : usize > Sealed for LaneCount < LANES > { }
24
21
25
22
impl SupportedLaneCount for LaneCount < 1 > {
26
23
type BitMask = [ u8 ; 1 ] ;
27
- type IntBitMask = u8 ;
28
24
}
29
25
impl SupportedLaneCount for LaneCount < 2 > {
30
26
type BitMask = [ u8 ; 1 ] ;
31
- type IntBitMask = u8 ;
32
27
}
33
28
impl SupportedLaneCount for LaneCount < 4 > {
34
29
type BitMask = [ u8 ; 1 ] ;
35
- type IntBitMask = u8 ;
36
30
}
37
31
impl SupportedLaneCount for LaneCount < 8 > {
38
32
type BitMask = [ u8 ; 1 ] ;
39
- type IntBitMask = u8 ;
40
33
}
41
34
impl SupportedLaneCount for LaneCount < 16 > {
42
35
type BitMask = [ u8 ; 2 ] ;
43
- type IntBitMask = u16 ;
44
36
}
45
37
impl SupportedLaneCount for LaneCount < 32 > {
46
38
type BitMask = [ u8 ; 4 ] ;
47
- type IntBitMask = u32 ;
48
39
}
Original file line number Diff line number Diff line change 97
97
#[ inline]
98
98
pub fn to_int ( self ) -> Simd < T , LANES > {
99
99
unsafe {
100
- let mask: <LaneCount < LANES > as SupportedLaneCount >:: IntBitMask =
101
- core:: mem:: transmute_copy ( & self ) ;
102
100
crate :: intrinsics:: simd_select_bitmask (
103
- mask ,
101
+ self . 0 ,
104
102
Simd :: splat ( T :: TRUE ) ,
105
103
Simd :: splat ( T :: FALSE ) ,
106
104
)
@@ -109,14 +107,7 @@ where
109
107
110
108
#[ inline]
111
109
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 )
120
111
}
121
112
122
113
#[ cfg( feature = "generic_const_exprs" ) ]
Original file line number Diff line number Diff line change @@ -105,15 +105,8 @@ where
105
105
#[ inline]
106
106
pub fn to_bitmask ( self ) -> [ u8 ; LaneCount :: < LANES > :: BITMASK_LEN ] {
107
107
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 ) ;
115
108
let mut bitmask: [ u8 ; LaneCount :: < LANES > :: BITMASK_LEN ] =
116
- core :: mem :: transmute_copy ( & bitmask ) ;
109
+ crate :: intrinsics :: simd_bitmask ( self . 0 ) ;
117
110
118
111
// There is a bug where LLVM appears to implement this operation with the wrong
119
112
// bit order.
@@ -141,14 +134,6 @@ where
141
134
}
142
135
}
143
136
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
-
152
137
Self :: from_int_unchecked ( crate :: intrinsics:: simd_select_bitmask (
153
138
bitmask,
154
139
Self :: splat ( true ) . to_int ( ) ,
You can’t perform that action at this time.
0 commit comments