Trait Select
pub trait Select<T>
Choose elements from two vectors using a mask.
For each element in the mask, choose the corresponding element from true_values if
that element mask is true, and false_values if that element mask is false.
If the mask is u64, it's treated as a bitmask with the least significant bit
corresponding to the first element.
Examples
Selecting values from Simd
#
# use simd;
# use simd;
# use ;
let a = from_array;
let b = from_array;
let mask = from_array;
let c = mask.select;
assert_eq!;
Selecting values from Mask
#
# use simd;
# use simd;
# use ;
let a = from_array;
let b = from_array;
let mask = from_array;
let c = mask.select;
assert_eq!;
Selecting with a bitmask
#
# use simd;
# use simd;
# use ;
let a = from_array;
let b = from_array;
let mask = 0b1001;
let c = mask.select;
assert_eq!;
Required Methods
fn select(self, true_values: T, false_values: T) -> TChoose elements
Implementors
impl<T, U, const N: usize> Select<Mask<T, N>> for Mask<U, N> where T: MaskElement, U: MaskElement,impl<T, U, const N: usize> Select<Simd<T, N>> for Mask<U, N> where T: SimdElement, U: MaskElement,impl<T, const N: usize> Select<Mask<T, N>> for u64 where T: MaskElement,impl<T, const N: usize> Select<Simd<T, N>> for u64 where T: SimdElement,