AP_Math: reduce variable scope in crc_crc8

This commit is contained in:
Pierre Kancir 2018-09-11 10:58:20 +02:00 committed by Peter Barker
parent 90fc2be79d
commit dd0283d537
1 changed files with 1 additions and 2 deletions

View File

@ -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;
}