From e27a10bde4689fe96bb678bf29de1b2b9ae37da2 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 14 Oct 2021 16:47:18 -0700 Subject: [PATCH] Simplify control flow. --- Machines/Amiga/Chipset.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Machines/Amiga/Chipset.cpp b/Machines/Amiga/Chipset.cpp index a83dc6520..1cc4adb30 100644 --- a/Machines/Amiga/Chipset.cpp +++ b/Machines/Amiga/Chipset.cpp @@ -1082,15 +1082,17 @@ void Chipset::DiskController::process_input_bit(int value) { data_ = uint16_t((data_ << 1) | value); ++bit_count_; - if(data_ == sync_word_) { + const bool sync_matches = data_ == sync_word_; + if(sync_matches) { chipset_.posit_interrupt(InterruptFlag::DiskSyncMatch); + + if(sync_with_word_) { + bit_count_ = 0; + } } - if(sync_with_word_ && data_ == sync_word_) { - disk_dma_.enqueue(data_, true); - bit_count_ = 0; - } else if(!(bit_count_&15)) { - disk_dma_.enqueue(data_, false); + if(!(bit_count_ & 15)) { + disk_dma_.enqueue(data_, sync_matches); } }