On non-GNUC systems, use uintmax_t in the ISC_ALIGN macro

(cherry picked from commit 2e40cc94dc)
This commit is contained in:
Ondřej Surý
2019-04-18 13:18:10 +02:00
parent 7123a4703b
commit de4fe3ed32
+7 -1
View 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