@@ -85,7 +85,7 @@ pub trait Swizzle<const N: usize> {
85
85
LaneCount < N > : SupportedLaneCount ,
86
86
LaneCount < M > : SupportedLaneCount ,
87
87
{
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.
89
89
unsafe {
90
90
core:: intrinsics:: simd:: simd_shuffle (
91
91
vector,
@@ -103,7 +103,11 @@ pub trait Swizzle<const N: usize> {
103
103
output[ i] = index as u32 ;
104
104
i += 1 ;
105
105
}
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)
107
111
} ,
108
112
)
109
113
}
@@ -121,7 +125,7 @@ pub trait Swizzle<const N: usize> {
121
125
LaneCount < N > : SupportedLaneCount ,
122
126
LaneCount < M > : SupportedLaneCount ,
123
127
{
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.
125
129
unsafe {
126
130
core:: intrinsics:: simd:: simd_shuffle (
127
131
first,
@@ -139,7 +143,11 @@ pub trait Swizzle<const N: usize> {
139
143
output[ i] = index as u32 ;
140
144
i += 1 ;
141
145
}
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)
143
151
} ,
144
152
)
145
153
}
0 commit comments