Fixed conflicts with isnan() and isinf() macros (fixes #752)

This commit is contained in:
Benoit Blanchon
2018-06-11 12:21:50 +02:00
parent 393f352b70
commit c3403ed72d
4 changed files with 21 additions and 4 deletions

View File

@ -6,14 +6,22 @@
namespace ArduinoJson {
namespace Internals {
// Some libraries #define isnan() and isinf() so we need to check before
// using this name
#ifndef isnan
template <typename T>
bool isnan(T x) {
return x != x;
}
#endif
#ifndef isinf
template <typename T>
bool isinf(T x) {
return x != 0.0 && x * 2 == x;
}
#endif
} // namespace Internals
} // namespace ArduinoJson