From: Stanislav K. <sta...@or...> - 2013-08-27 12:50:13
|
Signed-off-by: Stanislav Kholmanskikh <sta...@or...> --- include/compiler.h | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/include/compiler.h b/include/compiler.h index ec714fe..4b41f65 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -15,4 +15,10 @@ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) #endif +/* Round x to the next multiple of a. + * a should be a power of 2. + */ +#define LTP_ALIGN(x, a) __LTP_ALIGN_MASK(x, (typeof(x))(a) - 1) +#define __LTP_ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) + #endif /* __LTP_COMPILER_H__ */ -- 1.7.1 |