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:
parent
a1dfafe2c8
commit
5ce5d95064
1 changed files with 20 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue