Skip to main content

checked_log_2

Function checked_log_2 

Source
pub const fn checked_log_2(val: usize) -> usize
Expand description

Computes the binary logarithm of val.

#[track_caller] puts the panic at the call site rather than inside this function. A const fn cannot format a panic message, so the offending value is not reported.

ยงPanics

Panics if val is not a power of two, zero included.