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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux