fn truncate_value<T: MetadataValue>(log_num_of_bits: usize, val: u64) -> u64