home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hall of Fame
/
HallofFameCDROM.cdr
/
proglc
/
zoo141_c.lzh
/
ADDBFCRC.C
next >
Wrap
C/C++ Source or Header
|
1987-02-07
|
821b
|
36 lines
/* adbfcrc.c */
#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;
}