src/cui/Xuse/Xuse.cpp
static u16 do_crc(BYTE *data, DWORD data_len, u16 crc)
{
	for (DWORD i = 0; i < data_len; ++i) {
		crc ^= data[i] << 8;
		for (DWORD k = 0; k < 8; ++k)
			if (crc & 0x8000)
				crc = (crc << 1) ^ 0x1021;
			else
				crc <<= 1;
	}

	return crc;
}
/**
 * Default CRC function. Note that avrmote has a much more efficient one.
 *
 * This CRC-16 function produces a 16-bit running CRC that adheres to the
 * ITU-T CRC standard.
 *
 * The ITU-T polynomial is: G_16(x) = x^16 + x^12 + x^5 + 1
 *
 */
Default CRC function. Note that avrmote has a much more efficient one.
This CRC-16 function produces a 16-bit running CRC that adheres to the
ITU-T CRC standard.


Default CRC function . Note that avrmote has a much more efficient one . This CRC - 16 function produces a 16 - bit running CRC that adheres to the ITU - T CRC standard .
static u16 do_crc(BYTE *data, DWORD data_len, u16 crc)
{
	for (DWORD i = 0; i < data_len; ++i) {
		crc ^= data[i] << 8;
		for (DWORD k = 0; k < 8; ++k)
			if (crc & 0x8000)
				crc = (crc << 1) ^ 0x1021;
			else
				crc <<= 1;
	}
	return crc;
}
static u16 do_crc ( BYTE * data , DWORD data_len , u16 crc ) { for ( DWORD i = 0 ; i < data_len ; ++ i ) { crc ^= data [ i ] << 8 ; for ( DWORD k = 0 ; k < 8 ; ++ k ) if ( crc & 0x8000 ) crc = ( crc << 1 ) ^ 0x1021 ; else crc <<= 1 ; } return crc ; }
Default CRC function.
Default CRC function .