// NOTE: if num is 0, the result should be considered undefined
if num is 0, the result should be considered undefined
if num is 0 the result should be considered undefined
fn log2(num: size_t) -> size_t {
    const IS_32_BIT: bool = size_t::max_value() as u32 as size_t == size_t::max_value();
    let max_bits = if IS_32_BIT {
        31
    } else {
        // assuming we are 64-bit (this may or may not need to be updated in the future)
        63
    };
    max_bits - num.to_le().leading_zeros() as size_t
}
fn log2 ( num : size_t ) -> size_t { const IS_32_BIT : bool = size_t :: max_value ( ) as u32 as size_t == size_t :: max_value ( ) ; let max_bits = if IS_32_BIT { 31 } else { // assuming we are 64-bit (this may or may not need to be updated in the future) 63 } ; max_bits - num . to_le ( ) . leading_zeros ( ) as size_t }
NOTE: if num is 0, the result should be considered undefined
NOTE : if num is 0 the result should be considered undefined
num
size_t