Skip to content

Commit

Permalink
Fix operator precedence in some big-endian code.
Browse files Browse the repository at this point in the history
This matches the original version of the code (9644b14). In C, the '&' operator occurs after the '^' operator, meaning that the result of `i & 1 ^ 1` is always 0.
  • Loading branch information
Clownacy authored Sep 3, 2024
1 parent b0d68c2 commit 52ee249
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/device/r4300/cp1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 52ee249

Please sign in to comment.