pub fn dimension_bits(dim: usize) -> Result<u32, IndexKeyError>Expand description
Number of bits needed to represent the values 0..dim.
§Errors
Returns IndexKeyError::ZeroDimension when dim is zero, since an empty
local space has no representable value.
§Examples
use tensor4all_core::index_key::dimension_bits;
assert_eq!(dimension_bits(1).unwrap(), 0);
assert_eq!(dimension_bits(4).unwrap(), 2);
assert_eq!(dimension_bits(5).unwrap(), 3);
assert!(dimension_bits(0).is_err());