16static U32
min(
const U32 a,
const U32 b) {
17 return (a < b) ? a : b;
29 Checksum(
const U32 value) : value(value)
49 this->value = checksum.value;
54 operator==(
const Checksum& checksum)
const
56 return this->value == checksum.value;
60 operator!=(
const Checksum& checksum)
const
62 return not (*
this == checksum);
81 const U32 offsetMod4 = offset % 4;
82 if (offsetMod4 != 0) {
83 const U8 wordLength =
static_cast<U8>(
min(length, 4 - offsetMod4));
84 this->addWordUnaligned(
86 static_cast<U8>(offset + index),
93 for ( ; index + 4 <= length; index += 4)
94 addWordAligned(&data[index]);
98 const U8 wordLength =
static_cast<U8>(length - index);
99 this->addWordUnaligned(
101 static_cast<U8>(offset + index),
109 addWordAligned(
const U8 *
const word)
111 for (
U8 i = 0; i < 4; ++i)
112 addByteAtOffset(word[i], i);
123 U8 offset = position % 4;
124 for (
U8 i = 0; i < length; ++i) {
125 addByteAtOffset(word[i], offset);
139 const U32 addend =
byte << (8*(3-offset));
140 this->value += addend;
uint8_t U8
8-bit unsigned integer
static U32 min(const U32 a, const U32 b)
Class representing a CFDP checksum.
U32 getValue() const
Get the checksum value.