CRC 16 CCITT Performance
The CRC-16-CCITT is a cyclic redundancy check - one among many - defined and derived from polynomial x^16^ + x^12^ + x^5^ + 1. It is used by X.25, HDLC, XMODEM, bluetooth, phy header verification and many others. During some analysis I stumbled across the following implementation: unsigned char ser\_data; static unsigned int crc; crc = (unsigned char)(crc >> 8) | (crc << 8); crc ^= ser\_data; crc ^= (unsigned char)(crc & 0xff) >> 4; crc ^= (crc << 8) << 4; crc ^= ((crc & 0xff) << 4) << 1; The expression @(crc « 8) « 4@ quizzicaled me a little bit because @crc«12@ seems more efficient and is mainly equivalent....