MdePkg/BaseLib: Add CRC16-ANSI and CRC32c implementations

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3871

Add the CRC16-ANSI and CRC32C implementations previously found at
Features/Ext4Pkg/Ext4Dxe/Crc{16,32c}.c to BaseLib.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>

Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
Pedro Falcato
2022-04-08 06:02:00 +08:00
committed by mergify[bot]
parent b09ada6edc
commit 92288f4334
2 changed files with 178 additions and 1 deletions

View File

@@ -4503,6 +4503,40 @@ CalculateCrc32 (
IN UINTN Length
);
/**
Calculates the CRC16-ANSI checksum of the given buffer.
@param[in] Buffer Pointer to the buffer.
@param[in] Length Length of the buffer, in bytes.
@param[in] InitialValue Initial value of the CRC.
@return The CRC16-ANSI checksum.
**/
UINT16
EFIAPI
CalculateCrc16Ansi (
IN CONST VOID *Buffer,
IN UINTN Length,
IN UINT16 InitialValue
);
/**
Calculates the CRC32c checksum of the given buffer.
@param[in] Buffer Pointer to the buffer.
@param[in] Length Length of the buffer, in bytes.
@param[in] InitialValue Initial value of the CRC.
@return The CRC32c checksum.
**/
UINT32
EFIAPI
CalculateCrc32c (
IN CONST VOID *Buffer,
IN UINTN Length,
IN UINT32 InitialValue
);
//
// Base Library CPU Functions
//
@@ -4512,7 +4546,6 @@ CalculateCrc32 (
@param Context1 Context1 parameter passed into SwitchStack().
@param Context2 Context2 parameter passed into SwitchStack().
**/
typedef
VOID