MdePkg/BaseLib: Correct CRC-16-ANSI implementation

The ANSI implementation assumes that initial value should be 0xFFFF and
the result shouldn't be inverted

Fixes: 92288f4 ("MdePkg/BaseLib: Add CRC16-ANSI and CRC32c implementations")
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
This commit is contained in:
Savva Mitrofanov 2023-06-28 20:33:14 +03:00 committed by Mikhail Krichanov
parent 03d41cad62
commit df8beba585
1 changed files with 2 additions and 2 deletions

View File

@ -678,13 +678,13 @@ CalculateCrc16Ansi (
Buf = Buffer;
Crc = ~InitialValue;
Crc = InitialValue;
while (Length-- != 0) {
Crc = mCrc16LookupTable[(Crc & 0xFF) ^ *(Buf++)] ^ (Crc >> 8);
}
return ~Crc;
return Crc;
}
GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST UINT32 mCrc32cLookupTable[256] = {