aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2008-02-06 04:37:05 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 13:41:04 -0500
commitf10db6277dfd6dffb80b2182a256d35adb3134bc (patch)
treea86607ebc3567c2e4098907f986466e07a74f268
parentb0940003f25dd3d2c54c4879809a432a35197f54 (diff)
Avoid divide in IS_ALIGN
I was happy to discover the brand new IS_ALIGN macro and quickly used it in my code. To my dismay I found that the generated code used division to perform the test. This patch fixes it by changing the % test to an &. This avoids the division. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/kernel.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index ff356b2ee478..18222f267bc4 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -35,7 +35,7 @@ extern const char linux_proc_banner[];
35#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) 35#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
36#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) 36#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
37#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) 37#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
38#define IS_ALIGNED(x,a) (((x) % ((typeof(x))(a))) == 0) 38#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
39 39
40#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) 40#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
41 41