From patchwork Sun Apr 29 12:00:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [U-Boot,5/5] x86: Add ilog2 to bitops Date: Sun, 29 Apr 2012 02:00:23 -0000 From: Graeme Russ X-Patchwork-Id: 155731 Message-Id: <1335700823-15144-6-git-send-email-graeme.russ@gmail.com> To: u-boot@lists.denx.de ilog2 is required by AHCI driver Signed-off-by: Graeme Russ --- arch/x86/include/asm/bitops.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h index c7a38f2..5a7e4cb 100644 --- a/arch/x86/include/asm/bitops.h +++ b/arch/x86/include/asm/bitops.h @@ -351,6 +351,11 @@ static __inline__ int ffs(int x) } #define PLATFORM_FFS +static inline int __ilog2(unsigned int x) +{ + return generic_fls(x) - 1; +} + /** * hweightN - returns the hamming weight of a N-bit word * @x: the word to weigh