aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386/bitops.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-i386/bitops.h')
-rw-r--r--include/asm-i386/bitops.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h
index 26eb9811712f..65679aca4b22 100644
--- a/include/asm-i386/bitops.h
+++ b/include/asm-i386/bitops.h
@@ -367,11 +367,6 @@ static inline unsigned long ffz(unsigned long word)
367 return word; 367 return word;
368} 368}
369 369
370/*
371 * fls: find last bit set.
372 */
373
374#define fls(x) generic_fls(x)
375#define fls64(x) generic_fls64(x) 370#define fls64(x) generic_fls64(x)
376 371
377#ifdef __KERNEL__ 372#ifdef __KERNEL__
@@ -415,6 +410,23 @@ static inline int ffs(int x)
415} 410}
416 411
417/** 412/**
413 * fls - find last bit set
414 * @x: the word to search
415 *
416 * This is defined the same way as ffs.
417 */
418static inline int fls(int x)
419{
420 int r;
421
422 __asm__("bsrl %1,%0\n\t"
423 "jnz 1f\n\t"
424 "movl $-1,%0\n"
425 "1:" : "=r" (r) : "rm" (x));
426 return r+1;
427}
428
429/**
418 * hweightN - returns the hamming weight of a N-bit word 430 * hweightN - returns the hamming weight of a N-bit word
419 * @x: the word to weigh 431 * @x: the word to weigh
420 * 432 *