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

Function vectorGraphicEcc

arch/micropolis/decoder.cc:76–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76uint32_t vectorGraphicEcc(const Bytes& bytes)
77{
78 uint32_t e = 0;
79 Bytes payloadBytes = bytes.slice(0, bytes.size() - 4);
80 ByteReader payload(payloadBytes);
81 while (!payload.eof())
82 {
83 uint8_t byte = payload.read_8();
84 for (int i = 0; i < 8; i++)
85 {
86 e = (e << 1) | eccNextBit(e, byte >> 7);
87 byte <<= 1;
88 }
89 }
90 Bytes trailerBytes = bytes.slice(bytes.size() - 4);
91 ByteReader trailer(trailerBytes);
92 uint32_t res = e;
93 while (!trailer.eof())
94 {
95 uint8_t byte = trailer.read_8();
96 for (int i = 0; i < 8; i++)
97 {
98 res = (res << 1) | eccNextBit(e, byte >> 7);
99 e <<= 1;
100 byte <<= 1;
101 }
102 }
103 return res;
104}
105
106/* Fixes bytes when possible, returning true if changed. */
107static bool vectorGraphicEccFix(Bytes& bytes, uint32_t syndrome)

Callers 2

write_sectorFunction · 0.85
decodeSectorRecordMethod · 0.85

Calls 5

eccNextBitFunction · 0.85
sliceMethod · 0.80
read_8Method · 0.80
sizeMethod · 0.45
eofMethod · 0.45

Tested by

no test coverage detected