]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
On non-GNUC systems, use uintmax_t in the ISC_ALIGN macro
authorOndřej Surý <ondrej@sury.org>
Thu, 18 Apr 2019 09:49:10 +0000 (11:49 +0200)
committerOndřej Surý <ondrej@sury.org>
Thu, 18 Apr 2019 11:18:10 +0000 (13:18 +0200)
(cherry picked from commit 2e40cc94dc5ed7753c7e8a3ff128d60dbb4e3e2b)

lib/isc/include/isc/util.h

index f358dbf4f3803e6bda9bb348f4d8f945704bdad2..014be2a0d07c1659caa5eae6ac8fe8c68a85d5bd 100644 (file)
@@ -12,6 +12,8 @@
 #ifndef ISC_UTIL_H
 #define ISC_UTIL_H 1
 
+#include <inttypes.h>
+
 /*! \file isc/util.h
  * NOTE:
  *
@@ -287,7 +289,11 @@ extern void mock_assert(const int result, const char* const expression,
 /*%
  * Alignment
  */
-#define ISC_ALIGN(x, a) (((x) + (a) - 1) & ~((typeof(x))(a)-1))
+#ifdef __GNUC__
+#define ISC_ALIGN(x, a) (((x) + (a) - 1) & ~((typeof(x))(a) - 1))
+#else
+#define ISC_ALIGN(x, a) (((x) + (a) - 1) & ~((uintmax_t)(a) - 1))
+#endif
 
 /*%
  * Misc