mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 05:17:40 -07:00
best approximation so far
This commit is contained in:
parent
31a7f53282
commit
f4bae5a5d5
@ -194,22 +194,23 @@ private:
|
||||
disp = z0 - z1,
|
||||
factor = xdiff - x;
|
||||
}
|
||||
|
||||
/*
|
||||
if (dir)
|
||||
{
|
||||
int shift = 0;
|
||||
while (disp > 0x3FF)
|
||||
return base + disp * factor / xdiff;
|
||||
}
|
||||
else*/
|
||||
{
|
||||
u32 recip, recip2;
|
||||
u32 shift = 0;
|
||||
recip2 = recip = (factor << 16) / xdiff;
|
||||
while (recip2 > 0x100)
|
||||
{
|
||||
disp >>= 1;
|
||||
recip2 >>= 1;
|
||||
shift++;
|
||||
}
|
||||
|
||||
return base + ((((s64)disp * factor * xrecip_z) >> 22) << shift);
|
||||
}
|
||||
else
|
||||
{
|
||||
disp >>= 9;
|
||||
return base + (((s64)disp * factor * xrecip_z) >> 13);
|
||||
disp >>= shift;
|
||||
return base + ((disp * recip) >> (16 - shift));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user