pylab_ml.common.data.crc4
- crc4(data)[source]
Calculate 4-bit crc from a data with width bits.
polynomial = X4+X+1
- eg. crc4(0b1011) -> 0b1110
crc4(0b1101) -> 0b0110 crc4(0b1111) -> 0b0000
- Parameters:
data (int) – Input data for which the CRC is to be calculated. The data should be a non-negative integer.
- Returns:
The calculated 4-bit CRC value as an integer.
- Return type:
int