Lines Matching +full:a +full:- +full:bit
1 /* SPDX-License-Identifier: GPL-2.0-only */
19 #include <asm-generic/bitops/__ffs.h>
20 #include <asm-generic/bitops/__fls.h>
21 #include <asm-generic/bitops/ffs.h>
22 #include <asm-generic/bitops/fls.h>
30 #include <asm-generic/bitops/__ffs.h>
31 #include <asm-generic/bitops/__fls.h>
32 #include <asm-generic/bitops/ffs.h>
33 #include <asm-generic/bitops/fls.h>
35 #include <asm/alternative-macros.h>
67 * __ffs - find first set bit in a long word
70 * Undefined if no set bit exists, so code should check against 0 first.
89 return BITS_PER_LONG - 1 - word; in variable__fls()
96 * __fls - find last set bit in a long word
99 * Undefined if no set bit exists, so code should check against 0 first.
103 (unsigned long)(BITS_PER_LONG - 1 - __builtin_clzl(word)) : \
128 * ffs - find first set bit in a word
133 * ffs(value) returns 0 if value is 0 or the position of the first set bit if
134 * value is nonzero. The first (least significant) bit is at position 1.
153 return 32 - x; in variable_fls()
160 * fls - find last set bit in a word
163 * This is defined in a similar way as ffs, but returns the position of the most
164 * significant set bit.
166 * fls(value) returns 0 if value is 0 or the position of the last set bit if
167 * value is nonzero. The last (most significant) bit is at position 32.
173 ((x_ != 0) ? (32 - __builtin_clz(x_)) : 0) \
180 #include <asm-generic/bitops/ffz.h>
181 #include <asm-generic/bitops/fls64.h>
182 #include <asm-generic/bitops/sched.h>
186 #include <asm-generic/bitops/const_hweight.h>
202 : "=r" (__res), "+A" (addr[BIT_WORD(nr)]) \
211 : "+A" (addr[BIT_WORD(nr)]) \
225 * arch_test_and_set_bit - Set a bit and return its old value
226 * @nr: Bit to set
237 * arch_test_and_clear_bit - Clear a bit and return its old value
238 * @nr: Bit to clear
249 * arch_test_and_change_bit - Change a bit and return its old value
250 * @nr: Bit to change
254 * It also implies a memory barrier.
262 * arch_set_bit - Atomically set a bit in memory
263 * @nr: the bit to set
271 * restricted to acting on a single-word quantity.
279 * arch_clear_bit - Clears a bit in memory
280 * @nr: Bit to clear
293 * arch_change_bit - Toggle a bit in memory
294 * @nr: Bit to change
299 * restricted to acting on a single-word quantity.
307 * arch_test_and_set_bit_lock - Set a bit and return its old value, for lock
308 * @nr: Bit to set
312 * It can be used to implement bit locks.
321 * arch_clear_bit_unlock - Clear a bit in memory, for unlock
322 * @nr: the bit to set
334 * arch___clear_bit_unlock - Clear a bit in memory, for unlock
335 * @nr: the bit to set
340 * a bit lock, however it would only be used if no other CPU can modify
341 * any bits in the memory until the lock is released (a good example is
342 * if the bit lock itself protects access to the other bits in the word).
344 * On RISC-V systems there seems to be no benefit to taking advantage of the
345 * non-atomic property here: it's a lot more instructions and we still have to
360 : "=r" (res), "+A" (*addr) in arch_xor_unlock_is_negative_byte()
363 return (res & BIT(7)) != 0; in arch_xor_unlock_is_negative_byte()
372 #include <asm-generic/bitops/instrumented-atomic.h>
373 #include <asm-generic/bitops/instrumented-lock.h>
375 #include <asm-generic/bitops/non-atomic.h>
376 #include <asm-generic/bitops/le.h>
377 #include <asm-generic/bitops/ext2-atomic.h>