⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

update_checksum

Function update_checksum 

Source
pub fn update_checksum(old_checksum: u16, old_value: u16, new_value: u16) -> u16
Expand description

Incrementally update a one’s complement checksum when a 16-bit value changes.

Implements the algorithm from RFC 1624: HC’ = ~(~HC + ~m + m’)

where HC is the old checksum, m is the old value, and m’ is the new value. All arithmetic is one’s complement (16-bit with end-around carry).