MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / xor8

Function xor8

app/src/IO/Checksum.cpp:92–99  ·  view source on GitHub ↗

* @brief Computes an 8-bit XOR checksum. */

Source from the content-addressed store, hash-verified

90 * @brief Computes an 8-bit XOR checksum.
91 */
92static 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.

Callers 1

Checksum.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected