Private Function crc_ccitt_update(crc As uint16_t, data As uint8_t) As uint16_t
data = data Xor crc And &Hff
data = data Xor data << 4
Dim ret_val As uint16_t = (((DirectCast(data, uint16_t) << 8) Or ((crc And &Hff00) >> 8)) Xor DirectCast(data >> 4, uint8_t) Xor (DirectCast(data, uint16_t) << 3))
Return ret_val
End Function
|