Lines Matching refs:bytes
59 /// itself is much higher because it works on up to 8 bytes at a time.
85 fn write(&mut self, mut bytes: &[u8]) {
87 let read_usize = |bytes: &[u8]| u32::from_ne_bytes(bytes[..4].try_into().unwrap());
89 let read_usize = |bytes: &[u8]| u64::from_ne_bytes(bytes[..8].try_into().unwrap());
93 while bytes.len() >= size_of::<usize>() {
94 hash.add_to_hash(read_usize(bytes) as usize);
95 bytes = &bytes[size_of::<usize>()..];
97 if (size_of::<usize>() > 4) && (bytes.len() >= 4) {
98 hash.add_to_hash(u32::from_ne_bytes(bytes[..4].try_into().unwrap()) as usize);
99 bytes = &bytes[4..];
101 if (size_of::<usize>() > 2) && bytes.len() >= 2 {
102 hash.add_to_hash(u16::from_ne_bytes(bytes[..2].try_into().unwrap()) as usize);
103 bytes = &bytes[2..];
105 if (size_of::<usize>() > 1) && bytes.len() >= 1 {
106 hash.add_to_hash(bytes[0] as usize);