File tree 1 file changed +6
-10
lines changed
1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -263,11 +263,9 @@ where
263
263
slice. len( ) >= Self :: N ,
264
264
"slice length must be at least the number of elements"
265
265
) ;
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 ( ) ) }
271
269
}
272
270
273
271
/// Writes a SIMD vector to the first `N` elements of a slice.
@@ -293,11 +291,9 @@ where
293
291
slice. len( ) >= Self :: N ,
294
292
"slice length must be at least the number of elements"
295
293
) ;
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 ( ) ) }
301
297
}
302
298
303
299
/// 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