/* Hard wired for ^16+^12+^5+1, "CITT CRC16" - HDLC, X.25 */

unsigned int add2CRCCITT(unsigned char  newData, unsigned int  oldCRC)
{
    oldCRC ^= newData;
    oldCRC  = (oldCRC >> 8) | (oldCRC << 8);
    oldCRC ^= (oldCRC & 0xFF00) << 4;
    oldCRC ^= oldCRC >> 12;
    /* It might be better to use '(oldCRC >> 8) >> 4' above as some
       compilers will optimise the shift by eight to a byte operation. */
    oldCRC ^= (oldCRC & 0xFF00) >> 5;

    return oldCRC;
}

