aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-04-26 09:33:25 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-04-26 09:33:25 +0100
commit5654f9842777a502b502056854a7e77edc4f02d7 (patch)
tree4b8b917a22174650512a476e3d32d35c2b5ec5ad /contrib
parent8c1652f23276390406aea9cf2bdf75222bfece3e (diff)
downloadrspamd-5654f9842777a502b502056854a7e77edc4f02d7.tar.gz
rspamd-5654f9842777a502b502056854a7e77edc4f02d7.zip
[Minor] Add workaround for pre-historic compilers
Issue: #605
Diffstat (limited to 'contrib')
-rw-r--r--contrib/lc-btrie/btrie.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/contrib/lc-btrie/btrie.c b/contrib/lc-btrie/btrie.c
index 9d78caa9b..d95bf0676 100644
--- a/contrib/lc-btrie/btrie.c
+++ b/contrib/lc-btrie/btrie.c
@@ -310,9 +310,27 @@
#include "btrie.h"
#include "libutil/mem_pool.h"
-#if __SIZEOF_POINTER__ == 4
+#ifdef __SIZEOF_POINTER__
+#define SIZEOF_VOID_P __SIZEOF_POINTER__
+#else
+#if defined(__ILP32__) || defined(__ILP32) || defined(_ILP32)
+# define SIZEOF_VOID_P 4
+#elif defined(__ILP64__) || defined(__ILP64) || defined(_ILP64)
+# define SIZEOF_VOID_P 8
+#elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64)
+# define SIZEOF_VOID_P 8
+#elif defined(__LP64__) || defined(__LP64) || defined(_LP64)
+# define SIZEOF_VOID_P 8
+#elif defined(UINTPTR_MAX) && defined(UINT64_MAX) && (UINTPTR_MAX == UINT64_MAX)
+# define SIZEOF_VOID_P 8
+#else
+# define SIZEOF_VOID_P 4
+#endif
+#endif
+
+#if SIZEOF_VOID_P == 4
# define TBM_STRIDE 4
-#elif __SIZEOF_POINTER__ == 8
+#elif SIZEOF_VOID_P == 8
# define TBM_STRIDE 5
#else
# error "Unsupported word size"
@@ -343,7 +361,7 @@ typedef long unsigned tbm_bitmap_t;
#endif
#define TBM_FANOUT (1U << TBM_STRIDE)
-#define LC_BYTES_PER_NODE (__SIZEOF_POINTER__ - 1)
+#define LC_BYTES_PER_NODE (SIZEOF_VOID_P - 1)
typedef union node_u node_t;