Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f10db6277dfd6dffb80b2182a256d35adb3134bc
Commit:     f10db6277dfd6dffb80b2182a256d35adb3134bc
Parent:     b0940003f25dd3d2c54c4879809a432a35197f54
Author:     Herbert Xu <[EMAIL PROTECTED]>
AuthorDate: Wed Feb 6 01:37:05 2008 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed Feb 6 10:41:04 2008 -0800

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 include/linux/kernel.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index ff356b2..18222f2 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -35,7 +35,7 @@ extern const char linux_proc_banner[];
 #define ALIGN(x,a)             __ALIGN_MASK(x,(typeof(x))(a)-1)
 #define __ALIGN_MASK(x,mask)   (((x)+(mask))&~(mask))
 #define PTR_ALIGN(p, a)                ((typeof(p))ALIGN((unsigned long)(p), 
(a)))
-#define IS_ALIGNED(x,a)                (((x) % ((typeof(x))(a))) == 0)
+#define IS_ALIGNED(x, a)               (((x) & ((typeof(x))(a) - 1)) == 0)
 
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to