Rearranges components of a vector.

`vector swizzle(vector v; int i0, i1, i2)`

`vector4 swizzle(vector4 v; int i0, i1, i2, i3)`

The integer arguments specify which component of the original vector to put in each place in the returned vector. So, for example, if `i0`

is `3`

, the third component of the original vector is copied to the zeroth component of the returned vector.

swizzle({10, 20, 30, 40}, 3, 2, 1, 0) == {40, 30, 20, 10} swizzle({10, 20, 30, 40}, 0, 0, 0, 0) == {10, 10, 10, 10}

Integer arguments less than `0`

or greater than `2`

or `3`

are clamped.

The equivalent VEX code might look like this:

vector swizzle(vector v; int i0, i1, i2) { return set(getcomp(v, i0), getcomp(v, i1), getcomp(v, i2)); }