Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] bitops: generic fls64()

This patch introduces the C-language equivalent of the function: int
fls64(__u64 x);

In include/asm-generic/bitops/fls64.h

This code largely copied from: include/linux/bitops.h

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Akinobu Mita and committed by
Linus Torvalds
2dfc383a 136abb32

+12
+12
include/asm-generic/bitops/fls64.h
··· 1 + #ifndef _ASM_GENERIC_BITOPS_FLS64_H_ 2 + #define _ASM_GENERIC_BITOPS_FLS64_H_ 3 + 4 + static inline int fls64(__u64 x) 5 + { 6 + __u32 h = x >> 32; 7 + if (h) 8 + return fls(h) + 32; 9 + return fls(x); 10 + } 11 + 12 + #endif /* _ASM_GENERIC_BITOPS_FLS64_H_ */