@@ -272,19 +272,15 @@ macro_rules! deinterleaving_load {
272272 use $crate:: core_arch:: simd:: Simd ;
273273 use $crate:: mem:: transmute;
274274
275- // NOTE: repr(simd) adds padding to make the total size a power of two.
276- // Hence writing W to ptr might write out of bounds.
277275 type V = Simd <$elem, $lanes>;
278276 type Arr = [ $elem; { $lanes * 3 } ] ;
279277
280278 // NOTE: copy_nonoverlapping requires both pointers to be aligned to at least align_of::<$elem>(),
281279 // passing a pointer that is not sufficiently aligned is an UB.
282- let arr: Arr = $crate:: ptr:: read_unaligned( $ptr as * const Arr ) ;
283-
284- type W = Simd <$elem, { $lanes * 4 } >;
285- let mut tmp = [ 0 as $elem; { $lanes * 4 } ] ;
286- tmp[ ..$lanes * 3 ] . copy_from_slice( & arr) ;
287- let w: W = W :: from_array( tmp) ;
280+ let arr: Arr = std:: array:: from_fn( |x| $crate:: ptr:: read_unaligned( ( $ptr as * const $elem) . add( x) ) ) ;
281+ // NOTE: repr(simd) adds padding to make the total size a power of two.
282+ // Hence writing W to ptr might write out of bounds.
283+ let w: W = W :: from_array( arr) ;
288284
289285 let v0: V = simd_shuffle!( w, w, deinterleave_mask:: <$lanes, 3 , 0 >( ) ) ;
290286 let v1: V = simd_shuffle!( w, w, deinterleave_mask:: <$lanes, 3 , 1 >( ) ) ;
0 commit comments