1#ifndef _ASM_CRIS_ARCH_BITOPS_H
2#define _ASM_CRIS_ARCH_BITOPS_H
3
4
5
6
7
8
9
10
11static inline unsigned long
12cris_swapnwbrlz(unsigned long w)
13{
14 unsigned long res;
15
16 __asm__ __volatile__ ("swapnwbr %0\n\t"
17 "lz %0,%0"
18 : "=r" (res) : "0" (w));
19
20 return res;
21}
22
23static inline unsigned long
24cris_swapwbrlz(unsigned long w)
25{
26 unsigned long res;
27
28 __asm__ __volatile__ ("swapwbr %0\n\t"
29 "lz %0,%0"
30 : "=r" (res) : "0" (w));
31
32 return res;
33}
34
35
36
37
38
39static inline unsigned long
40ffz(unsigned long w)
41{
42 return cris_swapnwbrlz(w);
43}
44
45
46
47
48
49static inline unsigned long
50__ffs(unsigned long w)
51{
52 return cris_swapnwbrlz(~w);
53}
54
55
56
57
58static inline unsigned long
59kernel_ffs(unsigned long w)
60{
61 return w ? cris_swapwbrlz (w) + 1 : 0;
62}
63
64#endif
65