is_power_of_2(9)
π is_power_of_2(9) π
okay so bestie, welcome to the kernel API manual β this one's is_power_of_2, and yes it does exactly what it says on the tin π
β¨ NAME β¨
is_power_of_2 β check if a value is a power of two
Like, literally just a vibe check for your integers π
π¦ SYNOPSIS π¦
is_power_of_2 (n );
no cap, that's the whole shape of it β you hand it an n, it gives you an answer π₯
πΈ ARGUMENTS πΈ
nβ the value to check π (this is the one the function is judging, be nice to it)
π§ DESCRIPTION π§
So what it does is determine whether some value is a power of two π. And here's the part that matters, okay, listen: zero is *not* considered a power of two. Like, not even a little bit. Zero does not get to sit with the powers of two at lunch π.
Return: true if n is a power of 2, otherwise false. Simple as that, no cap, periodt β¨
bestie pls remember:0βfalse. That asterisk in the original is doing work, don't let anyone tell you otherwise π«Ά
π SEE ALSO π
- Kernel file
./tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.cβ go peek, iykyk π
lowkey obsessed with how short this one is ngl π anyway β this masterpiece comes to you from ./tools/perf/util/bpf_skel, dated October 2026, and that's the whole sign-off bestie, mwah ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms