Skip to main content

log2_floor_usize

Function log2_floor_usize 

Source
pub const fn log2_floor_usize(n: usize) -> usize
Expand description

Computes floor(log_2(n)).

Returns 0 for n == 0 (matching log2_ceil_usize(0) == 0); floor(log2(0)) is undefined mathematically and the saturating behaviour is the convention used elsewhere in the workspace.