lkml.org 
[lkml]   [2005]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
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/
\
 
 \ /
  Last update: 2005-04-08 02:52    [W:0.140 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site