Simplify lua_cmsgpack macro and fix build on old Linux distros.

Thanks to @badboy for the help in checking the build after the fix.
This commit is contained in:
antirez 2014-12-05 10:51:09 +01:00
parent c3846becae
commit ff25d1896d

View File

@ -18,14 +18,8 @@
#define LUACMSGPACK_MAX_NESTING 16 /* Max tables nesting. */ #define LUACMSGPACK_MAX_NESTING 16 /* Max tables nesting. */
#endif #endif
#if (_XOPEN_SOURCE >= 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L)
#define IS_FINITE(x) isfinite(x)
#else
#define IS_FINITE(x) ((x) == (x) && (x) + 1 > (x))
#endif
/* Check if float or double can be an integer without loss of precision */ /* Check if float or double can be an integer without loss of precision */
#define IS_INT_TYPE_EQUIVALENT(x, T) (IS_FINITE(x) && (T)(x) == (x)) #define IS_INT_TYPE_EQUIVALENT(x, T) (!isinf(x) && (T)(x) == (x))
#define IS_INT64_EQUIVALENT(x) IS_INT_TYPE_EQUIVALENT(x, int64_t) #define IS_INT64_EQUIVALENT(x) IS_INT_TYPE_EQUIVALENT(x, int64_t)
#define IS_INT_EQUIVALENT(x) IS_INT_TYPE_EQUIVALENT(x, int) #define IS_INT_EQUIVALENT(x) IS_INT_TYPE_EQUIVALENT(x, int)