roundup_pow_of_two(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

Okay bestie, welcome to the Kernel API Manual β€” this one is roundup_pow_of_two(9), and it does exactly what the name says: roundup_pow_of_two rounds the given value up to nearest power of two, and @n is the parameter. πŸ’…


✨ SYNOPSIS ✨

Like, this is literally the whole call:

roundup_pow_of_two (n );

πŸŽ€ ARGUMENTS πŸŽ€

  • n β€” the docs literally say -- undescribed --. That's it. That's the whole description, bestie. 😭

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so the vibe is: round the given value up to the nearest power of two. It's giving math, but make it kernel. 🧚

  • 🫢 the result is undefined when n == 0 β€” no cap, the page says undefined, so zero is genuinely not the moment.
  • ⭐ this can be used to initialise global variables from constant data β€” yep, that's the documented use, periodt.

🌈 SEE ALSO 🌈

Kernel file ./tools/include/linux/log2.h, plus ilog2(9) and rounddown_pow_of_two(9) β€” go read those too, iykyk. πŸ‘‘


mwah πŸ’‹ this cutie is from ./tools/include/linux, dated October 2026 β€” that’s the source/version and date, bestie. periodt. πŸ’œ

πŸ“¦ where this page comes from