Changes

Jump to navigation Jump to search
====Checksum====
----
uint16_t Landis_crc16 (uint16_t crc, const std::vector<preuint8_t>&data, size_t size) { // CoServ CRC = 0x45F8 // Oncor CRC = 0x5FD6 // Hard coded Poly 0x1021     uint16_t i = 0;     while (size--) {        crc ^= data[i] << 8; i++; for (unsigned k = 0; k < 8; k++) crc = crc & 0x8000 ? (crc << 1) ^ 0x1021 : crc << 1;          }      return crc; }<syntaxhighlight lang="c++">uint16_t Landis_crc16 (uint16_t crc, const std::vector<uint8_t> &data, size_t size) {// CoServ CRC = 0x45F8// Oncor CRC = 0x5FD6
// Hard coded Poly 0x1021
    uint16_t  uint16_t i = 0;     while  while (size--) {        crc ^= data[i] << 8; i++; for (unsigned k = 0; k < 8; k++) crc = crc & 0x8000 ? (crc << 1) ^ 0x1021 : crc << 1;         }      return crc; }</presyntaxhighlight>
----<br />

Navigation menu