Revert f13b366e8d57c15a6a97cc0721d68ddb5268385f: the fixNaN function is

completely bogus and the correct one doesn't have any effect.
This commit is contained in:
Flyinghead 2018-07-14 09:13:56 +02:00
parent 4fd233aca0
commit 2d3fd59e04
1 changed files with 16 additions and 3 deletions

View File

@ -110,10 +110,23 @@ struct SH4ThrownException {
}; };
// The SH4 sets the signaling bit to 0 for qNaN (unlike all recent CPUs). Some games relies on this. // The SH4 sets the signaling bit to 0 for qNaN (unlike all recent CPUs). Some games relies on this.
static INLINE float fixNaN(f32 f) static INLINE f32 fixNaN(f32 f)
{
// u32& hex = *(u32 *)&f;
// // no fast-math
// if (f != f)
// hex = 0x7fbfffff;
// // fast-math
// if ((hex & 0x7fffffff) > 0x7f800000)
// hex = 0x7fbfffff;
return f;
}
static INLINE f64 fixNaN64(f64 f)
{ {
// no fast-math // no fast-math
// return f == f ? f : 0x7fbfffff; // return f == f ? f : 0x7ff7ffffffffffffll;
// fast-math // fast-math
return (*(u32 *)&f & 0x7fffffff) <= 0x7f800000 ? f : 0x7fbfffff; // return (*(u64 *)&f & 0x7fffffffffffffffll) <= 0x7f80000000000000ll ? f : 0x7ff7ffffffffffffll;
return f;
} }