mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 23:32:39 +00:00
Use rotate_right
instead of explicit expansion.
This commit is contained in:
parent
b24f91c4d6
commit
e9f89c46e0
1 changed files with 1 additions and 1 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue