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.desnoyers@efficios.com>
Change-Id: I36d981e8fb705fafa3ff23ba2d82ec1babe73e45
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
#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)
/**