intlog2(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– intlog2(9) πŸ’– β€” Kernel API Manual

okay so bestie, welcome to the intlog2 page from the Kernel API Manual. it's a little log2 situation, and the result is shifted left by 24 bits, iykyk. no cap, the vibes are mathematical but we're gonna get through it together. 🫢

✨ NAME ✨

intlog2 β€” computes log2 of a value; the result is shifted left by 24 bits. slay. πŸ’…

🌸 SYNOPSIS 🌸

unsigned int intlog2 (u32 value );

πŸŽ€ ARGUMENTS πŸŽ€

  • value β€” the value, and bestie it must be != 0. like, zero is literally not invited πŸ’€.

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so to use rational values you can use the following method, and yes it's giving formula:

intlog2(value) = intlog2(value * 2^x) - x * 2^24

Some usecase examples β€” these are exact, don't come for me:

intlog2(8) will give 3 << 24 = 3 * 2^24

intlog2(9) will give 3 << 24 + ... = 3.16... * 2^24

intlog2(1.5) = intlog2(3) - 2^24 = 0.584... * 2^24

⭐ RETURN ⭐

you get log2(value) * 2^24. that's it, that's the return, periodt. πŸ”₯

πŸ‘‘ SEE ALSO πŸ‘‘

  • Kernel file ./include/linux/int_log.h β€” yes, that exact path, iconic behavior.
  • intlog10(9) β€” the related logarithm page, go peep it πŸ’œ.

okay bye bestie πŸ’– this page is from ./include/linux, dated October 2026, and it's the intlog2(9) page β€” periodt. 🫢

πŸ“¦ where this page comes from