fn needed_bits(mut val: u64) -> u8 {
    let mut result = 0;
    loop {
        val >>= 1;
        result += 1;

        if val == 0 {
            break;
        }
    }

    result
}
/// Returns the number of bits
/// needed to represent the given value.
Returns the number of bits
needed to represent the given value.
Returns the number of bits needed to represent the given value .
fn needed_bits(mut val: u64) -> u8 {
    let mut result = 0;
    loop {
        val >>= 1;
        result += 1;
        if val == 0 {
            break;
        }
    }
    result
}
fn needed_bits ( mut val : u64 ) -> u8 { let mut result = 0 ; loop { val >>= 1 ; result += 1 ; if val == 0 { break ; } } result }
Returns the number of bits
needed to represent the given value.
Returns the number of bits needed to represent the given value .
val
u64
val
u64