Skip to main content

collect_bool_words_multiversioned

Function collect_bool_words_multiversioned 

Source
pub fn collect_bool_words_multiversioned<F>(words: &mut [u64], len: usize, f: F)
where F: FnMut(usize) -> bool,
Expand description

Word loop with the widest pack kernel the CPU offers (AVX-512BW, then AVX2, then the baseline), for predicates known to be cheap.

The wide loop copies live behind a #[target_feature] function boundary that cannot inline into the caller, which deoptimizes expensive predicates (see the module docs and collect_bool_words_inline). Only route a predicate here when its evaluation is trivial — e.g. the bounds-check-free slice gathers in the From<&[bool]> / From<&[u8]> conversions, or unchecked slice comparisons like the between kernels — where the fused AVX-512 loop is worth another ~2x over the baseline kernel.

words must hold at least len.div_ceil(64) entries and f is invoked with 0..len, exactly once per index in ascending order.

Panics if words is too short.