//credits to iceman uint32_t CRC8Legic(uint8_t *buff, size_t size) { // Poly 0x63, reversed poly 0xC6, Init 0x55, Final 0x00 crc_t crc; crc_init(&crc, 8, 0xC6, 0x55, 0); crc_clear(&crc); for ( int i = 0; i < size; ++i) crc_update(&crc, buff[i], 8); return SwapBits(crc_finish(&crc), 8); }
void main() { ULong EnterNum, Result; //EnterNum - would be entered from keyboard //Result - would be calculated by least significant bit cout<<"Please, enter unsigned lond integer number: "; cin >> EnterNum; //Entering number Result = SwapBits(EnterNum); ShowBinary(EnterNum); //show entered number in binary system ShowBinary(Result); //show result in binary system cout<<endl<<"Result: "<<Result<<endl; system("pause"); }