swap(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… swap(9) β€” the Kernel API Manual glow-up 🫢

okay so bestie, welcome to the Kernel API Manual page for swap ✨ it's a tiny one, but it's lowkey iconic β€” a whole little function whose entire personality is "you give me two things, I flip them." no cap. πŸ¦‹


🌸 NAME 🌸

swap β€” literally swaps the values of @a and @b. that's it. that's the whole gig. πŸ’…


✨ SYNOPSIS ✨

swap (a , b );

look at her. two args, zero drama. πŸŽ€


🧚 ARGUMENTS 🧚

  • a β€” the first value πŸ‘‘ like, the value that starts out on the left, living its best life
  • b β€” the second value 🌈 the other one. after swap does her thing, they've traded places fr fr
ngl the whole point is that @a and @b end up holding each other's values β€” no extra steps, no notes. πŸ’–

πŸ”₯ SEE ALSO πŸ”₯

the whole min/max friend group is here and they're all in ./include/linux/minmax.h β€” go say hi to the rest of the squad:

literally the most supportive little header file in the kernel, iykyk πŸ’€πŸ’œ


πŸŽ€ cute sign-off time: this page comes from ./include/linux, dated October 2026, and it's filed under swap(9) β€” and yes, that's the whole manual page, she's smol but she ate. periodt. πŸ“βœ¨
πŸ“¦ where this page comes from