Implement the ALIGN_FLOOR macro which aligns the given value to the previous alignment boundary, or keeps the value as-is if it is already aligned.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoy...@efficios.com> --- src/common/align.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/common/align.h b/src/common/align.h index ed353206..c8d9d517 100644 --- a/src/common/align.h +++ b/src/common/align.h @@ -35,6 +35,12 @@ #define ALIGN(v, align) __ALIGN_MASK(v, (__typeof__(v)) (align) - 1) #endif +#define __ALIGN_FLOOR_MASK(v, mask) ((v) & ~(mask)) + +#ifndef ALIGN_FLOOR +#define ALIGN_FLOOR(v, align) __ALIGN_FLOOR_MASK(v, (__typeof__(v)) (align) - 1) +#endif + #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE) /** -- 2.17.1 _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev