pub fn calculate_checksum(initial: u16, data: &[u8]) -> u16 {
	let mut checksum = initial;
	for &byte in data {
		let index = ((checksum >> 8) ^ (byte as u16) & 0xff) as usize;
		checksum = (checksum << 8) ^ TABLE[index];
	}

	checksum
}
/// Calculate the checksum of some data.
///
/// You can compute the checksum of non-contiguous data
/// by passing the checksum of the first block as the `initial` parameter for the second block.
///
/// If there is no previous data, pass 0 as `initial` value.
Calculate the checksum of some data.
You can compute the checksum of non-contiguous data
by passing the checksum of the first block as the `initial` parameter for the second block.

If there is no previous data, pass 0 as `initial` value.
Calculate the checksum of some data . You can compute the checksum of non - contiguous data by passing the checksum of the first block as the ` initial ` parameter for the second block . If there is no previous data pass 0 as ` initial ` value .
pub fn calculate_checksum(initial: u16, data: &[u8]) -> u16 {
	let mut checksum = initial;
	for &byte in data {
		let index = ((checksum >> 8) ^ (byte as u16) & 0xff) as usize;
		checksum = (checksum << 8) ^ TABLE[index];
	}
	checksum
}
pub fn calculate_checksum ( initial : u16 , data : & [ u8 ] ) -> u16 { let mut checksum = initial ; for & byte in data { let index = ( ( checksum >> 8 ) ^ ( byte as u16 ) & 0xff ) as usize ; checksum = ( checksum << 8 ) ^ TABLE [ index ] ; } checksum }
Calculate the checksum of some data.
Calculate the checksum of some data .
initial
u16
data
&[u8]
initial
u16
data
&[u8]