home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
turbo_c
/
tc130.arc
/
CRC.DOC
< prev
next >
Wrap
Text File
|
1987-08-20
|
1KB
|
40 lines
NAME
crc functions -- crc misc. functions
SYNOPSIS
short crc_clear(); clear crc value
short crc_update(crc, chr); update crc value
short crc_finish(crc); finish crc calculation
DESCRIPTION
These functions are used in crc calculations mainly for
modem programs. crc_clear is used to clear the crc value.
However, if speed is a concern, just zero the crc value since
crc_clear does nothing other than return a zero.
crc_update is called once for each character to add to the crc.
It receives the running crc and the character to be added.
crc_finish actually calls crc_update twice with a value of
0 in order to flush the 16 bit calculation and return the final crc
calculation. As supplied, the CCITT calculation polynomial is
used. The source can be easily changed to CRC16 if desired.
EXAMPLE
short crc;
crc = crc_clear();
/* for each character processed: */
crc = crc_update(crc, next_chr);
/* finally, */
crc = crc_finish;
NOTE:
These functions are from a public domain source, author
unknown, They are not copyrighted.
This function is found in SMTCx.LIB for the Turbo-C Compiler.