[][src]Function pir_8_emu::util::min_byte_width

pub fn min_byte_width<T: Num + PrimInt + CheckedShr>(number: T) -> u8

Limit the specified number to be at most the specified bit-width

Examples

assert_eq!(min_byte_width(0x0F), 1);
assert_eq!(min_byte_width(0x010F), 2);
assert_eq!(min_byte_width(0x00F0010F), 4);