* @brief Computes an 8-bit XOR checksum. */
| 90 | * @brief Computes an 8-bit XOR checksum. |
| 91 | */ |
| 92 | static constexpr uint8_t xor8(const char* data, const int length) noexcept |
| 93 | { |
| 94 | uint8_t checksum = 0; |
| 95 | for (int i = 0; i < length; ++i) |
| 96 | checksum ^= static_cast<uint8_t>(data[i]); |
| 97 | |
| 98 | return checksum; |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * @brief Computes an 8-bit CRC (CRC-8) using polynomial 0x31. |