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

Function checksum

arch/fb100/decoder.cc:69–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69static uint16_t checksum(const Bytes& bytes)
70{
71 uint8_t crclo = 0;
72 uint8_t crchi = 0;
73 for (uint8_t a : bytes)
74 {
75 a ^= crchi;
76 uint8_t t1 = a;
77 a <<= 4;
78 bool c = a & 0x10;
79 a ^= t1;
80 t1 = a;
81 rol(a, c);
82 rol(a, c);
83 rol(a, c);
84 uint8_t b = a;
85 a &= 0xf8;
86 a ^= crclo;
87 crchi = a;
88 rol(b, c);
89 rol(b, c);
90 b &= 0x0f;
91 b ^= crchi;
92 crchi = b;
93 rol(b, c);
94 b ^= t1;
95 crclo = b;
96 }
97
98 return (crchi << 8) | crclo;
99}
100
101class Fb100Decoder : public Decoder
102{

Callers 1

decodeSectorRecordMethod · 0.85

Calls 1

rolFunction · 0.85

Tested by

no test coverage detected