This source file includes following definitions.
- ffs
- __ffs
- fls
- __fls
1
2
3
4 #ifndef __ASM_CSKY_BITOPS_H
5 #define __ASM_CSKY_BITOPS_H
6
7 #include <linux/compiler.h>
8 #include <asm/barrier.h>
9
10
11
12
13 static inline int ffs(int x)
14 {
15 if (!x)
16 return 0;
17
18 asm volatile (
19 "brev %0\n"
20 "ff1 %0\n"
21 "addi %0, 1\n"
22 : "=&r"(x)
23 : "0"(x));
24 return x;
25 }
26
27
28
29
30 static __always_inline unsigned long __ffs(unsigned long x)
31 {
32 asm volatile (
33 "brev %0\n"
34 "ff1 %0\n"
35 : "=&r"(x)
36 : "0"(x));
37 return x;
38 }
39
40
41
42
43 static __always_inline int fls(unsigned int x)
44 {
45 asm volatile(
46 "ff1 %0\n"
47 : "=&r"(x)
48 : "0"(x));
49
50 return (32 - x);
51 }
52
53
54
55
56 static __always_inline unsigned long __fls(unsigned long x)
57 {
58 return fls(x) - 1;
59 }
60
61 #include <asm-generic/bitops/ffz.h>
62 #include <asm-generic/bitops/fls64.h>
63 #include <asm-generic/bitops/find.h>
64
65 #ifndef _LINUX_BITOPS_H
66 #error only <linux/bitops.h> can be included directly
67 #endif
68
69 #include <asm-generic/bitops/sched.h>
70 #include <asm-generic/bitops/hweight.h>
71 #include <asm-generic/bitops/lock.h>
72 #include <asm-generic/bitops/atomic.h>
73
74
75
76
77 #include <asm-generic/bitops/non-atomic.h>
78 #define __clear_bit(nr, vaddr) clear_bit(nr, vaddr)
79
80 #include <asm-generic/bitops/le.h>
81 #include <asm-generic/bitops/ext2-atomic.h>
82 #endif