@@ -85,7 +85,7 @@ pub trait Swizzle<const N: usize> {
8585 LaneCount < N > : SupportedLaneCount ,
8686 LaneCount < M > : SupportedLaneCount ,
8787 {
88- // Safety: `vector` is a vector, and the index is a const array of u32.
88+ // Safety: `vector` is a vector, and the index is a const vector of u32.
8989 unsafe {
9090 core:: intrinsics:: simd:: simd_shuffle (
9191 vector,
@@ -103,7 +103,11 @@ pub trait Swizzle<const N: usize> {
103103 output[ i] = index as u32 ;
104104 i += 1 ;
105105 }
106- output
106+
107+ // The index list needs to be returned as a vector.
108+ #[ repr( simd) ]
109+ struct SimdShuffleIdx < const LEN : usize > ( [ u32 ; LEN ] ) ;
110+ SimdShuffleIdx ( output)
107111 } ,
108112 )
109113 }
@@ -121,7 +125,7 @@ pub trait Swizzle<const N: usize> {
121125 LaneCount < N > : SupportedLaneCount ,
122126 LaneCount < M > : SupportedLaneCount ,
123127 {
124- // Safety: `first` and `second` are vectors, and the index is a const array of u32.
128+ // Safety: `first` and `second` are vectors, and the index is a const vector of u32.
125129 unsafe {
126130 core:: intrinsics:: simd:: simd_shuffle (
127131 first,
@@ -139,7 +143,11 @@ pub trait Swizzle<const N: usize> {
139143 output[ i] = index as u32 ;
140144 i += 1 ;
141145 }
142- output
146+
147+ // The index list needs to be returned as a vector.
148+ #[ repr( simd) ]
149+ struct SimdShuffleIdx < const LEN : usize > ( [ u32 ; LEN ] ) ;
150+ SimdShuffleIdx ( output)
143151 } ,
144152 )
145153 }
0 commit comments