@@ -143,8 +143,8 @@ where
143143
144144 #[ inline]
145145 #[ must_use = "method returns a new vector and does not mutate the original value" ]
146- pub fn to_bitmask_vector ( self ) -> Simd < T , N > {
147- let mut bitmask = Self :: splat ( false ) . to_int ( ) ;
146+ pub fn to_bitmask_vector ( self ) -> Simd < u8 , N > {
147+ let mut bitmask = Simd :: splat ( 0 ) ;
148148
149149 // Safety: Bytes is the right size array
150150 unsafe {
@@ -159,36 +159,21 @@ where
159159 }
160160 }
161161
162- assert ! (
163- core:: mem:: size_of:: <Simd <T , N >>( )
164- >= core:: mem:: size_of:: <<LaneCount <N > as SupportedLaneCount >:: BitMask >( )
165- ) ;
166- core:: ptr:: copy_nonoverlapping (
167- bytes. as_ref ( ) . as_ptr ( ) ,
168- bitmask. as_mut_array ( ) . as_mut_ptr ( ) as _ ,
169- bytes. as_ref ( ) . len ( ) ,
170- ) ;
162+ bitmask. as_mut_array ( ) [ ..bytes. as_ref ( ) . len ( ) ] . copy_from_slice ( bytes. as_ref ( ) ) ;
171163 }
172164
173165 bitmask
174166 }
175167
176168 #[ inline]
177169 #[ must_use = "method returns a new mask and does not mutate the original value" ]
178- pub fn from_bitmask_vector ( bitmask : Simd < T , N > ) -> Self {
170+ pub fn from_bitmask_vector ( bitmask : Simd < u8 , N > ) -> Self {
179171 let mut bytes = <LaneCount < N > as SupportedLaneCount >:: BitMask :: default ( ) ;
180172
181173 // Safety: Bytes is the right size array
182174 unsafe {
183- assert ! (
184- core:: mem:: size_of:: <Simd <T , N >>( )
185- >= core:: mem:: size_of:: <<LaneCount <N > as SupportedLaneCount >:: BitMask >( )
186- ) ;
187- core:: ptr:: copy_nonoverlapping (
188- bitmask. as_array ( ) . as_ptr ( ) as _ ,
189- bytes. as_mut ( ) . as_mut_ptr ( ) ,
190- bytes. as_mut ( ) . len ( ) ,
191- ) ;
175+ let len = bytes. as_ref ( ) . len ( ) ;
176+ bytes. as_mut ( ) . copy_from_slice ( & bitmask. as_array ( ) [ ..len] ) ;
192177
193178 // LLVM assumes bit order should match endianness
194179 if cfg ! ( target_endian = "big" ) {
0 commit comments