| 75 | } |
| 76 | |
| 77 | void 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 | |
| 103 | Bytes encodeMfm(const Bytes& input, bool& lastBit) |
| 104 | { |
no test coverage detected