Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 106623
b: refs/heads/master
c: 0c65f45
h: refs/heads/master
i:
  106621: 413ff2b
  106619: cdfb003
  106615: 65e5c5c
  106607: 0509aed
  106591: e90f6a8
  106559: 6072953
  106495: 875b556
v: v3
  • Loading branch information
Andrew Morton authored and Russell King committed Jul 26, 2008
1 parent d822592 commit 6c98fc9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9d9fa83beadf0a0c0ee2cd45be6e4a25cb536b67
refs/heads/master: 0c65f459ce6c8bd873a61b3ae1e57858ab1debf3
9 changes: 8 additions & 1 deletion trunk/include/asm-arm/bitops.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) )
Expand Down

0 comments on commit 6c98fc9

Please sign in to comment.