* @brief Computes the Adler-32 checksum of the input data. */
| 167 | * @brief Computes the Adler-32 checksum of the input data. |
| 168 | */ |
| 169 | static constexpr uint32_t adler32(const char* data, const int length) noexcept |
| 170 | { |
| 171 | constexpr uint32_t kModAdler = 65521; |
| 172 | uint32_t a = 1, b = 0; |
| 173 | |
| 174 | for (int i = 0; i < length; ++i) { |
| 175 | a = (a + static_cast<uint8_t>(data[i])) % kModAdler; |
| 176 | b = (b + a) % kModAdler; |
| 177 | } |
| 178 | |
| 179 | return (b << 16) | a; |
| 180 | } |
| 181 | |
| 182 | /** |
| 183 | * @brief Computes a Fletcher-16 checksum. |
no outgoing calls
no test coverage detected