[PATCH 1/6] include/linux/kernel.h: use generic round_up_pow2() macro
From: Nick Wilson <[EMAIL PROTECTED]> Add a generic macro to kernel.h to round up to the next multiple of n. Signed-off-by: Nick Wilson <[EMAIL PROTECTED]> --- 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.0 -0700 +++ linux/include/linux/kernel.h2005-04-07 15:47:15.0 -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 [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/6] include/linux/kernel.h: use generic round_up_pow2() macro
From: Nick Wilson [EMAIL PROTECTED] Add a generic macro to kernel.h to round up to the next multiple of n. Signed-off-by: Nick Wilson [EMAIL PROTECTED] --- 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.0 -0700 +++ linux/include/linux/kernel.h2005-04-07 15:47:15.0 -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 [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/