core: Hash the whole (byte-oriented) WStr without iterating it.

This commit is contained in:
David Wendt 2021-11-27 15:17:52 -05:00 committed by kmeisthax
parent dbecd03110
commit 29d2df5f07
1 changed files with 1 additions and 1 deletions

View File

@ -145,7 +145,7 @@ pub fn str_cmp_ignore_case(left: &WStr, right: &WStr) -> std::cmp::Ordering {
pub fn str_hash<H: Hasher>(s: &WStr, state: &mut H) {
match s.units() {
Units::Bytes(us) => us.iter().for_each(|u| state.write_u8(*u)),
Units::Bytes(us) => state.write(us),
Units::Wide(us) => us.iter().for_each(|u| {
if *u <= 0xFF {
state.write_u8(*u as u8)