Workaround use of private constant _Snan no longer being present in <limits>.
This commit is contained in:
parent
3f96f96f14
commit
a0af0bf588
|
@ -10,6 +10,18 @@
|
||||||
#include "Common/BitUtils.h"
|
#include "Common/BitUtils.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
|
||||||
|
// MSVC needs a workaround, because its std::numeric_limits<double>::signaling_NaN()
|
||||||
|
// will use __builtin_nans, which is improperly handled by the compiler and generates
|
||||||
|
// a bad constant. Here we go back to the version MSVC used before the builtin.
|
||||||
|
// TODO: Remove this and use numeric_limits directly whenever this bug is fixed.
|
||||||
|
// See Visual Studio bug # 128935 "std::numeric_limits<float>::signaling_NaN() is broken"
|
||||||
|
|
||||||
|
#include <ymath.h>
|
||||||
|
|
||||||
|
#endif // _MSC_VER
|
||||||
|
|
||||||
namespace Common
|
namespace Common
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -20,10 +32,7 @@ constexpr T SNANConstant()
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
||||||
// MSVC needs a workaround, because its std::numeric_limits<double>::signaling_NaN()
|
// See workaround note above.
|
||||||
// will use __builtin_nans, which is improperly handled by the compiler and generates
|
|
||||||
// a bad constant. Here we go back to the version MSVC used before the builtin.
|
|
||||||
// TODO: Remove this and use numeric_limits directly whenever this bug is fixed.
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
constexpr double SNANConstant()
|
constexpr double SNANConstant()
|
||||||
|
@ -36,7 +45,7 @@ constexpr float SNANConstant()
|
||||||
return (_CSTD _Snan._Float);
|
return (_CSTD _Snan._Float);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // _MSC_VER
|
||||||
|
|
||||||
// The most significant bit of the fraction is an is-quiet bit on all architectures we care about.
|
// The most significant bit of the fraction is an is-quiet bit on all architectures we care about.
|
||||||
enum : u64
|
enum : u64
|
||||||
|
|
Loading…
Reference in New Issue