Remove custom implementations of isinf and isnan
Use the ones from the <cmath> header instead, now that that is available on all the currently supported versions of MSVC.
This commit is contained in:
parent
6b72472f28
commit
f6cc939499
3 changed files with 4 additions and 32 deletions
|
|
@ -292,34 +292,6 @@ template <class T> int IntLog2(T n)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsInfinity(double x) {
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
switch (_fpclass(x)) {
|
|
||||||
case _FPCLASS_NINF:
|
|
||||||
case _FPCLASS_PINF:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return std::isinf(x);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool IsNan(double x) {
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
switch (_fpclass(x)) {
|
|
||||||
case _FPCLASS_SNAN:
|
|
||||||
case _FPCLASS_QNAN:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return std::isnan(x);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end namespace glslang
|
} // end namespace glslang
|
||||||
|
|
||||||
#endif // _COMMON_INCLUDED_
|
#endif // _COMMON_INCLUDED_
|
||||||
|
|
|
||||||
|
|
@ -628,12 +628,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
||||||
|
|
||||||
case EOpIsNan:
|
case EOpIsNan:
|
||||||
{
|
{
|
||||||
newConstArray[i].setBConst(IsNan(unionArray[i].getDConst()));
|
newConstArray[i].setBConst(std::isnan(unionArray[i].getDConst()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EOpIsInf:
|
case EOpIsInf:
|
||||||
{
|
{
|
||||||
newConstArray[i].setBConst(IsInfinity(unionArray[i].getDConst()));
|
newConstArray[i].setBConst(std::isinf(unionArray[i].getDConst()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1208,12 +1208,12 @@ bool TOutputTraverser::visitSelection(TVisit /* visit */, TIntermSelection* node
|
||||||
// - shows all digits, no premature rounding
|
// - shows all digits, no premature rounding
|
||||||
static void OutputDouble(TInfoSink& out, double value, TOutputTraverser::EExtraOutput extra)
|
static void OutputDouble(TInfoSink& out, double value, TOutputTraverser::EExtraOutput extra)
|
||||||
{
|
{
|
||||||
if (IsInfinity(value)) {
|
if (std::isinf(value)) {
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
out.debug << "-1.#INF";
|
out.debug << "-1.#INF";
|
||||||
else
|
else
|
||||||
out.debug << "+1.#INF";
|
out.debug << "+1.#INF";
|
||||||
} else if (IsNan(value))
|
} else if (std::isnan(value))
|
||||||
out.debug << "1.#IND";
|
out.debug << "1.#IND";
|
||||||
else {
|
else {
|
||||||
const int maxSize = 340;
|
const int maxSize = 340;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue