1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-31 03:00:05 +00:00

Added some template specialisation to the juce_isfinite method, so that it can safely be called for integer types too.

This commit is contained in:
jules 2015-04-01 11:48:51 +01:00
parent a1dfafe2c8
commit 5ce5d95064

View file

@ -345,8 +345,26 @@ const float float_Pi = 3.14159265358979323846f;
/** The isfinite() method seems to vary between platforms, so this is a
platform-independent function for it.
*/
template <typename FloatingPointType>
inline bool juce_isfinite (FloatingPointType value)
template <typename NumericType>
inline bool juce_isfinite (NumericType value) noexcept
{
return true; // Integer types are always finite
}
template <>
inline bool juce_isfinite (float value) noexcept
{
#if JUCE_WINDOWS
return _finite (value);
#elif JUCE_ANDROID
return isfinite (value);
#else
return std::isfinite (value);
#endif
}
template <>
inline bool juce_isfinite (double value) noexcept
{
#if JUCE_WINDOWS
return _finite (value);