From e5360b66d45577cc8582dda0c952fa539d65bbd9 Mon Sep 17 00:00:00 2001 From: Inaky Perez-Gonzalez Date: Thu, 7 May 2009 14:57:19 -0700 Subject: libwimaxll: add WIMAXLL_ALIGN2() to align values to powers-of-two Signed-off-by: Inaky Perez-Gonzalez --- include/wimaxll.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/wimaxll.h b/include/wimaxll.h index 5c4f4e2..ece869b 100644 --- a/include/wimaxll.h +++ b/include/wimaxll.h @@ -568,4 +568,11 @@ unsigned long wimaxll_be32_to_cpu(unsigned long be32) return cpu; } + +#define __WIMAXLL_ALIGN2_MASK(n, m) (((n) + (m)) & ~(m)) +/** + * Return the value \e n aligned to an order-of-two value \a o2. + */ +#define WIMAXLL_ALIGN2(n, o2) __WIMAXLL_ALIGN2_MASK(n, (typeof(n)) (o2) - 1) + #endif /* #ifndef __lib_wimaxll_h__ */ -- cgit v1.2.3