From: Oliver Kurth Date: Fri, 23 Mar 2018 22:05:36 +0000 (-0700) Subject: Common header file change: lib/include/vm_basic_math.h X-Git-Tag: stable-10.3.0~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9414d19532a9664e6c260a8644ee09200e32429;p=thirdparty%2Fopen-vm-tools.git Common header file change: lib/include/vm_basic_math.h Define portability macros for Inf and Nan tests. --- diff --git a/open-vm-tools/lib/include/vm_basic_math.h b/open-vm-tools/lib/include/vm_basic_math.h index 065ba368f..5dfa85b31 100644 --- a/open-vm-tools/lib/include/vm_basic_math.h +++ b/open-vm-tools/lib/include/vm_basic_math.h @@ -108,6 +108,38 @@ GetPowerOfTwo(uint32 x) } +/* + *---------------------------------------------------------------------- + * + * IsFinite -- + * IsInf -- + * IsNan -- + * + * Portability macros that test floats against -/+Inf and NaN. + * + *---------------------------------------------------------------------- + */ + +#ifdef _WIN32 +#include + +#define IsFinite(x) _finite(x) +#define IsNan(x) _isnan(x) + +static INLINE Bool +IsInf(double x) +{ + return !_finite(x) && !_isnan(x); +} +#else +#include + +#define IsFinite(x) isfinite(x) +#define IsInf(x) isinf(x) +#define IsNan(x) isnan(x) +#endif + + #if !defined(_WIN32) && !defined(_WIN64) /* *-----------------------------------------------------------------------------