mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-09-09 01:30:58 +02:00
FloatUtils: Move MakeQuiet function here from Interpreter_FPUtils
This commit is contained in:
@@ -68,6 +68,13 @@ inline double FlushToZero(double d)
|
|||||||
return std::bit_cast<double>(i);
|
return std::bit_cast<double>(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline double MakeQuiet(double d)
|
||||||
|
{
|
||||||
|
const u64 integral = std::bit_cast<u64>(d) | Common::DOUBLE_QBIT;
|
||||||
|
|
||||||
|
return std::bit_cast<double>(integral);
|
||||||
|
}
|
||||||
|
|
||||||
enum PPCFpClass
|
enum PPCFpClass
|
||||||
{
|
{
|
||||||
PPC_FPCLASS_QNAN = 0x11,
|
PPC_FPCLASS_QNAN = 0x11,
|
||||||
|
@@ -123,13 +123,6 @@ inline double Force25Bit(double d)
|
|||||||
return std::bit_cast<double>(integral);
|
return std::bit_cast<double>(integral);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double MakeQuiet(double d)
|
|
||||||
{
|
|
||||||
const u64 integral = std::bit_cast<u64>(d) | Common::DOUBLE_QBIT;
|
|
||||||
|
|
||||||
return std::bit_cast<double>(integral);
|
|
||||||
}
|
|
||||||
|
|
||||||
// these functions allow globally modify operations behaviour
|
// these functions allow globally modify operations behaviour
|
||||||
// also, these may be used to set flags like FR, FI, OX, UX
|
// also, these may be used to set flags like FR, FI, OX, UX
|
||||||
|
|
||||||
@@ -162,12 +155,12 @@ inline FPResult NI_mul(PowerPC::PowerPCState& ppc_state, double a, double b)
|
|||||||
|
|
||||||
if (std::isnan(a))
|
if (std::isnan(a))
|
||||||
{
|
{
|
||||||
result.value = MakeQuiet(a);
|
result.value = Common::MakeQuiet(a);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (std::isnan(b))
|
if (std::isnan(b))
|
||||||
{
|
{
|
||||||
result.value = MakeQuiet(b);
|
result.value = Common::MakeQuiet(b);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,12 +193,12 @@ inline FPResult NI_div(PowerPC::PowerPCState& ppc_state, double a, double b)
|
|||||||
|
|
||||||
if (std::isnan(a))
|
if (std::isnan(a))
|
||||||
{
|
{
|
||||||
result.value = MakeQuiet(a);
|
result.value = Common::MakeQuiet(a);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (std::isnan(b))
|
if (std::isnan(b))
|
||||||
{
|
{
|
||||||
result.value = MakeQuiet(b);
|
result.value = Common::MakeQuiet(b);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,12 +227,12 @@ inline FPResult NI_add(PowerPC::PowerPCState& ppc_state, double a, double b)
|
|||||||
|
|
||||||
if (std::isnan(a))
|
if (std::isnan(a))
|
||||||
{
|
{
|
||||||
result.value = MakeQuiet(a);
|
result.value = Common::MakeQuiet(a);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (std::isnan(b))
|
if (std::isnan(b))
|
||||||
{
|
{
|
||||||
result.value = MakeQuiet(b);
|
result.value = Common::MakeQuiet(b);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,12 +260,12 @@ inline FPResult NI_sub(PowerPC::PowerPCState& ppc_state, double a, double b)
|
|||||||
|
|
||||||
if (std::isnan(a))
|
if (std::isnan(a))
|
||||||
{
|
{
|
||||||
result.value = MakeQuiet(a);
|
result.value = Common::MakeQuiet(a);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (std::isnan(b))
|
if (std::isnan(b))
|
||||||
{
|
{
|
||||||
result.value = MakeQuiet(b);
|
result.value = Common::MakeQuiet(b);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,17 +296,17 @@ inline FPResult NI_madd(PowerPC::PowerPCState& ppc_state, double a, double c, do
|
|||||||
|
|
||||||
if (std::isnan(a))
|
if (std::isnan(a))
|
||||||
{
|
{
|
||||||
result.value = MakeQuiet(a);
|
result.value = Common::MakeQuiet(a);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (std::isnan(b))
|
if (std::isnan(b))
|
||||||
{
|
{
|
||||||
result.value = MakeQuiet(b); // !
|
result.value = Common::MakeQuiet(b); // !
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (std::isnan(c))
|
if (std::isnan(c))
|
||||||
{
|
{
|
||||||
result.value = MakeQuiet(c);
|
result.value = Common::MakeQuiet(c);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,17 +334,17 @@ inline FPResult NI_msub(PowerPC::PowerPCState& ppc_state, double a, double c, do
|
|||||||
|
|
||||||
if (std::isnan(a))
|
if (std::isnan(a))
|
||||||
{
|
{
|
||||||
result.value = MakeQuiet(a);
|
result.value = Common::MakeQuiet(a);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (std::isnan(b))
|
if (std::isnan(b))
|
||||||
{
|
{
|
||||||
result.value = MakeQuiet(b); // !
|
result.value = Common::MakeQuiet(b); // !
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (std::isnan(c))
|
if (std::isnan(c))
|
||||||
{
|
{
|
||||||
result.value = MakeQuiet(c);
|
result.value = Common::MakeQuiet(c);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user