提交 d6d2a2ab 编写于 作者: L Linus Torvalds

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: NLinus Torvalds <torvalds@osdl.org>
上级 33ac02aa
......@@ -335,14 +335,13 @@ static inline unsigned long __ffs(unsigned long word)
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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册