Skip to main content

splice_word_at_bit

Function splice_word_at_bit 

Source
pub fn splice_word_at_bit(words: &mut [u64], bit_offset: usize, word: u64)
Expand description

Splice a packed word w (whose bits above the highest valid bit are zero) into words at the given bit position.

The destination word at bit_offset / 64 is OR’d, preserving any bits below bit_offset % 64. When w has high bits that spill into the next word, those bits are assigned (not OR’d) — so callers must ensure that next slot is zero (e.g. via BufferMut::zeroed).

words.len() need only cover the slots w actually writes to: skipping the spillover when its bits are all zero means a tail that fits entirely in the leading word never touches words[dest_word + 1].