home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / filutl / brik2src.arc / ADDBFCRC.C < prev    next >
C/C++ Source or Header  |  1989-08-04  |  651b  |  22 lines

  1. /* ::[[ @(#) addbfcrc.c 1.10 89/07/08 10:34:48 ]]:: */
  2. /* Adapted from zmodem source code, which contained Gary Brown's code */
  3.  
  4. #ifndef LINT
  5. static char sccsid[]="::[[ @(#) addbfcrc.c 1.10 89/07/08 10:34:48 ]]::";
  6. #endif
  7.  
  8. typedef unsigned long tcrc;      /* type of crc value -- same as in brik.c */
  9. extern tcrc crccode;             /* holds all crc values */
  10. extern tcrc crctab[];            /* the crc calculation table */
  11.  
  12. void addbfcrc (buf, size)
  13. register char *buf;
  14. register int size;
  15. {
  16.    int i;
  17.    for (i = 0;  i < size;  i ++) {
  18.       crccode = crctab[(int) ((crccode) ^ (buf[i])) & 0xff] ^
  19.          (((crccode) >> 8) & 0x00FFFFFFL);
  20.    }
  21. }
  22.