fn find_bit_fast(
    init_mask: &InitMask,
    start: Size,
    end: Size,
    is_init: bool
) -> Option<Size>
Expand description

A fast implementation of find_bit, which skips over an entire block at a time if it’s all 0s (resp. 1s), and finds the first 1 (resp. 0) bit inside a block using trailing_zeros instead of a loop.

Note that all examples below are written with 8 (instead of 64) bit blocks for simplicity, and with the least significant bit (and lowest block) first:

       00000000|00000000
       ^      ^ ^      ^
index: 0      7 8      15

Also, if not stated, assume that is_init = true, that is, we are searching for the first 1 bit.