bitmap_scatter(9)
π bitmap_scatter(9) β the kernel manual, bestie edition π
okay so you're looking at the bitmap_scatter(9) page from the Kernel API Manual, and honestly? it's giving "tiny function, big glow-up." let's get into it β¨
πΈ NAME πΈ
bitmap_scatter β scatter a bitmap according to the given mask. that's it, that's the whole vibe. π¦
β¨ SYNOPSIS β¨
void bitmap_scatter (unsigned long *dst , const unsigned long *src ,
const unsigned long *mask , unsigned int nbits );
no cap, that's the whole signature. she's short and she knows it π
π«Ά ARGUMENTS π«Ά
dstβ the scattered bitmap. this is where the magic lands, bestie πsrcβ the gathered bitmap. your source material, the original icon πmaskβ the mask representing bits to assign to in the scattered bitmap. she's literally the blueprint πΊοΈnbitsβ number of bits in each of these bitmaps. everybody's gotta agree on the length, fr fr π
π DESCRIPTION π
so what does she do? bitmap_scatter scatters a bitmap with sequential bits according to the given mask. lowkey that's the entire concept β sequential on one side, spread out on the other, the mask decides who goes where π§
π₯ EXAMPLE π₯
okay this is the part where it clicks, i promise. if src bitmap = 0x005a, with mask = 0x1313, dst will be 0x0302. slay π
or, in binary form:
src mask dst
0000000001011010 0001001100010011 0000001100000010
(bits 0, 1, 2, 3, 4, 5 are copied to the bits 0, 1, 4, 8, 9, 12 β yes the numbers jump around, that's the scatter part, that's her whole thing π)
a more 'visual' description of the operation:
src: 0000000001011010
||||||
+------+|||||
| +----+||||
| |+----+|||
| || +-+||
| || | ||
mask: ...v..vv...v..vv
...0..11...0..10
dst: 0000001100000010
like, the way those | characters line up? iconic. no notes. β
and here's the tea: a relationship exists between bitmap_scatter and bitmap_gather. see bitmap_gather for the bitmap gather detailed operations. TL;DR: bitmap_gather can be seen as the 'reverse' bitmap_scatter operation. they're besties, one goes out, one comes back π«Ά
π SEE ALSO π
- Kernel file
./include/linux/bitmap.h bitmap overview(9)bitmap bitops(9)declare bitmap(9)bitmap_find_next_zero_area(9)bitmap_or_equal(9)bitmap_weight_from(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)
go read all of them, i'll wait π
ngl bestie, this is an API manual, so the only "danger" here is getting your mask and your bits confused β double-check those and you're golden π
aaaand that's the page!! πΈ source: ./include/linux, dated October 2026 β mwah, tysm for reading, ily, go scatter some bits π
ππ¦
π¦ 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