tree 7b4f2893d8c09fba67c83458efeea9396977bc70
parent 33ac02aa4cef417871e128ab4a6565e751e5f3b2
author Linus Torvalds <[EMAIL PROTECTED]> Fri, 29 Jul 2005 19:01:22 -0400
committer Linus Torvalds <[EMAIL PROTECTED]> Fri, 29 Jul 2005 19:01:22 -0400

x86: fix new find_first_bit()

Some edge problems with the original C rewrite.

Thanks go to Cal Peake, who pinpointed the breakage to the rewrite, and
tested this fixed version.

Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 include/asm-i386/bitops.h |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h
--- a/include/asm-i386/bitops.h
+++ b/include/asm-i386/bitops.h
@@ -335,14 +335,13 @@ static inline unsigned long __ffs(unsign
 static inline int find_first_bit(const unsigned long *addr, unsigned size)
 {
        int x = 0;
-       do {
-               if (*addr)
-                       return __ffs(*addr) + x;
-               addr++;
-               if (x >= size)
-                       break;
+
+       while (x < size) {
+               unsigned long val = *addr++;
+               if (val)
+                       return __ffs(val) + x;
                x += (sizeof(*addr)<<3);
-       } while (1);
+       }
        return x;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe bk-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