AP_Math: move use of __builtin_parity to crc

This commit is contained in:
Peter Barker 2023-06-06 13:56:02 +10:00 committed by Peter Barker
parent 440d00e8c8
commit 43ecdc64b6
2 changed files with 9 additions and 0 deletions

View File

@ -539,3 +539,8 @@ uint64_t crc_crc64(const uint32_t *data, uint16_t num_words)
return crc;
}
uint8_t parity(uint8_t byte)
{
return __builtin_parity(byte);
}

View File

@ -55,3 +55,7 @@ void hash_fnv_1a(uint32_t len, const uint8_t* buf, uint64_t* hash);
// CRC-64-WE using the polynomial of 0x42F0E1EBA9EA3693
uint64_t crc_crc64(const uint32_t *data, uint16_t num_words);
// return the parity of byte - "1" if there is an odd number of bits
// set, "0" if there is an even number of bits set
uint8_t parity(uint8_t byte);