File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -263,11 +263,9 @@ where
263263 slice. len( ) >= Self :: N ,
264264 "slice length must be at least the number of elements"
265265 ) ;
266- assert ! ( core:: mem:: size_of:: <Self >( ) == Self :: N * core:: mem:: size_of:: <T >( ) ) ;
267- // Safety:
268- // - We've checked the length is sufficient.
269- // - `T` and `Simd<T, N>` are Copy types.
270- unsafe { slice. as_ptr ( ) . cast :: < Self > ( ) . read_unaligned ( ) }
266+ // SAFETY: We just checked that the slice contains
267+ // at least `N` elements.
268+ unsafe { Self :: load ( slice. as_ptr ( ) . cast ( ) ) }
271269 }
272270
273271 /// Writes a SIMD vector to the first `N` elements of a slice.
@@ -293,11 +291,9 @@ where
293291 slice. len( ) >= Self :: N ,
294292 "slice length must be at least the number of elements"
295293 ) ;
296- assert ! ( core:: mem:: size_of:: <Self >( ) == Self :: N * core:: mem:: size_of:: <T >( ) ) ;
297- // Safety:
298- // - We've checked the length is sufficient
299- // - `T` and `Simd<T, N>` are Copy types.
300- unsafe { slice. as_mut_ptr ( ) . cast :: < Self > ( ) . write_unaligned ( self ) }
294+ // SAFETY: We just checked that the slice contains
295+ // at least `N` elements.
296+ unsafe { self . store ( slice. as_mut_ptr ( ) . cast ( ) ) }
301297 }
302298
303299 /// Performs elementwise conversion of a SIMD vector's elements to another SIMD-valid type.
You can’t perform that action at this time.
0 commit comments