Generic bit operations. More...
#include <assert.h>#include <compiler.h>#include <stdbool.h>#include <types.h>#include <util.h>#include <arch/bitops.h>Go to the source code of this file.
Defines | |
| #define | bit_mask(ws, nr) (1 << ((nr) & ((ws) - 1))) |
| Generate a ws-bit mask with only bit nr set. | |
| #define | bit_word(ws, nr) ((nr) / (ws)) |
| Return the offset of the ws-bit word containing bit nr in a multi-word bitfield. | |
| #define | set_bit(nr, bitmap) |
| Set bit nr in bitmap. | |
| #define | clear_bit(nr, bitmap) |
| Clear bit nr in bitmap. | |
| #define | toggle_bit(nr, bitmap) |
| Toggle bit nr in bitmap. | |
| #define | test_bit(nr, bitmap) priv_test_bit_ws(nr, bitmap, 8 * sizeof(*(bitmap))) |
| Test bit nr in bitmap. | |
| #define | bit_word_reverse(word) compiler_brev(word) |
| Reverse the order of the bits in word. | |
| #define | bit_word_find_first_one_bit(word) compiler_ctz(word) |
| Find the first bit set in word, counting from the LSB. | |
| #define | bit_word_find_last_one_bit(word) (31 - compiler_clz(word)) |
| Find the last bit set in word, counting from the LSB. | |
| #define | bit_word_find_first_zero_bit(word) bit_word_find_first_one_bit(~word) |
| Find the first bit cleared in word, counting from the LSB. | |
| #define | bit_word_find_last_zero_bit(word) bit_word_find_last_one_bit(~word) |
| Find the last bit cleared in word, counting from the LSB. | |
Functions | |
| static unsigned int | bit_array_find_first_one_bit (const bit_word_t *bitmap, unsigned int len) |
| Find the first bit set in bitmap, counting from the LSB of each word. | |
Generic bit operations.
Copyright (C) 2009 Atmel Corporation. All rights reserved.
Definition in file bitops.h.
1.6.3