~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/asm-generic/bitops/fls.h

Version: ~ [ linux-5.4-rc3 ] ~ [ linux-5.3.6 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.79 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.149 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.196 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.196 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.75 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _ASM_GENERIC_BITOPS_FLS_H_
  2 #define _ASM_GENERIC_BITOPS_FLS_H_
  3 
  4 /**
  5  * fls - find last (most-significant) bit set
  6  * @x: the word to search
  7  *
  8  * This is defined the same way as ffs.
  9  * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
 10  */
 11 
 12 static __always_inline int fls(int x)
 13 {
 14         int r = 32;
 15 
 16         if (!x)
 17                 return 0;
 18         if (!(x & 0xffff0000u)) {
 19                 x <<= 16;
 20                 r -= 16;
 21         }
 22         if (!(x & 0xff000000u)) {
 23                 x <<= 8;
 24                 r -= 8;
 25         }
 26         if (!(x & 0xf0000000u)) {
 27                 x <<= 4;
 28                 r -= 4;
 29         }
 30         if (!(x & 0xc0000000u)) {
 31                 x <<= 2;
 32                 r -= 2;
 33         }
 34         if (!(x & 0x80000000u)) {
 35                 x <<= 1;
 36                 r -= 1;
 37         }
 38         return r;
 39 }
 40 
 41 #endif /* _ASM_GENERIC_BITOPS_FLS_H_ */
 42 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp