From 8960f471a0c063e4daa262ad7bda27fe4b22ee8e Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 12 Oct 2021 15:18:50 -0700 Subject: [PATCH] Use `unspread_bits` for FM and MFM decoding. --- Storage/Disk/Encodings/MFM/Shifter.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Storage/Disk/Encodings/MFM/Shifter.cpp b/Storage/Disk/Encodings/MFM/Shifter.cpp index a1ed336d6..6790031aa 100644 --- a/Storage/Disk/Encodings/MFM/Shifter.cpp +++ b/Storage/Disk/Encodings/MFM/Shifter.cpp @@ -9,6 +9,8 @@ #include "Shifter.hpp" #include "Constants.hpp" +#include "../../../../Numeric/BitSpread.hpp" + using namespace Storage::Encodings::MFM; Shifter::Shifter() : owned_crc_generator_(new CRC::CCITT()), crc_generator_(owned_crc_generator_.get()) {} @@ -122,13 +124,5 @@ void Shifter::add_input_bit(int value) { } uint8_t Shifter::get_byte() const { - return uint8_t( - ((shift_register_ & 0x0001) >> 0) | - ((shift_register_ & 0x0004) >> 1) | - ((shift_register_ & 0x0010) >> 2) | - ((shift_register_ & 0x0040) >> 3) | - ((shift_register_ & 0x0100) >> 4) | - ((shift_register_ & 0x0400) >> 5) | - ((shift_register_ & 0x1000) >> 6) | - ((shift_register_ & 0x4000) >> 7)); + return Numeric::unspread_bits(uint16_t(shift_register_)); }