diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/linux/bitops.h | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'include/linux/bitops.h')
-rw-r--r-- | include/linux/bitops.h | 60 |
1 files changed, 13 insertions, 47 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index fc68053378ce..a3ef66a2a083 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -109,6 +109,17 @@ static inline __u8 ror8(__u8 word, unsigned int shift) | |||
109 | return (word >> shift) | (word << (8 - shift)); | 109 | return (word >> shift) | (word << (8 - shift)); |
110 | } | 110 | } |
111 | 111 | ||
112 | /** | ||
113 | * sign_extend32 - sign extend a 32-bit value using specified bit as sign-bit | ||
114 | * @value: value to sign extend | ||
115 | * @index: 0 based bit index (0<=index<32) to sign bit | ||
116 | */ | ||
117 | static inline __s32 sign_extend32(__u32 value, int index) | ||
118 | { | ||
119 | __u8 shift = 31 - index; | ||
120 | return (__s32)(value << shift) >> shift; | ||
121 | } | ||
122 | |||
112 | static inline unsigned fls_long(unsigned long l) | 123 | static inline unsigned fls_long(unsigned long l) |
113 | { | 124 | { |
114 | if (sizeof(l) == 4) | 125 | if (sizeof(l) == 4) |
@@ -136,30 +147,8 @@ static inline unsigned long __ffs64(u64 word) | |||
136 | } | 147 | } |
137 | 148 | ||
138 | #ifdef __KERNEL__ | 149 | #ifdef __KERNEL__ |
139 | #ifdef CONFIG_GENERIC_FIND_FIRST_BIT | ||
140 | |||
141 | /** | ||
142 | * find_first_bit - find the first set bit in a memory region | ||
143 | * @addr: The address to start the search at | ||
144 | * @size: The maximum size to search | ||
145 | * | ||
146 | * Returns the bit number of the first set bit. | ||
147 | */ | ||
148 | extern unsigned long find_first_bit(const unsigned long *addr, | ||
149 | unsigned long size); | ||
150 | |||
151 | /** | ||
152 | * find_first_zero_bit - find the first cleared bit in a memory region | ||
153 | * @addr: The address to start the search at | ||
154 | * @size: The maximum size to search | ||
155 | * | ||
156 | * Returns the bit number of the first cleared bit. | ||
157 | */ | ||
158 | extern unsigned long find_first_zero_bit(const unsigned long *addr, | ||
159 | unsigned long size); | ||
160 | #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ | ||
161 | 150 | ||
162 | #ifdef CONFIG_GENERIC_FIND_LAST_BIT | 151 | #ifndef find_last_bit |
163 | /** | 152 | /** |
164 | * find_last_bit - find the last set bit in a memory region | 153 | * find_last_bit - find the last set bit in a memory region |
165 | * @addr: The address to start the search at | 154 | * @addr: The address to start the search at |
@@ -169,30 +158,7 @@ extern unsigned long find_first_zero_bit(const unsigned long *addr, | |||
169 | */ | 158 | */ |
170 | extern unsigned long find_last_bit(const unsigned long *addr, | 159 | extern unsigned long find_last_bit(const unsigned long *addr, |
171 | unsigned long size); | 160 | unsigned long size); |
172 | #endif /* CONFIG_GENERIC_FIND_LAST_BIT */ | 161 | #endif |
173 | |||
174 | #ifdef CONFIG_GENERIC_FIND_NEXT_BIT | ||
175 | |||
176 | /** | ||
177 | * find_next_bit - find the next set bit in a memory region | ||
178 | * @addr: The address to base the search on | ||
179 | * @offset: The bitnumber to start searching at | ||
180 | * @size: The bitmap size in bits | ||
181 | */ | ||
182 | extern unsigned long find_next_bit(const unsigned long *addr, | ||
183 | unsigned long size, unsigned long offset); | ||
184 | |||
185 | /** | ||
186 | * find_next_zero_bit - find the next cleared bit in a memory region | ||
187 | * @addr: The address to base the search on | ||
188 | * @offset: The bitnumber to start searching at | ||
189 | * @size: The bitmap size in bits | ||
190 | */ | ||
191 | |||
192 | extern unsigned long find_next_zero_bit(const unsigned long *addr, | ||
193 | unsigned long size, | ||
194 | unsigned long offset); | ||
195 | 162 | ||
196 | #endif /* CONFIG_GENERIC_FIND_NEXT_BIT */ | ||
197 | #endif /* __KERNEL__ */ | 163 | #endif /* __KERNEL__ */ |
198 | #endif | 164 | #endif |