Macro simd_swizzle
macro simd_swizzle {
(
$vector:expr, $index:expr $(,)?
) => { ... },
(
$first:expr, $second:expr, $index:expr $(,)?
) => { ... },
}
Constructs a new SIMD vector by copying elements from selected elements in other vectors.
When swizzling one vector, elements are selected like Swizzle::swizzle.
When swizzling two vectors, elements are selected like Swizzle::concat_swizzle.
Examples
With a single SIMD vector, the const array specifies element indices in that vector:
#
# use ;
let v = from_array;
// Keeping the same size
let r: u32x4 = simd_swizzle!;
assert_eq!;
// Changing the number of elements
let r: u32x2 = simd_swizzle!;
assert_eq!;
With two input SIMD vectors, the const array specifies element indices in the concatenation of those vectors:
#
# use simd;
# use simd;
# use ;
let a = from_array;
let b = from_array;
// Keeping the same size
let r: u32x4 = simd_swizzle!;
assert_eq!;
// Changing the number of elements
let r: u32x2 = simd_swizzle!;
assert_eq!;