* @brief Computes an additive modulo-256 checksum. */
| 119 | * @brief Computes an additive modulo-256 checksum. |
| 120 | */ |
| 121 | static constexpr uint8_t mod256(const char* data, const int length) noexcept |
| 122 | { |
| 123 | uint16_t sum = 0; |
| 124 | for (int i = 0; i < length; ++i) |
| 125 | sum += static_cast<uint8_t>(data[i]); |
| 126 | |
| 127 | return static_cast<uint8_t>(sum & 0xFF); |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * @brief Computes a 16-bit CRC using a custom bitwise algorithm. |