diff options
Diffstat (limited to 'payloads/libpayload/include/stdlib.h')
-rw-r--r-- | payloads/libpayload/include/stdlib.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/payloads/libpayload/include/stdlib.h b/payloads/libpayload/include/stdlib.h index 7113b6f7d3..91d854ec67 100644 --- a/payloads/libpayload/include/stdlib.h +++ b/payloads/libpayload/include/stdlib.h @@ -35,6 +35,11 @@ #include <stddef.h> #include <string.h> +#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1UL) +#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) +#define ALIGN_UP(x,a) ALIGN((x),(a)) +#define ALIGN_DOWN(x,a) ((x) & ~((typeof(x))(a)-1UL)) + /** * @defgroup malloc Memory allocation functions * @{ |