Lines Matching full:bit

254 #define ATOMIC_MASK(bit) (1 << ((bit) & (ATOMIC_BITS - 1)))  argument
255 #define ATOMIC_ELEM(addr, bit) ((addr) + ((bit) / ATOMIC_BITS)) argument
278 * @brief Atomically test a bit.
280 * This routine tests whether bit number @a bit of @a target is set or not.
284 * @param bit Bit number (starting from 0).
286 * @return 1 if the bit was set, 0 if it wasn't.
289 atomic_test_bit(const atomic_t *target, int bit) in atomic_test_bit() argument
291 atomic_val_t val = atomic_get(ATOMIC_ELEM(target, bit)); in atomic_test_bit()
293 return (1 & (val >> (bit & (ATOMIC_BITS - 1)))); in atomic_test_bit()
297 * @brief Atomically test and clear a bit.
299 * Atomically clear bit number @a bit of @a target and return its old value.
303 * @param bit Bit number (starting from 0).
305 * @return 1 if the bit was set, 0 if it wasn't.
308 atomic_test_and_clear_bit(atomic_t *target, int bit) in atomic_test_and_clear_bit() argument
310 atomic_val_t mask = ATOMIC_MASK(bit); in atomic_test_and_clear_bit()
313 old = atomic_and(ATOMIC_ELEM(target, bit), ~mask); in atomic_test_and_clear_bit()
319 * @brief Atomically set a bit.
321 * Atomically set bit number @a bit of @a target and return its old value.
325 * @param bit Bit number (starting from 0).
327 * @return 1 if the bit was set, 0 if it wasn't.
330 atomic_test_and_set_bit(atomic_t *target, int bit) in atomic_test_and_set_bit() argument
332 atomic_val_t mask = ATOMIC_MASK(bit); in atomic_test_and_set_bit()
335 old = atomic_or(ATOMIC_ELEM(target, bit), mask); in atomic_test_and_set_bit()
341 * @brief Atomically clear a bit.
343 * Atomically clear bit number @a bit of @a target.
347 * @param bit Bit number (starting from 0).
352 atomic_clear_bit(atomic_t *target, int bit) in atomic_clear_bit() argument
354 atomic_val_t mask = ATOMIC_MASK(bit); in atomic_clear_bit()
356 atomic_and(ATOMIC_ELEM(target, bit), ~mask); in atomic_clear_bit()
360 * @brief Atomically set a bit.
362 * Atomically set bit number @a bit of @a target.
366 * @param bit Bit number (starting from 0).
371 atomic_set_bit(atomic_t *target, int bit) in atomic_set_bit() argument
373 atomic_val_t mask = ATOMIC_MASK(bit); in atomic_set_bit()
375 atomic_or(ATOMIC_ELEM(target, bit), mask); in atomic_set_bit()