Skip to main content

build_direct_positions

Function build_direct_positions 

Source
fn build_direct_positions<K, P>(
    values: &[K],
    bits: u32,
    position: impl Fn(usize) -> P,
) -> Vec<P>
where K: SimdKey, P: Copy,
Examples found in repository?
crates/competitive/src/data_structure/static_search.rs (lines 84-86)
81    fn build<K: SimdKey>(values: &[K], bits: u32) -> Self {
82        assert!(values.len() <= u32::MAX as usize);
83        if values.len() <= u16::MAX as usize {
84            Self::U16(build_direct_positions(values, bits, |position| {
85                position as u16
86            }))
87        } else {
88            Self::U32(build_direct_positions(values, bits, |position| {
89                position as u32
90            }))
91        }
92    }