pub struct ConfigNameComparer;
impl ConfigNameComparer {
pub fn equals(left: &[u8], right: &[u8]) -> bool {
left.len() == right.len()
&& left
.iter()
.zip(right.iter())
.all(|(&l, &r)| Self::to_upper_ascii(l) == Self::to_upper_ascii(r))
}
pub fn hash_code(key: &[u8]) -> i32 {
let mut hash: i32 = 17;
for &b in key {
hash = hash
.wrapping_mul(31)
.wrapping_add(i32::from(Self::to_upper_ascii(b)));
}
hash
}
#[inline]
pub fn to_upper_ascii(value: u8) -> u8 {
if value.is_ascii_lowercase() {
value - b'a' + b'A'
} else {
value
}
}
}