diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vrrpv2.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/vrrpv2.rs b/src/vrrpv2.rs index c9d5031..643d6c3 100644 --- a/src/vrrpv2.rs +++ b/src/vrrpv2.rs @@ -200,9 +200,8 @@ fn checksum(bytes: &[u8]) -> u16 { if !remainder.is_empty() { sum += u32::from(remainder[0]); } - while (sum >> 16) > 0 { - sum = (sum & 0xffff) + (sum >> 16); - } + sum = (sum >> 16) + (sum & 0xffff); + sum += sum >> 16; !(sum as u16) } |