BITMAP BITOPS(9)
π bitmap bitops π
okay bestie, welcome to bitmap bitops(9) from the Kernel API Manual β literally the backstage pass to bitmap bit-twiddling and I'm obsessed π
β¨
also, the following operations in asm/bitops.h apply to bitmaps.:
set_bit(bit, addr)β does*addr |= bit, so it sets that bit πclear_bit(bit, addr)β clears it with*addr &= ~bitπ§Όchange_bit(bit, addr)β flips it via*addr ^= bitπtest_bit(bit, addr)β asks "is bit set in*addr?" πtest_and_set_bit(bit, addr)β sets bit and returns old value π«Άtest_and_clear_bit(bit, addr)β clears bit and returns old value π§test_and_change_bit(bit, addr)β changes bit and returns old value πΈfind_first_zero_bit(addr, nbits)β positions first zero bit in*addrπ΅οΈββοΈfind_first_bit(addr, nbits)β positions first set bit in*addrβfind_next_zero_bit(addr, nbits, bit)β positions next zero bit in*addr >= bitπfind_next_bit(addr, nbits, bit)β positions next set bit in*addr >= bitπ₯find_next_and_bit(addr1, addr2, nbits, bit)β same asfind_next_bit, but in(*addr1 & *addr2)π
π SEE ALSO π
- Kernel file
./include/linux/bitmap.h bitmap overview(9)declare bitmap(9)bitmap_find_next_zero_area(9)bitmap_or_equal(9)bitmap_weight_from(9)bitmap_scatter(9)bitmap_gather(9)bitmap_release_region(9)bitmap_allocate_region(9)bitmap_find_free_region(9)BITMAP_FROM_U64(9)bitmap_from_u64(9)bitmap_read(9)bitmap_write(9)
mwah π β this cutie came from ./include/linux, dated October 2026, and it's bitmap bitops(9) signing off π«Ά
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms