generic: implement __fls on all 64-bit archs

Implement __fls on all 64-bit archs:

alpha has an implementation of fls64.
	Added __fls(x) = fls64(x) - 1.

ia64 has fls, but not __fls.
	Added __fls based on code of fls.

mips and powerpc have __ilog2, which is the same as __fls.
	Added __fls = __ilog2.

parisc, s390, sh and sparc64:
	Include generic __fls.

x86_64 already has __fls.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Alexander van Heukelum
2008-03-15 18:31:49 +01:00
committed by Ingo Molnar
parent 7d9dff22e8
commit 56a6b1eb7b
8 changed files with 35 additions and 0 deletions
+5
View File
@@ -388,6 +388,11 @@ static inline int fls64(unsigned long x)
}
#endif
static inline unsigned long __fls(unsigned long x)
{
return fls64(x) - 1;
}
static inline int fls(int x)
{
return fls64((unsigned int) x);