CheckSum.c revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
Returns the two's complement checksum of all elements in a buffer This function first calculates the sum of the 8-bit values in the buffer specified by Buffer and Length. The carry bits in the result of addition are dropped. Then, the two's complement of the sum is returned. If Length is 0, then 0 is returned. If Buffer is NULL, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @param Buffer The pointer to the buffer to carry out the checksum operation. @param Length The size, in bytes, of Buffer. @return Checksum The 2's complement checksum of Buffer. // Return the checksum based on 2's complement. Returns the sum of all elements in a buffer of 16-bit values. During calculation, the carry bits are dropped. This function calculates the sum of the 16-bit values in the buffer specified by Buffer and Length. The carry bits in result of addition are dropped. The 16-bit result is returned. If Length is 0, then 0 is returned. If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 16-bit boundary, then ASSERT(). If Length is not aligned on a 16-bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @param Buffer The pointer to the buffer to carry out the sum operation. @param Length The size, in bytes, of Buffer. @return Sum The sum of Buffer with carry bits dropped during additions. Returns the two's complement checksum of all elements in a buffer of This function first calculates the sum of the 16-bit values in the buffer specified by Buffer and Length. The carry bits in the result of addition are dropped. Then, the two's complement of the sum is returned. If Length is 0, then 0 is returned. If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 16-bit boundary, then ASSERT(). If Length is not aligned on a 16-bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @param Buffer The pointer to the buffer to carry out the checksum operation. @param Length The size, in bytes, of Buffer. @return Checksum The 2's complement checksum of Buffer. // Return the checksum based on 2's complement. Returns the sum of all elements in a buffer of 32-bit values. During calculation, the carry bits are dropped. This function calculates the sum of the 32-bit values in the buffer specified by Buffer and Length. The carry bits in result of addition are dropped. The 32-bit result is returned. If Length is 0, then 0 is returned. If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 32-bit boundary, then ASSERT(). If Length is not aligned on a 32-bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @param Buffer The pointer to the buffer to carry out the sum operation. @param Length The size, in bytes, of Buffer. @return Sum The sum of Buffer with carry bits dropped during additions. Returns the two's complement checksum of all elements in a buffer of This function first calculates the sum of the 32-bit values in the buffer specified by Buffer and Length. The carry bits in the result of addition are dropped. Then, the two's complement of the sum is returned. If Length is 0, then 0 is returned. If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 32-bit boundary, then ASSERT(). If Length is not aligned on a 32-bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @param Buffer The pointer to the buffer to carry out the checksum operation. @param Length The size, in bytes, of Buffer. @return Checksum The 2's complement checksum of Buffer. // Return the checksum based on 2's complement. Returns the sum of all elements in a buffer of 64-bit values. During calculation, the carry bits are dropped. This function calculates the sum of the 64-bit values in the buffer specified by Buffer and Length. The carry bits in result of addition are dropped. The 64-bit result is returned. If Length is 0, then 0 is returned. If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 64-bit boundary, then ASSERT(). If Length is not aligned on a 64-bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @param Buffer The pointer to the buffer to carry out the sum operation. @param Length The size, in bytes, of Buffer. @return Sum The sum of Buffer with carry bits dropped during additions. Returns the two's complement checksum of all elements in a buffer of This function first calculates the sum of the 64-bit values in the buffer specified by Buffer and Length. The carry bits in the result of addition are dropped. Then, the two's complement of the sum is returned. If Length is 0, then 0 is returned. If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 64-bit boundary, then ASSERT(). If Length is not aligned on a 64-bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @param Buffer The pointer to the buffer to carry out the checksum operation. @param Length The size, in bytes, of Buffer. @return Checksum The 2's complement checksum of Buffer. // Return the checksum based on 2's complement.