Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 35648
b: refs/heads/master
c: cf13448
h: refs/heads/master
v: v3
  • Loading branch information
David Howells authored and Linus Torvalds committed Sep 26, 2006
1 parent 2d9c780 commit 8823036
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 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: a8ad27d03f17e6154c61e81d4a7028c56ca6390d
refs/heads/master: cf134483b2cd657039b305777215c531a1009947
33 changes: 31 additions & 2 deletions trunk/include/asm-frv/bitops.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ static inline int __test_bit(int nr, const volatile void * addr)
__constant_test_bit((nr),(addr)) : \
__test_bit((nr),(addr)))

#include <asm-generic/bitops/ffs.h>
#include <asm-generic/bitops/__ffs.h>
#include <asm-generic/bitops/find.h>

/**
Expand Down Expand Up @@ -227,6 +225,37 @@ int fls64(u64 n)

}

/**
* ffs - find first bit set
* @x: the word to search
*
* - return 32..1 to indicate bit 31..0 most least significant bit set
* - return 0 to indicate no bits set
*/
static inline __attribute__((const))
int ffs(int x)
{
/* Note: (x & -x) gives us a mask that is the least significant
* (rightmost) 1-bit of the value in x.
*/
return fls(x & -x);
}

/**
* __ffs - find first bit set
* @x: the word to search
*
* - return 31..0 to indicate bit 31..0 most least significant bit set
* - if no bits are set in x, the result is undefined
*/
static inline __attribute__((const))
int __ffs(unsigned long x)
{
int bit;
asm("scan %1,gr0,%0" : "=r"(bit) : "r"(x & -x));
return 31 - bit;
}

#include <asm-generic/bitops/sched.h>
#include <asm-generic/bitops/hweight.h>

Expand Down

0 comments on commit 8823036

Please sign in to comment.