From 5b3bcf139ddd1cd7012ef140e5fe1a4254de43bb Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 9 Oct 2026 19:01:47 +1000 Subject: [PATCH] GTE: Simplify FLAG error bit update The error bit is always clear when it is computed, since FLAG is either reset at the start of the instruction, or masked when the guest writes it. So it can be ORed in, instead of being cleared and reinserted. --- src/core/gte_types.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/gte_types.h b/src/core/gte_types.h index fc75b5848..888be3d73 100644 --- a/src/core/gte_types.h +++ b/src/core/gte_types.h @@ -44,8 +44,11 @@ union FLAGS ALWAYS_INLINE void Clear() { bits = 0; } - // Bits 30..23, 18..13 OR'ed - ALWAYS_INLINE void UpdateError() { error = (bits & UINT32_C(0x7F87E000)) != UINT32_C(0); } + // Bits 30..23, 18..13 OR'ed. The error bit must not be set beforehand, i.e. after Clear(), or masking guest writes. + ALWAYS_INLINE void UpdateError() + { + bits |= ((bits & UINT32_C(0x7F87E000)) != UINT32_C(0)) ? UINT32_C(0x80000000) : UINT32_C(0); + } }; union Regs