#ifndef __CRC_H__ #define __CRC_H__ #ifdef __CRC_C__ #define _EXTERN #else extern const unsigned short Crc16Table[256]; extern const unsigned short CrcCcittTable[256]; extern const unsigned long Crc32Table[256]; #define _EXTERN extern "C" #endif #define UPDC16(cp,crc) (Crc16Table[((crc^cp) & 0xff)] ^ (crc >> 8)) #define UPDCCCITT(cp,crc) (CrcCcittTable[((crc >> 8) & 0xff)] ^ (crc << 8) ^ cp) #define UPDC32(octet,crc) (Crc32Table[((crc) ^ (octet)) & 0xff] ^ ((crc) >> 8)) _EXTERN unsigned short Crc16(unsigned char *Data, unsigned long Len); _EXTERN unsigned short CrcCcitt(unsigned char *Data, unsigned long Len); _EXTERN unsigned long Crc32(unsigned char *Data, unsigned long Len); #undef _EXTERN #endif