Function csf::bits_to_store_any_of

source ·
pub fn bits_to_store_any_of<V: Into<u64>>(
    values: impl IntoIterator<Item = V>
) -> u8
Expand description

Calculates the minimal number of bits needed to store any of the given values.

§Example

use csf::bits_to_store_any_of;

assert_eq!(bits_to_store_any_of([2u8, 7, 5, 7]), 3);
assert_eq!(bits_to_store_any_of([0u8]), 0);
assert_eq!(bits_to_store_any_of::<u32>([]), 0);