pub struct EightValueLookup { /* private fields */ }Expand description
SIMD-accelerated position lookup for finding a u32 value in a table of up to 8 values
This is optimized for the common pattern of finding the index/position of a value in a small lookup table, which is more useful than simple membership testing.
Implementations§
Source§impl EightValueLookup
impl EightValueLookup
Sourcepub fn new(values: &[u32]) -> Self
pub fn new(values: &[u32]) -> Self
Create a new position lookup table from a slice of u32 values
§Panics
Panics if more than 8 values are provided
Sourcepub fn find_position(&self, value: u32) -> i32
pub fn find_position(&self, value: u32) -> i32
Find the position of a u32 value in the lookup table Returns the position (0-7) if found, or -1 if not found
Sourcepub fn find_positions_batch(&self, values: u32x8) -> [i32; 8]
pub fn find_positions_batch(&self, values: u32x8) -> [i32; 8]
Find positions for multiple values at once using SIMD Returns an array of positions where each element is the position (0-7) or -1