pub fn get_bit_width_from(states: u64) -> u64
Expand description
Returns the minimum bit width needed to represents n states with zero inclusive. Panics otherwise.
Note: To represent the number n
, you need to represent n+1
states.
For example,
get_bit_width_from(3)
== 2 // 3 states requires a minimum of 2 bits.
get_bit_width_from(4)
== 2 // 4 states can be represented with exactly 2 bits.
get_bit_width_from(5)
== 3 // 5 states requires a minimum of 3 bits.