Lines Matching +full:m +full:- +full:num

6  * Copyright (c) 1994 - 1997, 99, 2000, 06, 07  Ralf Baechle (ralf@linux-mips.org)
23 #include <asm/cpu-features.h>
80 * set_bit - Atomically set a bit in memory
87 * restricted to acting on a single-word quantity.
91 volatile unsigned long *m = &addr[BIT_WORD(nr)]; in set_bit() local
100 __bit_op(*m, __stringify(LONG_INS) " %0, %3, %2, 1", "i"(bit), "r"(~0)); in set_bit()
104 __bit_op(*m, "or\t%0, %2", "ir"(BIT(bit))); in set_bit()
108 * clear_bit - Clears a bit in memory
119 volatile unsigned long *m = &addr[BIT_WORD(nr)]; in clear_bit() local
128 __bit_op(*m, __stringify(LONG_INS) " %0, $0, %2, 1", "i"(bit)); in clear_bit()
132 __bit_op(*m, "and\t%0, %2", "ir"(~BIT(bit))); in clear_bit()
136 * clear_bit_unlock - Clears a bit in memory
150 * change_bit - Toggle a bit in memory
156 * restricted to acting on a single-word quantity.
160 volatile unsigned long *m = &addr[BIT_WORD(nr)]; in change_bit() local
168 __bit_op(*m, "xor\t%0, %2", "ir"(BIT(bit))); in change_bit()
172 * test_and_set_bit_lock - Set a bit and return its old value
182 volatile unsigned long *m = &addr[BIT_WORD(nr)]; in test_and_set_bit_lock() local
189 orig = __test_bit_op(*m, "%0", in test_and_set_bit_lock()
201 * test_and_set_bit - Set a bit and return its old value
216 * test_and_clear_bit - Clear a bit and return its old value
226 volatile unsigned long *m = &addr[BIT_WORD(nr)]; in test_and_clear_bit() local
235 res = __test_bit_op(*m, "%1", in test_and_clear_bit()
240 orig = __test_bit_op(*m, "%0", in test_and_clear_bit()
253 * test_and_change_bit - Change a bit and return its old value
263 volatile unsigned long *m = &addr[BIT_WORD(nr)]; in test_and_change_bit() local
272 orig = __test_bit_op(*m, "%0", in test_and_change_bit()
308 #include <asm-generic/bitops/non-atomic.h>
311 * __clear_bit_unlock - Clears a bit in memory
315 * __clear_bit() is non-atomic and implies release semantics before the memory
328 * Returns -1 if no 1 bit exists
332 int num; in __fls() local
341 : "=r" (num) in __fls()
344 return 31 - num; in __fls()
354 : "=r" (num) in __fls()
357 return 63 - num; in __fls()
360 num = BITS_PER_LONG - 1; in __fls()
364 num -= 32; in __fls()
368 if (!(word & (~0ul << (BITS_PER_LONG-16)))) { in __fls()
369 num -= 16; in __fls()
372 if (!(word & (~0ul << (BITS_PER_LONG-8)))) { in __fls()
373 num -= 8; in __fls()
376 if (!(word & (~0ul << (BITS_PER_LONG-4)))) { in __fls()
377 num -= 4; in __fls()
380 if (!(word & (~0ul << (BITS_PER_LONG-2)))) { in __fls()
381 num -= 2; in __fls()
384 if (!(word & (~0ul << (BITS_PER_LONG-1)))) in __fls()
385 num -= 1; in __fls()
386 return num; in __fls()
390 * __ffs - find first bit in word.
393 * Returns 0..SZLONG-1
398 return __fls(word & -word); in __ffs()
402 * fls - find last bit set.
422 return 32 - x; in fls()
430 r -= 16; in fls()
434 r -= 8; in fls()
438 r -= 4; in fls()
442 r -= 2; in fls()
446 r -= 1; in fls()
451 #include <asm-generic/bitops/fls64.h>
454 * ffs - find first bit set.
466 return fls(word & -word); in ffs()
469 #include <asm-generic/bitops/ffz.h>
473 #include <asm-generic/bitops/sched.h>
476 #include <asm-generic/bitops/const_hweight.h>
478 #include <asm-generic/bitops/le.h>
479 #include <asm-generic/bitops/ext2-atomic.h>