core: Hash the whole (byte-oriented) WStr without iterating it.
This commit is contained in:
parent
dbecd03110
commit
29d2df5f07
|
@ -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) {
|
pub fn str_hash<H: Hasher>(s: &WStr, state: &mut H) {
|
||||||
match s.units() {
|
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| {
|
Units::Wide(us) => us.iter().for_each(|u| {
|
||||||
if *u <= 0xFF {
|
if *u <= 0xFF {
|
||||||
state.write_u8(*u as u8)
|
state.write_u8(*u as u8)
|
||||||
|
|
Loading…
Reference in New Issue