Lines Matching +full:bit +full:- +full:mask
1 /* SPDX-License-Identifier: GPL-2.0-only */
14 * Generic definitions for bit operations, should not be used in regular code
19 * generic___set_bit - Set a bit in memory
20 * @nr: the bit to set
23 * Unlike set_bit(), this function is non-atomic and may be reordered.
30 unsigned long mask = BIT_MASK(nr); in generic___set_bit() local
33 *p |= mask; in generic___set_bit()
39 unsigned long mask = BIT_MASK(nr); in generic___clear_bit() local
42 *p &= ~mask; in generic___clear_bit()
46 * generic___change_bit - Toggle a bit in memory
47 * @nr: the bit to change
50 * Unlike change_bit(), this function is non-atomic and may be reordered.
57 unsigned long mask = BIT_MASK(nr); in generic___change_bit() local
60 *p ^= mask; in generic___change_bit()
64 * generic___test_and_set_bit - Set a bit and return its old value
65 * @nr: Bit to set
68 * This operation is non-atomic and can be reordered.
75 unsigned long mask = BIT_MASK(nr); in generic___test_and_set_bit() local
79 *p = old | mask; in generic___test_and_set_bit()
80 return (old & mask) != 0; in generic___test_and_set_bit()
84 * generic___test_and_clear_bit - Clear a bit and return its old value
85 * @nr: Bit to clear
88 * This operation is non-atomic and can be reordered.
95 unsigned long mask = BIT_MASK(nr); in generic___test_and_clear_bit() local
99 *p = old & ~mask; in generic___test_and_clear_bit()
100 return (old & mask) != 0; in generic___test_and_clear_bit()
107 unsigned long mask = BIT_MASK(nr); in generic___test_and_change_bit() local
111 *p = old ^ mask; in generic___test_and_change_bit()
112 return (old & mask) != 0; in generic___test_and_change_bit()
116 * generic_test_bit - Determine whether a bit is set
117 * @nr: bit number to test
125 * so `volatile` must always stay here with no cast-aways. See in generic_test_bit()
128 return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1))); in generic_test_bit()
132 * generic_test_bit_acquire - Determine, with acquire semantics, whether a bit is set
133 * @nr: bit number to test
140 return 1UL & (smp_load_acquire(p) >> (nr & (BITS_PER_LONG-1))); in generic_test_bit_acquire()
144 * const_*() definitions provide good compile-time optimizations when
156 * const_test_bit - Determine whether a bit is set
157 * @nr: bit number to test
161 * allow a compiler to optimize code harder. Non-atomic and to be called only
162 * for testing compile-time constants, e.g. by the corresponding macros, not
169 unsigned long mask = BIT_MASK(nr); in const_test_bit() local
172 return !!(val & mask); in const_test_bit()