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

This commit is contained in:
Ondřej Surý 2019-04-18 11:49:10 +02:00
parent 9d329a5e74
commit 2e40cc94dc

View file

@ -12,6 +12,8 @@
#ifndef ISC_UTIL_H
#define ISC_UTIL_H 1
#include <inttypes.h>
/*! \file isc/util.h
* NOTE:
*
@ -264,7 +266,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