MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / northstarChecksum

Function northstarChecksum

arch/northstar/decoder.cc:58–70  ·  view source on GitHub ↗

Checksum is initially 0. * For each data byte, XOR with the current checksum. * Rotate checksum left, carrying bit 7 to bit 0. */

Source from the content-addressed store, hash-verified

56 * Rotate checksum left, carrying bit 7 to bit 0.
57 */
58uint8_t northstarChecksum(const Bytes& bytes)
59{
60 ByteReader br(bytes);
61 uint8_t checksum = 0;
62
63 while (!br.eof())
64 {
65 checksum ^= br.read_8();
66 checksum = ((checksum << 1) | ((checksum >> 7)));
67 }
68
69 return checksum;
70}
71
72class NorthstarDecoder : public Decoder
73{

Callers 2

write_sectorFunction · 0.85
decodeSectorRecordMethod · 0.85

Calls 2

read_8Method · 0.80
eofMethod · 0.45

Tested by

no test coverage detected