Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sh4: Fix FTRC (ipr, canonical, x86) by using correct positive cutoff value #1428

Merged
merged 1 commit into from Oct 2, 2018

Conversation

@flyinghead
Copy link
Contributor

@flyinghead flyinghead commented Oct 2, 2018

Fix for interpreter, common dynarec and x86 rec.

Fixes wrong car color in Tokyo Xtreme Racer car selection screen.

Fix for interpreter, common dynarec and x86 rec.

Fixes wrong car color in Tokyo Xtreme Racer car selection screen.
@skmp skmp changed the title Fix sh4 FTRC op to use correct positive cutoff value. sh4: Fix canonical, x86 FTRC op to use correct positive cutoff value. Oct 2, 2018
@skmp skmp changed the title sh4: Fix canonical, x86 FTRC op to use correct positive cutoff value. sh4: Fix FTRC (ipr, canonical, x86) by using correct positive cutoff value Oct 2, 2018
@skmp skmp merged commit 84bf6ab into master Oct 2, 2018
@skmp skmp deleted the fh/ftrc-op-fix branch Oct 2, 2018
Copy link
Contributor

@baka0815 baka0815 left a comment

We should avoid magic numbers as much as possible and use constants with speaking names instead.

Loading

if (f1 > 0x7FFFFFBF)
f1 = 0x7FFFFFBF;
return (s32)f1;
if (f1 > 2147483520.0f) // IEEE 754: 0x4effffff
Copy link
Contributor

@baka0815 baka0815 Oct 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should propably use a const for this instead of some magic number...

Loading

@@ -628,22 +628,25 @@ sh4op(i1111_nnnn_0011_1101)
if (fpscr.PR == 0)
{
u32 n = GetN(op);
fpul = (u32)(s32)min(fr[n],(float)0x7FFFFFBF);
fpul = (u32)(s32)min(fr[n], 2147483520.0f); // IEEE 754: 0x4effffff
Copy link
Contributor

@baka0815 baka0815 Oct 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...that way it would be much easier...

Loading

@@ -1453,7 +1453,7 @@ void ngen_opcode(RuntimeBlockInfo* block, shil_opcode* op,x86_block* x86e, bool
verify(op->rs1.is_r32f());
verify(reg.IsAllocg(op->rd));
verify(reg.IsAllocf(op->rs1));
static f32 sse_ftrc_saturate = 0x7FFFFFBF;//1.11111111111111111111111 << 31
static f32 sse_ftrc_saturate = 2147483520.0f; // IEEE 754: 0x4effffff
Copy link
Contributor

@baka0815 baka0815 Oct 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...to see that all these are the same.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants