bitmap_scatter(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 🌈

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