Browse Source

AP_Math: reduce variable scope in crc_crc8

mission-4.1.18
Pierre Kancir 7 years ago committed by Peter Barker
parent
commit
dd0283d537
  1. 3
      libraries/AP_Math/crc.cpp

3
libraries/AP_Math/crc.cpp

@ -49,11 +49,10 @@ static const uint8_t crc8_table[] = { @@ -49,11 +49,10 @@ static const uint8_t crc8_table[] = {
*/
uint8_t crc_crc8(const uint8_t *p, uint8_t len)
{
uint16_t i;
uint16_t crc = 0x0;
while (len--) {
i = (crc ^ *p++) & 0xFF;
const uint16_t i = (crc ^ *p++) & 0xFF;
crc = (crc8_table[i] ^ (crc << 8)) & 0xFF;
}

Loading…
Cancel
Save