mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-19 09:19:05 +02:00
VFPU: fix rounding in VF2IN
This commit is contained in:
1 parent
d8294f025f
commit
76e16d49f6
4 files changed
+10
-28
No files matched your search
@@ -885,7 +885,9 @@ namespace MIPSComp
|
||||
}
|
||||
|
||||
void Jit::Comp_VScl(u32 op) {
|
||||
// Darn, still breaks Tekken 6. Bug could be elsewhere though.
|
||||
// Darn, still breaks stuff. Bug could be elsewhere though.
|
||||
DISABLE;
|
||||
|
||||
fpr.FlushAll();
|
||||
CONDITIONAL_DISABLE;
|
||||
if (js.HasUnknownPrefix())
|
||||
|
||||
@@ -51,25 +51,6 @@
|
||||
#define LO currentMIPS->lo
|
||||
|
||||
|
||||
inline int is_even(float d) {
|
||||
float int_part;
|
||||
modff(d / 2.0f, &int_part);
|
||||
return 2.0f * int_part == d;
|
||||
}
|
||||
|
||||
// Rounds *.5 to closest even number
|
||||
float round_ieee_754(float d) {
|
||||
float i = floorf(d);
|
||||
d -= i;
|
||||
if(d < 0.5f)
|
||||
return i;
|
||||
if(d > 0.5f)
|
||||
return i + 1.0f;
|
||||
if(is_even(i))
|
||||
return i;
|
||||
return i + 1.0f;
|
||||
}
|
||||
|
||||
static inline void DelayBranchTo(u32 where)
|
||||
{
|
||||
PC += 4;
|
||||
|
||||
@@ -106,12 +106,6 @@ inline float nanclamp(float f, float lower, float upper)
|
||||
}
|
||||
|
||||
|
||||
#ifndef BLACKBERRY
|
||||
double rint(double x){
|
||||
return floor(x+.5);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ApplyPrefixST(float *v, u32 data, VectorSize size)
|
||||
{
|
||||
// Possible optimization shortcut:
|
||||
@@ -604,6 +598,11 @@ namespace MIPSInt
|
||||
EatPrefixes();
|
||||
}
|
||||
|
||||
inline int round_vfpu_n(float param) {
|
||||
// return floorf(param);
|
||||
return (int)round_ieee_754(param);
|
||||
}
|
||||
|
||||
void Int_Vf2i(u32 op)
|
||||
{
|
||||
float s[4];
|
||||
@@ -627,7 +626,7 @@ namespace MIPSInt
|
||||
if (sv < (int)0x80000000) sv = (int)0x80000000;
|
||||
switch ((op >> 21) & 0x1f)
|
||||
{
|
||||
case 16: d[i] = (int)rint(sv); break; //n
|
||||
case 16: d[i] = (int)round_vfpu_n(sv); break; //n
|
||||
case 17: d[i] = s[i]>=0 ? (int)floor(sv) : (int)ceil(sv); break; //z
|
||||
case 18: d[i] = (int)ceil(sv); break; //u
|
||||
case 19: d[i] = (int)floor(sv); break; //d
|
||||
|
||||
+1
-1
Submodule native updated: 345a67144a...411a41e948.
Reference in new issue
Block a user