home *** CD-ROM | disk | FTP | other *** search
- #ifndef LINT
- static char sccsid[]="@(#) addbfcrc.c 1.2 87/05/03 16:00:26";
- #endif /* LINT */
-
- #include "options.h"
- /*
- addbfcrc() accepts a buffer address and a count and adds the CRC for
- all bytes in the buffer to the global variable crccode using
- CRC-16.
-
- CRC computation algorithm taken from source code for ARC 5.12, which
- in turn took it from an article by David Schwaderer in the April 1985
- issue of PC Tech Journal.
-
- I claim no copyright over the contents of this file.
-
- -- Rahul Dhesi 1986/12/31
-
- */
-
- extern unsigned int crccode;
- extern unsigned crctab[];
-
- void addbfcrc(buffer,count)
- char *buffer;
- int count;
-
- {
- register unsigned int localcrc;
- register int i;
- localcrc = crccode;
-
- for (i=0; i<count; i++)
- localcrc = (localcrc>>8) ^ crctab[(localcrc ^ (buffer[i])) & 0x00ff];
- crccode = localcrc;
- }
-
-