Lines Matching +full:word +full:- +full:size
1 /* SPDX-License-Identifier: GPL-2.0 */
9 * Within a word, bits are numbered LSB first. Lot's of places make
11 * This can cause confusion for large (> 1 word) bitmaps on a
12 * big-endian system because, unlike little endian, the number of each
13 * bit depends on the word size.
23 * The main difference is that bit 0-63 in the bit number field needs to be
62 addr += (nr ^ (BITS_PER_LONG - BITS_PER_BYTE)) / BITS_PER_BYTE; in arch_test_bit()
63 mask = 1UL << (nr & (BITS_PER_BYTE - 1)); in arch_test_bit()
75 #include <asm-generic/bitops/atomic.h>
76 #include <asm-generic/bitops/non-instrumented-non-atomic.h>
77 #include <asm-generic/bitops/lock.h>
84 unsigned long find_first_bit_inv(const unsigned long *addr, unsigned long size);
85 unsigned long find_next_bit_inv(const unsigned long *addr, unsigned long size,
88 #define for_each_set_bit_inv(bit, addr, size) \ argument
89 for ((bit) = find_first_bit_inv((addr), (size)); \
90 (bit) < (size); \
91 (bit) = find_next_bit_inv((addr), (size), (bit) + 1))
95 return set_bit(nr ^ (BITS_PER_LONG - 1), ptr); in set_bit_inv()
100 return clear_bit(nr ^ (BITS_PER_LONG - 1), ptr); in clear_bit_inv()
106 return test_and_clear_bit(nr ^ (BITS_PER_LONG - 1), ptr); in test_and_clear_bit_inv()
111 return __set_bit(nr ^ (BITS_PER_LONG - 1), ptr); in __set_bit_inv()
116 return __clear_bit(nr ^ (BITS_PER_LONG - 1), ptr); in __clear_bit_inv()
122 return test_bit(nr ^ (BITS_PER_LONG - 1), ptr); in test_bit_inv()
128 * __flogr - find leftmost one
129 * @word - The word to search
135 static __always_inline __attribute_const__ unsigned long __flogr(unsigned long word) in __flogr() argument
139 if (__builtin_constant_p(word)) { in __flogr()
141 if (!word) in __flogr()
143 if (!(word & 0xffffffff00000000UL)) { in __flogr()
144 word <<= 32; in __flogr()
147 if (!(word & 0xffff000000000000UL)) { in __flogr()
148 word <<= 16; in __flogr()
151 if (!(word & 0xff00000000000000UL)) { in __flogr()
152 word <<= 8; in __flogr()
155 if (!(word & 0xf000000000000000UL)) { in __flogr()
156 word <<= 4; in __flogr()
159 if (!(word & 0xc000000000000000UL)) { in __flogr()
160 word <<= 2; in __flogr()
163 if (!(word & 0x8000000000000000UL)) { in __flogr()
164 word <<= 1; in __flogr()
171 rp.even = word; in __flogr()
186 * ffs - find first bit set
187 * @word: the word to search
192 static __always_inline __flatten __attribute_const__ int ffs(int word) in ffs() argument
194 unsigned int val = (unsigned int)word; in ffs()
196 return BITS_PER_LONG - __flogr(-val & val); in ffs()
201 #include <asm-generic/bitops/builtin-ffs.h>
205 #include <asm-generic/bitops/builtin-__ffs.h>
206 #include <asm-generic/bitops/ffz.h>
207 #include <asm-generic/bitops/builtin-__fls.h>
208 #include <asm-generic/bitops/builtin-fls.h>
209 #include <asm-generic/bitops/fls64.h>
211 #include <asm-generic/bitops/const_hweight.h>
212 #include <asm-generic/bitops/sched.h>
213 #include <asm-generic/bitops/le.h>
214 #include <asm-generic/bitops/ext2-atomic-setbit.h>