浏览代码

x86: Add ilog2 to bitops

ilog2 is required by AHCI driver

Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Graeme Russ 12 年之前
父节点
当前提交
8abebe3ead
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      arch/x86/include/asm/bitops.h

+ 5 - 0
arch/x86/include/asm/bitops.h

@@ -351,6 +351,11 @@ static __inline__ int ffs(int x)
 }
 }
 #define PLATFORM_FFS
 #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
  * hweightN - returns the hamming weight of a N-bit word
  * @x: the word to weigh
  * @x: the word to weigh