pub const fn number_of_bits_and_bytes(num_bits: usize) -> (usize, usize)
Expand description
Return the number of (byte-aligned) bits and bytes required to represent the given number of bits.
Examples:
- Given
64 bits
, returns(64, 8)
. - Given
251 bits
, returns(256, 32)
. - Given
999 bits
, returns(1000, 125)
.