]>
Commit | Line | Data |
---|---|---|
cf02880e MM |
1 | diff -ur linux-/include/asm-i386/bitops.h linux/include/asm-i386/bitops.h |
2 | --- linux-/include/asm-i386/bitops.h Thu Nov 22 20:46:18 2001 | |
3 | +++ linux/include/asm-i386/bitops.h Tue Mar 5 21:08:15 2002 | |
4 | @@ -316,6 +316,8 @@ | |
5 | return (offset + set + res); | |
6 | } | |
7 | ||
8 | +#include <linux/bitops.h> | |
9 | + | |
10 | /** | |
11 | * ffz - find first zero in word. | |
12 | * @word: The word to search | |
801b89f9 | 13 | @@ -447,13 +447,19 @@ |
cf02880e MM |
14 | */ |
15 | static __inline__ int ffs(int x) | |
16 | { | |
17 | - int r; | |
18 | - | |
19 | - __asm__("bsfl %1,%0\n\t" | |
20 | - "jnz 1f\n\t" | |
21 | - "movl $-1,%0\n" | |
801b89f9 | 22 | - "1:" : "=r" (r) : "rm" (x)); |
cf02880e MM |
23 | - return r+1; |
24 | + /* The generic_ffs function is used to avoid the asm when the | |
25 | + argument is a constant. */ | |
26 | + if (__builtin_constant_p (x)) { | |
27 | + return generic_ffs (x); | |
28 | + } else { | |
29 | + int r; | |
30 | + | |
31 | + __asm__("bsfl %1,%0\n\t" | |
32 | + "jnz 1f\n\t" | |
33 | + "movl $-1,%0\n" | |
f49d23f7 | 34 | + "1:" : "=r" (r) : "rm" (x)); |
cf02880e MM |
35 | + return r+1; |
36 | + } | |
37 | } | |
38 | ||
39 | /** |