Skip to content

Commit

Permalink
Simplify lua_cmsgpack macro and fix build on old Linux distros.
Browse files Browse the repository at this point in the history
Thanks to @badboy for the help in checking the build after the fix.
  • Loading branch information
antirez committed Dec 5, 2014
1 parent e7d6f51 commit edd7ab3
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions deps/lua/src/lua_cmsgpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,8 @@
#define LUACMSGPACK_MAX_NESTING 16 /* Max tables nesting. */
#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 */
#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_INT_EQUIVALENT(x) IS_INT_TYPE_EQUIVALENT(x, int)
Expand Down

0 comments on commit edd7ab3

Please sign in to comment.