datapath-windows/ovsext/Checksum.c
/*
 *----------------------------------------------------------------------------
 * ChecksumUpdate16 --
 *
 *  Given old checksum value (as it is in checksum field),
 *  prev value of the relevant field in network byte order
 *  new value of the relevant field in the network byte order
 *  calculate the new checksum.
 *  Please check relevant RFC for reference.
 *
 *  Input Pramater:
 *     oldSum: old checksum value in checksum field
 *     prev:   previous value of relevant 32 bit feld in network
 *             byte order.
 *     new:    new value of the relevant 32 bit field in network
 *             byte order.
 *
 *  Result:
 *     new checksum value to be placed in the checksum field.
 *----------------------------------------------------------------------------
 */
ChecksumUpdate16
Given old checksum value (as it is in checksum field),
prev value of the relevant field in network byte order
new value of the relevant field in the network byte order
calculate the new checksum.
Please check relevant RFC for reference.

Input Pramater:
oldSum: old checksum value in checksum field
prev:   previous value of relevant 32 bit feld in network
byte order.
new:    new value of the relevant 32 bit field in network
byte order.

new checksum value to be placed in the checksum field.
ChecksumUpdate16 Given old checksum value ( as it is in checksum field ) prev value of the relevant field in network byte order new value of the relevant field in the network byte order calculate the new checksum . Please check relevant RFC for reference . Input Pramater : oldSum : old checksum value in checksum field prev : previous value of relevant 32 bit feld in network byte order . new : new value of the relevant 32 bit field in network byte order . new checksum value to be placed in the checksum field .
UINT16
ChecksumUpdate16(UINT16 oldSum,
                 UINT16 prev,
                 UINT16 newValue)
{
    UINT32 sum = (UINT16)~oldSum;
    sum += (UINT32)((UINT16)~prev) + newValue;
    fold32(sum);
    return (UINT16)~sum;
}
UINT16 ChecksumUpdate16 ( UINT16 oldSum , UINT16 prev , UINT16 newValue ) { UINT32 sum = ( UINT16 ) ~ oldSum ; sum += ( UINT32 ) ( ( UINT16 ) ~ prev ) + newValue ; fold32 ( sum ) ; return ( UINT16 ) ~ sum ; }
ChecksumUpdate16
  Given old checksum value (as it is in checksum field),
  prev value of the relevant field in network byte order
  new value of the relevant field in the network byte order
  calculate the new checksum.
ChecksumUpdate16 Given old checksum value ( as it is in checksum field ) prev value of the relevant field in network byte order new value of the relevant field in the network byte order calculate the new checksum .