crc7 function
CRC-7, polynomial x⁷ + x³ + 1 (0x09), MSB-first, init 0, over bits
(each 0 or 1).
Implementation
int crc7(List<int> bits) {
var crc = 0;
for (final b in bits) {
final top = ((crc >> 6) & 1) ^ b;
crc = (crc << 1) & 0x7F;
if (top == 1) crc ^= 0x09;
}
return crc;
}