]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add workaround for pre-historic compilers
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 26 Apr 2016 08:33:25 +0000 (09:33 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 26 Apr 2016 08:33:25 +0000 (09:33 +0100)
Issue: #605

contrib/lc-btrie/btrie.c

index 9d78caa9bd4cd9926c3c4a9febacf60cb8c3b7ca..d95bf0676d1ac1e3aa2b31b21b9af8eeba8bc118 100644 (file)
 #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;