pub fn break_bit_range<V>(
    start_addr: Address,
    start_bit: u8,
    end_addr: Address,
    end_bit: u8,
    forwards: bool,
    visitor: &mut V
) -> bool
where V: FnMut(BitByteRange) -> bool,
Expand description

Break a bit range into sub-ranges of whole bytes and in-byte bits.

This method is primarily used for iterating side metadata for a data address range. As we cannot guarantee that the data address range can be mapped to whole metadata bytes, we have to deal with visiting only a bit range in a metadata byte.

The bit range starts at the bit at index start_bit in the byte at address start_addr, and ends at (but does not include) the bit at index end_bit in the byte at address end_addr.

Arguments:

  • forwards: If true, we iterate forwards (from start/low address to end/high address). Otherwise, we iterate backwards (from end/high address to start/low address).
  • visitor: The callback that visits ranges of bits or bytes. It returns whether the itertion is early terminated.

Returns true if we iterate through every bits in the range. Return false if we abort iteration early.