From 6c98fc90cec3d653669358eac5e5b7de98db13b7 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 23 Jul 2008 15:35:22 -0700 Subject: [PATCH] --- yaml --- r: 106623 b: refs/heads/master c: 0c65f459ce6c8bd873a61b3ae1e57858ab1debf3 h: refs/heads/master i: 106621: 413ff2b0f0b959d980b35095df058b22a13a8e90 106619: cdfb00345def8736c95b0f5751a482d14d3e76ed 106615: 65e5c5cc3d687fd2e1eb7cc9809c3d42d0e6f6e9 106607: 0509aed4b31b17408d783657ff4ab7dbbe4daa79 106591: e90f6a8e1c4fe607b3c11876025d5c8e70571986 106559: 6072953793d5d91312e7eff3ecda54b82d597b6b 106495: 875b556c2a6c4cb2319b38607585bd7a1a584c3a v: v3 --- [refs] | 2 +- trunk/include/asm-arm/bitops.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 44de56457f33..98e28ce6a91f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9d9fa83beadf0a0c0ee2cd45be6e4a25cb536b67 +refs/heads/master: 0c65f459ce6c8bd873a61b3ae1e57858ab1debf3 diff --git a/trunk/include/asm-arm/bitops.h b/trunk/include/asm-arm/bitops.h index 5c60bfc1a84d..9a1db20e032a 100644 --- a/trunk/include/asm-arm/bitops.h +++ b/trunk/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) )