Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 35646
b: refs/heads/master
c: 92fc707
h: refs/heads/master
v: v3
  • Loading branch information
David Howells authored and Linus Torvalds committed Sep 26, 2006
1 parent 00da0d4 commit 11363da
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 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: af8c65b57aaa4ae321af34dbfc5ca7f5625263fe
refs/heads/master: 92fc707208bb2e601c24b5ab65db37bcb361b658
21 changes: 17 additions & 4 deletions trunk/include/asm-frv/bitops.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,29 @@ static inline int __test_bit(int nr, const volatile void * addr)
#include <asm-generic/bitops/__ffs.h>
#include <asm-generic/bitops/find.h>

/*
* fls: find last bit set.
/**
* fls - find last bit set
* @x: the word to search
*
* This is defined the same way as ffs:
* - return 32..1 to indicate bit 31..0 most significant bit set
* - return 0 to indicate no bits set
*/
#define fls(x) \
({ \
int bit; \
\
asm("scan %1,gr0,%0" : "=r"(bit) : "r"(x)); \
asm(" subcc %1,gr0,gr0,icc0 \n" \
" ckne icc0,cc4 \n" \
" cscan.p %1,gr0,%0 ,cc4,#1 \n" \
" csub %0,%0,%0 ,cc4,#0 \n" \
" csub %2,%0,%0 ,cc4,#1 \n" \
: "=&r"(bit) \
: "r"(x), "r"(32) \
: "icc0", "cc4" \
); \
\
bit ? 33 - bit : bit; \
bit; \
})

#include <asm-generic/bitops/fls64.h>
Expand Down

0 comments on commit 11363da

Please sign in to comment.