JCL Help:CheckCrc32@TCrc32Table@array of Byte@Integer@Cardinal

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Checks and, if possible, corrects the data protected by a 32 bit CRC.


Pascal

 function CheckCrc32_P(X: PJclByteArray; N: Integer; Crc: Cardinal): Integer; overload;
function CheckCrc32(var X: array of Byte; N: Integer; Crc: Cardinal): Integer; overload;
function CheckCrc32(const Crc32Table: TCrc32Table; var X: array of Byte; N: Integer; Crc: Cardinal): Integer; overload;
function CheckCrc32_A(const Crc32Table: TCrc32Table; var X: array of Byte; Crc: Cardinal): Integer; overload;


Parameters

Parameters Description
X: PJclByteArray The array which contains the data. With CheckCrc32 and CheckCrc32_A this is an open array parameter, with CheckCrC32_P this is a pointer to the first byte of the array of bytes.
N: Integer The number of elements in X. CheckCrc32_A uses all bytes in the array X.
Crc: Cardinal Transmitted CRC value to check the data against.


Return Value

  • 0 No CRC error.
  • 1 Correctable error. If the false bit was in the data, it has been corrected.
  • -1 Uncorrectable error (more than one false bit).


Description

Checks and, if possible, corrects the data protected by the same 32 bit CRC the function Crc32 uses. With a 32 bit CRC a single bit error in 2^31-32 bit (2^28-4 = 268435454 byte) of data can be corrected. Beware that when trying to correct an error in a greater array of bytes, you will not get an error indicator but an unwanted bit might be changed. In arrays small enough, multiple bit errors are not corrected, but by far most multiple bit errors are detected (see CRC32).


See Also

Crc32 InitCrc32 CheckCrc16


About

Unit

JclMath


Donator

Michael Schnell


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page