pub fn simd_mask<T: MaskElement, const N: usize>(
mask: &Bitmask,
offset: usize,
len: usize,
) -> Mask<T, N>Expand description
Creates a SIMD mask from a bitmask window for vectorised conditional operations.
Converts a contiguous section of a bitmask into a SIMD mask. The resulting mask can be used to selectively enable/disable SIMD lanes during computation, providing efficient support for sparse or conditional operations.
§Type Parameters
T: Mask element type implementingMaskElement(typically i8, i16, i32, or i64)N: Number of SIMD lanes, must match the SIMD vector width for the target operation
§Parameters
mask: Source bitmask containing validity informationoffset: Starting bit offset within the bitmasklen: Maximum number of bits to consider (bounds checking)
§Returns
A Mask<T, N> where each lane corresponds to the validity of the corresponding input element.
Lanes beyond len are set to false for safety.
§Usage Example
ⓘ
use simd_kernels::utils::simd_mask;
// Create 8-lane mask for conditional SIMD operations
let mask: Mask<i32, 8> = simd_mask(&bitmask, 0, 64);
let result = simd_vector.select(mask, default_vector);