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

Function encodeMfm

lib/decoders/fmmfm.cc:77–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77void encodeMfm(std::vector<bool>& bits,
78 unsigned& cursor,
79 const Bytes& input,
80 bool& lastBit)
81{
82 if (bits.size() == 0)
83 return;
84 unsigned len = bits.size() - 1;
85
86 for (uint8_t b : input)
87 {
88 for (int i = 0; i < 8; i++)
89 {
90 bool bit = b & 0x80;
91 b <<= 1;
92
93 if (cursor >= len)
94 return;
95
96 bits[cursor++] = !lastBit && !bit;
97 bits[cursor++] = bit;
98 lastBit = bit;
99 }
100 }
101}
102
103Bytes encodeMfm(const Bytes& input, bool& lastBit)
104{

Callers 8

write_sectorFunction · 0.85
writeBytesMethod · 0.85
encodeMethod · 0.85
writeBytesMethod · 0.85
write_sectorFunction · 0.85
writeBytesMethod · 0.85
write_sectorFunction · 0.85
wrappedEncodeMfmFunction · 0.85

Calls 5

flushMethod · 0.80
sizeMethod · 0.45
eofMethod · 0.45
getMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected