From 946dbb5818b786950f7966cec5ccf238273461bc Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sun, 7 Feb 2021 13:14:23 +0000 Subject: [PATCH] ITSTate: Correct ITState::Advance --- src/frontend/A32/ITState.h | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/frontend/A32/ITState.h b/src/frontend/A32/ITState.h index 27e78cbe..6a782fbc 100644 --- a/src/frontend/A32/ITState.h +++ b/src/frontend/A32/ITState.h @@ -24,32 +24,20 @@ public: IR::Cond Cond() const { return static_cast(Common::Bits<4, 7>(value)); } - void Cond(IR::Cond cond) { - value = Common::ModifyBits<4, 7>(value, static_cast(cond)); - } - - u8 Mask() const { - return Common::Bits<0, 3>(value); - } - void Mask(u8 mask) { - value = Common::ModifyBits<0, 3>(value, mask); - } bool IsInITBlock() const { - return Mask() != 0b0000; + return Common::Bits<0, 3>(value) != 0b0000; } bool IsLastInITBlock() const { - return Mask() == 0b1000; + return Common::Bits<0, 3>(value) == 0b1000; } ITState Advance() const { - ITState result{*this}; - result.Mask(result.Mask() << 1); - if (result.Mask() == 0) { - return ITState{0}; + if (Common::Bits<0, 2>(value) == 0b000) { + return ITState{0b00000000}; } - return result; + return ITState{Common::ModifyBits<0, 4>(value, static_cast(Common::Bits<0, 4>(value) << 1))}; } u8 Value() const { @@ -57,7 +45,7 @@ public: } private: - u8 value; + u8 value = 0; }; inline bool operator==(ITState lhs, ITState rhs) {