wrapping_assign_sub(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… wrapping_assign_sub(9) β€” like, the Kernel API Manual, but make it make sense ✨

okay so bestie, welcome to wrapping_assign_sub(9), straight out of the Kernel API Manual. no cap, this one's a tiny little legend and you're gonna love her 🫢


🌸 NAME 🌸

wrapping_assign_sub β€” intentionally perform a wrapping decrement assign πŸ’… (yes, intentionally. she knows exactly what she's doing.)


✨ SYNOPSIS ✨

wrapping_assign_sub (var , offset );

that's it. that's the whole vibe. two args, zero drama πŸŽ€


πŸ¦‹ ARGUMENTS πŸ¦‹

  • var β€” the variable that's getting decremented. she's the main character here πŸ‘‘
  • offset β€” how much you're subtracting from her. the amount, the whole amount, nothing but the amount πŸ“

πŸ”₯ DESCRIPTION πŸ”₯

so what she does is: decrements var by offset, with wrap-around. literally that's the assignment. returns the resulting value of var. πŸ’«

and the iconic part? will not trip any wrap-around sanitizers. not a single one. she said "i'm not setting off any alarms today" and she meant it πŸ™ˆ

also, to be super clear since the manpage says it twice (she's thorough, we love her): returns the new value of var. ⭐

like… it's giving "small function, big confidence." one job, done flawlessly, no sanitizer crying in the group chat πŸ˜­πŸ’–


🧚 SEE ALSO 🧚

all her besties live in the kernel file ./include/linux/overflow.h and honestly the whole friend group is iconic 🌈:

go read them all, iykwim πŸ’€πŸ’œ


and that's the whole page, bestie!! πŸŽ€ this little gem comes to you from ./include/linux, dated October 2026 β€” go off, queen, slay the wrap-around, periodt πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from