Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | Date | Thu, 7 Apr 2005 17:48:35 -0700 | From | Nick Wilson <> | Subject | [PATCH 1/6] include/linux/kernel.h: use generic round_up_pow2() macro |
| |
From: Nick Wilson <njw@osdl.org>
Add a generic macro to kernel.h to round up to the next multiple of n.
Signed-off-by: Nick Wilson <njw@osdl.org> ---
kernel.h | 5 +++++ 1 files changed, 5 insertions(+)
Index: linux/include/linux/kernel.h =================================================================== --- linux.orig/include/linux/kernel.h 2005-04-07 15:13:56.000000000 -0700 +++ linux/include/linux/kernel.h 2005-04-07 15:47:15.000000000 -0700 @@ -246,6 +246,11 @@ extern void dump_stack(void); #define max_t(type,x,y) \ ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) +/* + * Round x up to the next multiple of n. + * n must be a power of 2. + */ +#define round_up_pow2(x,n) (((x) + (n) - 1) & ~((n) - 1)) /** * container_of - cast a member of a structure out to the containing structure _ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| ![\](/images/icornerr.gif) |