BITMAP INTRODUCTION(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ bitmap introduction πŸŽ€

okay so bestie, welcome to the Kernel API Manual entry for bitmap introduction(9) β€” this one is lowkey foundational and honestly kinda iconic. πŸ’–βœ¨

bitmaps are literally an array of bits, implemented using an array of unsigned longs. That’s the whole vibe. The number of valid bits in a given bitmap does not need to be an exact multiple of BITS_PER_LONG β€” no cap, it really doesn’t. πŸ’…

The possible unused bits in the last, partially used word of a bitmap are 'don't care'. The implementation makes no particular effort to keep them zero. It ensures that their value will not affect the results of any operation. The bitmap operations that return Boolean (bitmap_empty, for example) or scalar (bitmap_weight, for example) results carefully filter out these unused bits from impacting their results. fr fr, they’re not letting those stray bits mess up the answer. 🫢

The byte ordering of bitmaps is more natural on little endian architectures. See the big-endian headers include/asm-ppc64/bitops.h and include/asm-s390/bitops.h for the best explanations of this ordering. 🌈


πŸ”Ž SEE ALSO πŸ”Ž

Kernel file ./lib/bitmap.c β€” and the whole reference squad is: __bitmap_shift_right(9), __bitmap_shift_left(9), bitmap_cut(9), bitmap_find_next_zero_area_off(9), bitmap_pos_to_ord(9), bitmap_remap(9), bitmap_bitremap(9), bitmap_onto(9), bitmap_fold(9), bitmap_from_arr32(9), bitmap_to_arr32(9), bitmap_from_arr64(9), bitmap_to_arr64(9). πŸ‘‘βœ¨


okay that’s the whole page, bestie: bitmap introduction(9) from the Kernel API Manual, source/version ./lib, dated October 2026. stay iconic, hydrate, and may your unused bits stay out of your results. πŸ’…πŸŽ€πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from