summaryrefslogtreecommitdiff
path: root/include/asm-arm/bitops.h
diff options
context:
space:
mode:
authorDeepak Saxena <dsaxena@laptop.org>2008-08-10 14:05:58 -0700
committerDeepak Saxena <dsaxena@laptop.org>2008-08-10 14:05:58 -0700
commitf5931acac40cff4ec59a12db54570d0c2cb3cd91 (patch)
tree51e7b7474e349b8f9baf2b3393b27d52169698dd /include/asm-arm/bitops.h
parenta347731f82edeb8f176ae0bcfcc5d7fee6786a7c (diff)
parent3ef22854c2ddd56393d99c9c39dc80c7afe1b468 (diff)
downloadlwn-f5931acac40cff4ec59a12db54570d0c2cb3cd91.tar.gz
lwn-f5931acac40cff4ec59a12db54570d0c2cb3cd91.zip
Merge commit 'v2.6.25.14' into olpc-testing
Diffstat (limited to 'include/asm-arm/bitops.h')
-rw-r--r--include/asm-arm/bitops.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/asm-arm/bitops.h b/include/asm-arm/bitops.h
index 5c60bfc1a84d..9a1db20e032a 100644
--- a/include/asm-arm/bitops.h
+++ b/include/asm-arm/bitops.h
@@ -277,9 +277,16 @@ static inline int constant_fls(int x)
* the clz instruction for much better code efficiency.
*/
-#define fls(x) \
+#define __fls(x) \
( __builtin_constant_p(x) ? constant_fls(x) : \
({ int __r; asm("clz\t%0, %1" : "=r"(__r) : "r"(x) : "cc"); 32-__r; }) )
+
+/* Implement fls() in C so that 64-bit args are suitably truncated */
+static inline int fls(int x)
+{
+ return __fls(x);
+}
+
#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
#define __ffs(x) (ffs(x) - 1)
#define ffz(x) __ffs( ~(x) )