JCL Help:InitCrc16@Word@Word

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Defines a new polynomial and starting value for the 16 bit CRC functions.


Pascal

 procedure InitCrc16(Polynom: Word; Start: Word); overload;
procedure InitCrc16(Polynom: Word; Start: Word; out Crc16Table: TCrc16Table); overload;


Parameters

Parameters Description
Start: Word 16 bit starting value to be used with subsequent calls to 16 bit CRC functions.
Polynomial Generator polynomial to be used with subsequent calls to 16 bit CRC functions. The polynomial is given without the highest bit (bit x^16).


Description

Defines a new "generator polynomial" and starting value for the 16 bit CRC functions. Beware that the check and the correction only works if the polynomial is "appropriate". Two of these polynomials are predefined: Crc16PolynomCCITT = $1021 represents the polynomial x^16 + x^12 + x^5 + 1 that is suggested by the CCITT and used to protect floppy disks. Crc16PolynomXXXXX = $8005 represents the polynomial x^16 + x^15 + x^2 + 1 which is another "appropriate" polynomial and used to protect magnetic tapes. Beware that not appropriate polynomials result in highly undesirable behaviour of the CRC. The starting value can by anything. $FFFF and 0 are usual definitions.


See Also

Crc16 CheckCrc16 InitCrc32


About

Unit

JclMath


Donator

Michael Schnell


Notes

As a standard in the JEDI Code Library the compiler option {$J-} is set to prevent modifying typed constants. So the function CRC32Init only exists if JCLMath is recompiled with the compiler environment variable "CRCINIT" defined, which temporarily sets {$J+} for the CRC functions.


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