Use rotate_right instead of explicit expansion.

This commit is contained in:
Owen Anderson 2023-07-27 23:41:25 -06:00
parent b24f91c4d6
commit e9f89c46e0

View file

@ -34,7 +34,7 @@ fn bsd_sum(mut reader: Box<dyn Read>) -> (usize, u16) {
Ok(n) if n != 0 => {
bytes_read += n;
for &byte in buf[..n].iter() {
checksum = (checksum >> 1) + ((checksum & 1) << 15);
checksum = checksum.rotate_right(1);
checksum = checksum.wrapping_add(u16::from(byte));
}
}