TianoCore EDK2 master

#include "BaseLibInternals.h"
Go to the source code of this file.
Functions  
UINT8 EFIAPI  CalculateSum8 (IN CONST UINT8 *Buffer, IN UINTN Length) 
UINT8 EFIAPI  CalculateCheckSum8 (IN CONST UINT8 *Buffer, IN UINTN Length) 
UINT16 EFIAPI  CalculateSum16 (IN CONST UINT16 *Buffer, IN UINTN Length) 
UINT16 EFIAPI  CalculateCheckSum16 (IN CONST UINT16 *Buffer, IN UINTN Length) 
UINT32 EFIAPI  CalculateSum32 (IN CONST UINT32 *Buffer, IN UINTN Length) 
UINT32 EFIAPI  CalculateCheckSum32 (IN CONST UINT32 *Buffer, IN UINTN Length) 
UINT64 EFIAPI  CalculateSum64 (IN CONST UINT64 *Buffer, IN UINTN Length) 
UINT64 EFIAPI  CalculateCheckSum64 (IN CONST UINT64 *Buffer, IN UINTN Length) 
UINT32 EFIAPI  CalculateCrc32 (IN VOID *Buffer, IN UINTN Length) 
UINT16 EFIAPI  CalculateCrc16Ansi (IN CONST VOID *Buffer, IN UINTN Length, IN UINT16 InitialValue) 
UINT32 EFIAPI  CalculateCrc32c (IN CONST VOID *Buffer, IN UINTN Length, IN UINT32 InitialValue) 
Variables  
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT32  mCrcTable [256] 
GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST UINT16  mCrc16LookupTable [256] 
GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST UINT32  mCrc32cLookupTable [256] 
Utility functions to generate checksum based on 2's complement algorithm.
Copyright (c) 2007  2018, Intel Corporation. All rights reserved.
Copyright (c) 2022, Pedro Falcato. All rights reserved.
SPDXLicenseIdentifier: BSD2ClausePatent
Definition in file CheckSum.c.
Returns the two's complement checksum of all elements in a buffer of 16bit values.
This function first calculates the sum of the 16bit 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 16bit boundary, then ASSERT(). If Length is not aligned on a 16bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS  Buffer + 1), then ASSERT().
Buffer  The pointer to the buffer to carry out the checksum operation. 
Length  The size, in bytes, of Buffer. 
Definition at line 151 of file CheckSum.c.
Returns the two's complement checksum of all elements in a buffer of 32bit values.
This function first calculates the sum of the 32bit 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 32bit boundary, then ASSERT(). If Length is not aligned on a 32bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS  Buffer + 1), then ASSERT().
Buffer  The pointer to the buffer to carry out the checksum operation. 
Length  The size, in bytes, of Buffer. 
Definition at line 231 of file CheckSum.c.
Returns the two's complement checksum of all elements in a buffer of 64bit values.
This function first calculates the sum of the 64bit 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 64bit boundary, then ASSERT(). If Length is not aligned on a 64bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS  Buffer + 1), then ASSERT().
Buffer  The pointer to the buffer to carry out the checksum operation. 
Length  The size, in bytes, of Buffer. 
Definition at line 311 of file CheckSum.c.
Returns the two's complement checksum of all elements in a buffer of 8bit values.
This function first calculates the sum of the 8bit 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().
Buffer  The pointer to the buffer to carry out the checksum operation. 
Length  The size, in bytes, of Buffer. 
Definition at line 71 of file CheckSum.c.
UINT16 EFIAPI CalculateCrc16Ansi  (  IN CONST VOID *  Buffer, 
IN UINTN  Length,  
IN UINT16  InitialValue  
) 
Calculates the CRC16ANSI checksum of the given buffer.
[in]  Buffer  Pointer to the buffer. 
[in]  Length  Length of the buffer, in bytes. 
[in]  InitialValue  Initial value of the CRC. 
Definition at line 670 of file CheckSum.c.
Computes and returns a 32bit CRC for a data buffer. CRC32 value bases on ITUT V.42.
If Buffer is NULL, then ASSERT(). If Length is greater than (MAX_ADDRESS  Buffer + 1), then ASSERT().
[in]  Buffer  A pointer to the buffer on which the 32bit CRC is to be computed. 
[in]  Length  The number of bytes in the buffer Data. 
Crc32  The 32bit CRC was computed for the data buffer. 
Definition at line 600 of file CheckSum.c.
Calculates the CRC32c checksum of the given buffer.
[in]  Buffer  Pointer to the buffer. 
[in]  Length  Length of the buffer, in bytes. 
[in]  InitialValue  Initial value of the CRC. 
Definition at line 747 of file CheckSum.c.
Returns the sum of all elements in a buffer of 16bit values. During calculation, the carry bits are dropped.
This function calculates the sum of the 16bit values in the buffer specified by Buffer and Length. The carry bits in result of addition are dropped. The 16bit result is returned. If Length is 0, then 0 is returned.
If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 16bit boundary, then ASSERT(). If Length is not aligned on a 16bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS  Buffer + 1), then ASSERT().
Buffer  The pointer to the buffer to carry out the sum operation. 
Length  The size, in bytes, of Buffer. 
Definition at line 107 of file CheckSum.c.
Returns the sum of all elements in a buffer of 32bit values. During calculation, the carry bits are dropped.
This function calculates the sum of the 32bit values in the buffer specified by Buffer and Length. The carry bits in result of addition are dropped. The 32bit result is returned. If Length is 0, then 0 is returned.
If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 32bit boundary, then ASSERT(). If Length is not aligned on a 32bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS  Buffer + 1), then ASSERT().
Buffer  The pointer to the buffer to carry out the sum operation. 
Length  The size, in bytes, of Buffer. 
Definition at line 187 of file CheckSum.c.
Returns the sum of all elements in a buffer of 64bit values. During calculation, the carry bits are dropped.
This function calculates the sum of the 64bit values in the buffer specified by Buffer and Length. The carry bits in result of addition are dropped. The 64bit result is returned. If Length is 0, then 0 is returned.
If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 64bit boundary, then ASSERT(). If Length is not aligned on a 64bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS  Buffer + 1), then ASSERT().
Buffer  The pointer to the buffer to carry out the sum operation. 
Length  The size, in bytes, of Buffer. 
Definition at line 267 of file CheckSum.c.
Returns the sum of all elements in a buffer in unit of UINT8. During calculation, the carry bits are dropped.
This function calculates the sum of all elements in a buffer in unit of UINT8. The carry bits in result of addition are dropped. The result is returned as UINT8. If Length is Zero, then Zero is returned.
If Buffer is NULL, then ASSERT(). If Length is greater than (MAX_ADDRESS  Buffer + 1), then ASSERT().
Buffer  The pointer to the buffer to carry out the sum operation. 
Length  The size, in bytes, of Buffer. 
Definition at line 33 of file CheckSum.c.
GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST UINT16 mCrc16LookupTable[256] 
Definition at line 623 of file CheckSum.c.
GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST UINT32 mCrc32cLookupTable[256] 
Definition at line 690 of file CheckSum.c.
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT32 mCrcTable[256] 
Definition at line 326 of file CheckSum.c.