What to use for the permutation mask in SIMD.shuffle?

The following code snippet works; it is however not very convenient, especially when the SIMD width is a parameter.
fn swap[T: DType, s: StaticIntTuple[16]](v: SIMD[T, 16]) -> SIMD[T, 16]:
let x = v.shuffle[s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11],s[12],s[13],s[14],s[15]]()
...
fn swap[T: DType, s: StaticIntTuple[16]](v: SIMD[T, 16]) -> SIMD[T, 16]:
let x = v.shuffle[s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11],s[12],s[13],s[14],s[15]]()
...
Question: does someone know what I'm supposed to pass as mask in:
shuffle[*mask: Int](self: Self) -> Self
shuffle[*mask: Int](self: Self) -> Self
What other type could I use as *mask?
1 Reply
Henk-Jan Lebbink
Henk-Jan LebbinkOP12mo ago
It seems I'm missing
fn _shuffle_list[mask: VariadicList[Int], output_size: Int](self: Self) -> SIMD[type, output_size]
fn _shuffle_list[mask: VariadicList[Int], output_size: Int](self: Self) -> SIMD[type, output_size]
Want results from more Discord servers?
Add your server