Skip to main content

pack_bools_into_words

Function pack_bools_into_words 

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

Pack len boolean values returned by f into words starting at bit position bit_offset, LSB-first.

Composes collect_bool_word (pack up to 64 bools into a u64) with splice_word_at_bit (merge the packed word into the destination via shift-OR).

words must have at least (bit_offset + len).div_ceil(64) entries; see splice_word_at_bit for zero-init requirements on words above the cursor.