core/hash_table: const fn Settings::chain_entry_size

This commit is contained in:
Alain Zscheile 2023-01-24 23:28:22 +01:00
parent b2f4ec452e
commit 7d61a9b7fc

View file

@ -40,8 +40,11 @@ pub struct Value<R> {
impl Settings {
#[inline]
pub fn chain_entry_size(&self) -> usize {
(1 + usize::from(self.entsize)).checked_mul(16).unwrap()
pub const fn chain_entry_size(&self) -> usize {
match (1 + self.entsize as usize).checked_mul(16) {
Some(x) => x,
None => unreachable!(),
}
}
}