mirror of
https://github.com/mupen64plus/mupen64plus-rsp-cxd4.git
synced 2025-04-02 10:51:55 -04:00
Correct VCH sign flag comparison on -32768.
This commit is contained in:
parent
74b3ee72ce
commit
c42ac84651
1 changed files with 5 additions and 2 deletions
|
@ -230,8 +230,11 @@ INLINE static void do_ch(short* VD, short* VS, short* VT)
|
|||
#ifndef _DEBUG
|
||||
short diff[N];
|
||||
#endif
|
||||
i16 cch[N]; /* corner case hack: -(-32768) with undefined sign */
|
||||
register int i;
|
||||
|
||||
for (i = 0; i < N; i++)
|
||||
cch[i] = (VT[i] == -32768) ? ~0 : 0; /* -(-32768) might not be >= 0. */
|
||||
vector_copy(VC, VT);
|
||||
for (i = 0; i < N; i++)
|
||||
sn[i] = VS[i] ^ VT[i];
|
||||
|
@ -244,9 +247,9 @@ INLINE static void do_ch(short* VD, short* VS, short* VT)
|
|||
for (i = 0; i < N; i++)
|
||||
vce[i] &= sn[i];
|
||||
for (i = 0; i < N; i++)
|
||||
VC[i] -= sn[i]; /* converts ~(VT) into -(VT) if (sign) */
|
||||
VC[i] -= sn[i] & cch[i]; /* converts ~(VT) into -(VT) if (sign) */
|
||||
for (i = 0; i < N; i++)
|
||||
eq[i] = (VS[i] == VC[i]);
|
||||
eq[i] = (VS[i] == VC[i]) & ~cch[i]; /* (VS == +32768) is never true. */
|
||||
for (i = 0; i < N; i++)
|
||||
eq[i] |= vce[i];
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue