summaryrefslogtreecommitdiff
path: root/include/my_global.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/my_global.h')
-rw-r--r--include/my_global.h39
1 files changed, 24 insertions, 15 deletions
diff --git a/include/my_global.h b/include/my_global.h
index 5c325b76a7b..1b17721ddcc 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -178,7 +178,7 @@
/*
The macros below are borrowed from include/linux/compiler.h in the
- Linux kernel. Use them to indicate the likelyhood of the truthfulness
+ Linux kernel. Use them to indicate the likelihood of the truthfulness
of a condition. This serves two purposes - newer versions of gcc will be
able to optimize for branch predication, which could yield siginficant
performance gains in frequently executed sections of the code, and the
@@ -527,7 +527,7 @@ typedef SOCKET my_socket;
typedef int my_socket; /* File descriptor for sockets */
#define INVALID_SOCKET -1
#endif
-/* Type for fuctions that handles signals */
+/* Type for functions that handles signals */
#define sig_handler RETSIGTYPE
C_MODE_START
#ifdef HAVE_SIGHANDLER_T
@@ -802,26 +802,35 @@ inline unsigned long long my_double2ulonglong(double d)
#define SIZE_T_MAX (~((size_t) 0))
#endif
+#ifndef HAVE_FINITE
+#define finite(x) (1.0 / fabs(x) > 0.0)
+#endif
+
#ifndef isfinite
-#ifdef HAVE_FINITE
#define isfinite(x) finite(x)
-#else
-#define finite(x) (1.0 / fabs(x) > 0.0)
-#endif /* HAVE_FINITE */
-#elif (__cplusplus >= 201103L)
-#include <cmath>
-static inline bool isfinite(double x) { return std::isfinite(x); }
-#endif /* isfinite */
+#endif
#ifndef HAVE_ISNAN
#define isnan(x) ((x) != (x))
#endif
#define my_isnan(x) isnan(x)
-#ifdef HAVE_ISINF
+#ifndef HAVE_ISINF
+#define isinf(X) (!isfinite(X) && !isnan(X))
+#endif
#define my_isinf(X) isinf(X)
-#else /* !HAVE_ISINF */
-#define my_isinf(X) (!finite(X) && !isnan(X))
+
+#ifdef __cplusplus
+#include <cmath>
+#ifndef isfinite
+#define isfinite(X) std::isfinite(X)
+#endif
+#ifndef isnan
+#define isnan(X) std::isnan(X)
+#endif
+#ifndef isinf
+#define isinf(X) std::isinf(X)
+#endif
#endif
/* Define missing math constants. */
@@ -848,7 +857,7 @@ static inline double log2(double x)
/*
Max size that must be added to a so that we know Size to make
- adressable obj.
+ addressable obj.
*/
#if SIZEOF_CHARP == 4
typedef long my_ptrdiff_t;
@@ -860,7 +869,7 @@ typedef long long my_ptrdiff_t;
#define MY_ALIGN_DOWN(A,L) ((A) & ~((L) - 1))
#define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double))
#define ALIGN_MAX_UNIT (sizeof(double))
-/* Size to make adressable obj. */
+/* Size to make addressable obj. */
#define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A), sizeof(double)))
#define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size)
#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B))