pub fn compute_checksum_unchecked(&self, header_len: usize) -> u16 {
        let mut sum = 0u32;
        for i in 0..header_len / 2 {
            sum += u32::from(self.bytes.ntohs_unchecked(i * 2));
        }

        while sum >> 16 != 0 {
            sum = (sum & 0xffff) + (sum >> 16);
        }

        !(sum as u16)
    }
/// Computes and returns the packet header checksum using the provided header length.
///
/// A nice description of how this works can be found [here]. May panic for invalid values of
/// `header_len`.
///
/// # Panics
///
/// This method may panic if the value of `header_len` is invalid.
///
/// [here]: https://en.wikipedia.org/wiki/IPv4_header_checksum
Computes and returns the packet header checksum using the provided header length.
A nice description of how this works can be found [here]. May panic for invalid values of
`header_len`.
Computes and returns the packet header checksum using the provided header length . A nice description of how this works can be found [ here ] . May panic for invalid values of ` header_len ` .
pub fn compute_checksum_unchecked(&self, header_len: usize) -> u16 {
        let mut sum = 0u32;
        for i in 0..header_len / 2 {
            sum += u32::from(self.bytes.ntohs_unchecked(i * 2));
        }
        while sum >> 16 != 0 {
            sum = (sum & 0xffff) + (sum >> 16);
        }
        !(sum as u16)
    }
pub fn compute_checksum_unchecked ( & self , header_len : usize ) -> u16 { let mut sum = 0u32 ; for i in 0 .. header_len / 2 { sum += u32 :: from ( self . bytes . ntohs_unchecked ( i * 2 ) ) ; } while sum >> 16 != 0 { sum = ( sum & 0xffff ) + ( sum >> 16 ) ; } ! ( sum as u16 ) }
Computes and returns the packet header checksum using the provided header length.
Computes and returns the packet header checksum using the provided header length .
&self
header_len
usize
&self
header_len
usize
panics
This method may panic if the value of `header_len` is invalid.


This method may panic if the value of ` header_len ` is invalid .