../../.cargo/katex-header.html

Function winter_math::log2[][src]

pub fn log2(n: usize) -> u32
Expand description

Returns base 2 logarithm of n, where n is a power of two.

Panics

Panics if n is not a power of two.

Examples

assert_eq!(log2(1), 0);
assert_eq!(log2(16), 4);
assert_eq!(log2(1 << 20), 20);
assert_eq!(log2(2usize.pow(20)), 20);