Lines Matching +full:1 +full:a

50  * These functions for MIPS ISA > 1 are interrupt and SMP proof and
55 * set_bit - Atomically set a bit in memory
62 * restricted to acting on a single-word quantity.
71 "1:\tll\t%0, %1\t\t# set_bit\n\t" in set_bit()
73 "sc\t%0, %1\n\t" in set_bit()
74 "beqz\t%0, 1b" in set_bit()
76 : "ir" (1UL << (nr & 0x1f)), "m" (*m)); in set_bit()
80 * __set_bit - Set a bit in memory
92 *m |= 1UL << (nr & 31); in __set_bit()
97 * clear_bit - Clears a bit in memory
102 * not contain a memory barrier, so if it is used for locking purposes,
113 "1:\tll\t%0, %1\t\t# clear_bit\n\t" in clear_bit()
115 "sc\t%0, %1\n\t" in clear_bit()
116 "beqz\t%0, 1b\n\t" in clear_bit()
118 : "ir" (~(1UL << (nr & 0x1f))), "m" (*m)); in clear_bit()
122 * change_bit - Toggle a bit in memory
128 * restricted to acting on a single-word quantity.
137 "1:\tll\t%0, %1\t\t# change_bit\n\t" in change_bit()
139 "sc\t%0, %1\n\t" in change_bit()
140 "beqz\t%0, 1b" in change_bit()
142 : "ir" (1UL << (nr & 0x1f)), "m" (*m)); in change_bit()
146 * __change_bit - Toggle a bit in memory
158 *m ^= 1UL << (nr & 31); in __change_bit()
162 * test_and_set_bit - Set a bit and return its old value
167 * It also implies a memory barrier.
177 "1:\tll\t%0, %1\n\t" in test_and_set_bit()
179 "sc\t%2, %1\n\t" in test_and_set_bit()
180 "beqz\t%2, 1b\n\t" in test_and_set_bit()
184 : "r" (1UL << (nr & 0x1f)), "m" (*m) in test_and_set_bit()
191 * __test_and_set_bit - Set a bit and return its old value
197 * but actually fail. You must protect multiple accesses with a lock.
202 volatile int *a = addr; in __test_and_set_bit() local
204 a += nr >> 5; in __test_and_set_bit()
205 mask = 1 << (nr & 0x1f); in __test_and_set_bit()
206 retval = (mask & *a) != 0; in __test_and_set_bit()
207 *a |= mask; in __test_and_set_bit()
213 * test_and_clear_bit - Clear a bit and return its old value
218 * It also implies a memory barrier.
228 "1:\tll\t%0, %1\n\t" in test_and_clear_bit()
231 "sc\t%2, %1\n\t" in test_and_clear_bit()
232 "beqz\t%2, 1b\n\t" in test_and_clear_bit()
236 : "r" (1UL << (nr & 0x1f)), "m" (*m) in test_and_clear_bit()
243 * __test_and_clear_bit - Clear a bit and return its old value
249 * but actually fail. You must protect multiple accesses with a lock.
254 volatile int *a = addr; in __test_and_clear_bit() local
256 a += nr >> 5; in __test_and_clear_bit()
257 mask = 1 << (nr & 0x1f); in __test_and_clear_bit()
258 retval = (mask & *a) != 0; in __test_and_clear_bit()
259 *a &= ~mask; in __test_and_clear_bit()
265 * test_and_change_bit - Change a bit and return its new value
270 * It also implies a memory barrier.
280 "1:\tll\t%0, %1\n\t" in test_and_change_bit()
282 "sc\t%2, %1\n\t" in test_and_change_bit()
283 "beqz\t%2, 1b\n\t" in test_and_change_bit()
287 : "r" (1UL << (nr & 0x1f)), "m" (*m) in test_and_change_bit()
294 * __test_and_change_bit - Change a bit and return its old value
300 * but actually fail. You must protect multiple accesses with a lock.
305 volatile int *a = addr; in __test_and_change_bit() local
307 a += nr >> 5; in __test_and_change_bit()
308 mask = 1 << (nr & 0x1f); in __test_and_change_bit()
309 retval = (mask & *a) != 0; in __test_and_change_bit()
310 *a ^= mask; in __test_and_change_bit()
318 * set_bit - Atomically set a bit in memory
325 * restricted to acting on a single-word quantity.
330 volatile int *a = addr; in set_bit() local
333 a += nr >> 5; in set_bit()
334 mask = 1 << (nr & 0x1f); in set_bit()
336 *a |= mask; in set_bit()
341 * __set_bit - Set a bit in memory
352 volatile int *a = addr; in __set_bit() local
354 a += nr >> 5; in __set_bit()
355 mask = 1 << (nr & 0x1f); in __set_bit()
356 *a |= mask; in __set_bit()
360 * clear_bit - Clears a bit in memory
365 * not contain a memory barrier, so if it is used for locking purposes,
372 volatile int *a = addr; in clear_bit() local
375 a += nr >> 5; in clear_bit()
376 mask = 1 << (nr & 0x1f); in clear_bit()
378 *a &= ~mask; in clear_bit()
383 * change_bit - Toggle a bit in memory
389 * restricted to acting on a single-word quantity.
394 volatile int *a = addr; in change_bit() local
397 a += nr >> 5; in change_bit()
398 mask = 1 << (nr & 0x1f); in change_bit()
400 *a ^= mask; in change_bit()
405 * __change_bit - Toggle a bit in memory
417 *m ^= 1UL << (nr & 31); in __change_bit()
421 * test_and_set_bit - Set a bit and return its old value
426 * It also implies a memory barrier.
431 volatile int *a = addr; in test_and_set_bit() local
434 a += nr >> 5; in test_and_set_bit()
435 mask = 1 << (nr & 0x1f); in test_and_set_bit()
437 retval = (mask & *a) != 0; in test_and_set_bit()
438 *a |= mask; in test_and_set_bit()
445 * __test_and_set_bit - Set a bit and return its old value
451 * but actually fail. You must protect multiple accesses with a lock.
456 volatile int *a = addr; in __test_and_set_bit() local
458 a += nr >> 5; in __test_and_set_bit()
459 mask = 1 << (nr & 0x1f); in __test_and_set_bit()
460 retval = (mask & *a) != 0; in __test_and_set_bit()
461 *a |= mask; in __test_and_set_bit()
467 * test_and_clear_bit - Clear a bit and return its old value
472 * It also implies a memory barrier.
477 volatile int *a = addr; in test_and_clear_bit() local
480 a += nr >> 5; in test_and_clear_bit()
481 mask = 1 << (nr & 0x1f); in test_and_clear_bit()
483 retval = (mask & *a) != 0; in test_and_clear_bit()
484 *a &= ~mask; in test_and_clear_bit()
491 * __test_and_clear_bit - Clear a bit and return its old value
497 * but actually fail. You must protect multiple accesses with a lock.
502 volatile int *a = addr; in __test_and_clear_bit() local
504 a += nr >> 5; in __test_and_clear_bit()
505 mask = 1 << (nr & 0x1f); in __test_and_clear_bit()
506 retval = (mask & *a) != 0; in __test_and_clear_bit()
507 *a &= ~mask; in __test_and_clear_bit()
513 * test_and_change_bit - Change a bit and return its new value
518 * It also implies a memory barrier.
523 volatile int *a = addr; in test_and_change_bit() local
526 a += nr >> 5; in test_and_change_bit()
527 mask = 1 << (nr & 0x1f); in test_and_change_bit()
529 retval = (mask & *a) != 0; in test_and_change_bit()
530 *a ^= mask; in test_and_change_bit()
537 * __test_and_change_bit - Change a bit and return its old value
543 * but actually fail. You must protect multiple accesses with a lock.
548 volatile int *a = addr; in __test_and_change_bit() local
550 a += nr >> 5; in __test_and_change_bit()
551 mask = 1 << (nr & 0x1f); in __test_and_change_bit()
552 retval = (mask & *a) != 0; in __test_and_change_bit()
553 *a ^= mask; in __test_and_change_bit()
566 * test_bit - Determine whether a bit is set
572 return ((1UL << (nr & 31)) & (((const unsigned int *) addr)[nr >> 5])) != 0; in test_bit()
580 * find_first_zero_bit - find the first zero bit in a memory region
585 * containing a bit.
597 "1:\tsubu\t$1,%6,%0\n\t" in find_first_zero_bit()
598 "blez\t$1,2f\n\t" in find_first_zero_bit()
599 "lw\t$1,(%5)\n\t" in find_first_zero_bit()
604 "beql\t%1,$1,1b\n\t" in find_first_zero_bit()
608 "beq\t%1,$1,1b\n\t" in find_first_zero_bit()
615 "li\t%1,1\n" in find_first_zero_bit()
616 "1:\tand\t%2,$1,%1\n\t" in find_first_zero_bit()
618 "sll\t%1,%1,1\n\t" in find_first_zero_bit()
619 "bnez\t%1,1b\n\t" in find_first_zero_bit()
620 "add\t%0,%0,1\n\t" in find_first_zero_bit()
625 : "0" ((signed int) 0), "1" ((unsigned int) 0xffffffff), in find_first_zero_bit()
627 : "$1"); in find_first_zero_bit()
633 * find_next_zero_bit - find the first zero bit in a memory region
653 "1:\tand\t$1,%4,%1\n\t" in find_next_zero_bit()
654 "beqz\t$1,1f\n\t" in find_next_zero_bit()
655 "sll\t%1,%1,1\n\t" in find_next_zero_bit()
656 "bnez\t%1,1b\n\t" in find_next_zero_bit()
657 "addiu\t%0,1\n\t" in find_next_zero_bit()
660 "1:" in find_next_zero_bit()
662 : "0" (0), "1" (1 << bit), "r" (*p) in find_next_zero_bit()
663 : "$1"); in find_next_zero_bit()
670 * No zero yet, search remaining full bytes for a zero in find_next_zero_bit()
687 unsigned int mask = 1; in ffz()
693 "1:\tand\t$1,%2,%1\n\t" in ffz()
694 "beqz\t$1,2f\n\t" in ffz()
695 "sll\t%1,1\n\t" in ffz()
696 "bnez\t%1,1b\n\t" in ffz()
697 "addiu\t%0,1\n\t" in ffz()
702 : "r" (word), "1" (mask) in ffz()
703 : "$1"); in ffz()
711 * hweightN - returns the hamming weight of a N-bit word
714 * The Hamming Weight of a number is the total number of bits set in it.
725 * find_next_zero_bit - find the first zero bit in a memory region
772 * find_first_zero_bit - find the first zero bit in a memory region
777 * containing a bit.
796 mask = 1 << (nr & 0x07); in ext2_set_bit()
810 mask = 1 << (nr & 0x07); in ext2_clear_bit()
824 mask = 1 << (nr & 0x07); in ext2_test_bit()
843 * shift is illegal. So we could keep a big endian value in ext2_find_next_zero_bit()