calculateCRC16 static method

int calculateCRC16(
  1. List<int> bytes
)

低位在左,高位在右边

Implementation

static int calculateCRC16(List<int> bytes) {
  int crcHi = 0xFF;
  int crcLo = 0xFF;
  int index = 0;
  for (int i = 0; i < bytes.length; i++) {
    index = crcHi ^ bytes[i];
    crcHi = crcLo ^ _crcHiTable[index];
    crcLo = _crcLoTable[index];
  }

  return crcHi << 8 | crcLo;
}