Browse Source

Math: make Constants::inf() work with clang-cl 8.

Using a similar workaround as for nan(). It works with version 9 tho.
mousecapture
Vladimír Vondruš 6 years ago
parent
commit
d4f7c853ae
  1. 18
      src/Magnum/Math/Constants.h

18
src/Magnum/Math/Constants.h

@ -184,7 +184,14 @@ template<> struct Constants<Double> {
return Double(NAN); return Double(NAN);
#endif #endif
} }
static constexpr Double inf() { return HUGE_VAL; } static constexpr Double inf() {
/* Same as above, but only for clang-cl 8. 9 has that fixed */
#if defined(CORRADE_TARGET_CLANG_CL) && __clang_major__ < 9
return __builtin_huge_val();
#else
return HUGE_VAL;
#endif
}
}; };
template<> struct Constants<Float> { template<> struct Constants<Float> {
Constants() = delete; Constants() = delete;
@ -212,7 +219,14 @@ template<> struct Constants<Float> {
return NAN; return NAN;
#endif #endif
} }
static constexpr Float inf() { return HUGE_VALF; } static constexpr Float inf() {
/* Same as above, but only for clang-cl 8. 9 has that fixed */
#if defined(CORRADE_TARGET_CLANG_CL) && __clang_major__ < 9
return __builtin_huge_valf();
#else
return HUGE_VALF;
#endif
}
}; };
#endif #endif

Loading…
Cancel
Save