From 52ee24943cbbcb3814570e7501aec2df3ebf780c Mon Sep 17 00:00:00 2001 From: Clownacy Date: Tue, 3 Sep 2024 14:19:47 +0100 Subject: [PATCH] Fix operator precedence in some big-endian code. This matches the original version of the code (9644b14f96ddddf34c9cdfedc9d11fc61dc8ffab). In C, the '&' operator occurs after the '^' operator, meaning that the result of `i & 1 ^ 1` is always 0. --- src/device/r4300/cp1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/device/r4300/cp1.c b/src/device/r4300/cp1.c index c744f1b65..4426728e0 100644 --- a/src/device/r4300/cp1.c +++ b/src/device/r4300/cp1.c @@ -110,7 +110,7 @@ void set_fpr_pointers(struct cp1* cp1, uint32_t newStatus) { for (i = 0; i < 32; i++) { - (r4300_cp1_regs_simple(cp1))[i] = &cp1->regs[i & ~1].float32[i & 1 ^ DOUBLE_HALF_XOR]; + (r4300_cp1_regs_simple(cp1))[i] = &cp1->regs[i & ~1].float32[(i & 1) ^ DOUBLE_HALF_XOR]; (r4300_cp1_regs_double(cp1))[i] = &cp1->regs[i & ~1].float64; } }