[PATCH 1/6] include/linux/kernel.h: use generic round_up_pow2() macro

From: Nick Wilson
Date: Thu Apr 07 2005 - 19:50:30 EST


From: Nick Wilson <njw@xxxxxxxx>

Add a generic macro to kernel.h to round up to the next multiple of n.

Signed-off-by: Nick Wilson <njw@xxxxxxxx>
---


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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/