Skip to main content

no_host_bits

Function no_host_bits 

Source
fn no_host_bits(addr: u128, prefix: u8, width: u8) -> bool
Expand description

Returns true when the low width - prefix host bits of addr are all zero.

§Preconditions

Callers must ensure prefix <= width. The host_bits == 0 branch is not merely an optimisation: it is load-bearing for panic-safety. When prefix == width, host_bits is 0 and we return early, avoiding the expression u128::MAX >> 128, which would panic due to Rust’s overflow checks on shift amounts.