intlog10(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ NAME πŸŽ€

okay so this is intlog10(9) β€” it computes log10 of a value, and the result is shifted left by 24 bits. bestie, it's giving math but make it kernel ✨

✨ SYNOPSIS ✨

unsigned int intlog10 (u32 value );

🫢 ARGUMENTS 🫢

  • value β€” the value you're putting in, and it must be != 0. no cap, zero is not invited to this party πŸ’…

πŸ’… DESCRIPTION πŸ’…

so if you wanna use rational values, you can use this method:

intlog10(value) = intlog10(value * 10^x) - x * 2^24

here's a usecase example, bestie:

intlog10(1000) will give 3 << 24 = 3 * 2^24

but heads up 🫢 due to the implementation, intlog10(1000) might be not exactly 3 * 2^24. it's close, but not necessarily exact β€” lowkey important.

also, look at intlog2 for similar examples πŸ‘€

🌈 RETURN 🌈

log10(value) * 2^24

πŸ‘€ SEE ALSO πŸ‘€

  • Kernel file ./include/linux/int_log.h
  • intlog2(9)

made with πŸ’– from the ./include/linux corner, dated October 2026 πŸŽ€βœ¨

πŸ“¦ where this page comes from