X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=include%2Fwimlib%2Futil.h;h=c3bac7abe46be8d0c55f105989f318860e78dd8a;hp=7f34cbf39721f0a6e411595f568474bf5db5f6c9;hb=f50557a7095444c554a066b3837c2999ecd1be31;hpb=ab63d9f11eae3b930f0f75fe0edb6b6df1cdb280 diff --git a/include/wimlib/util.h b/include/wimlib/util.h index 7f34cbf3..c3bac7ab 100644 --- a/include/wimlib/util.h +++ b/include/wimlib/util.h @@ -24,6 +24,10 @@ /* Get the number of elements of an array type. */ #define ARRAY_LEN(array) (sizeof(array) / sizeof((array)[0])) +/* Round 'v' up to the next 'alignment'-byte aligned boundary. 'alignment' must + * be a power of 2. */ +#define ALIGN(v, alignment) (((v) + ((alignment) - 1)) & ~((alignment) - 1)) + /* Maximum number of bytes that can be allocated on the stack. * * Note: this isn't a hard bound on the stack space used, since this is just for