DIV64_U64_ROUND_UP(9)
π DIV64_U64_ROUND_UP π
okay so this is a page from the Kernel API Manual and it's literally about one (1) macro that does math and refuses to round down. bestie, let's get into it β¨
πΈ NAME πΈ
DIV64_U64_ROUND_UP β unsigned 64bit divide with 64bit divisor rounded up π«Ά
π SYNOPSIS π
DIV64_U64_ROUND_UP (ll , d );
that's it. two args. no cap π
β¨ ARGUMENTS β¨
llβ the unsigned 64bit dividend, aka the number getting chopped up πdβ the unsigned 64bit divisor, aka the number doing the chopping πͺ
π¦ DESCRIPTION π¦
so what it does is: divide the unsigned 64bit dividend by the unsigned 64bit divisor, and then round up. like, always up. it's giving "we don't do floor here" energy π
not me being obsessed with a macro that just refuses to lose the remainder π
π RETURN π
returns dividend / divisor rounded up π that's the whole vibe check and it passed
π SEE ALSO π
oh you want the whole friend group? say less, here's the squad, all from the kernel file ./include/linux/math64.h:
div_u64_rem(9)div_s64_rem(9)div64_u64_rem(9)div64_s64_rem(9)div64_u64(9)div64_s64(9)div_u64(9)div_s64(9)mul_u64_add_u64_div_u64(9)mul_u64_u64_div_u64(9)mul_u64_u64_div_u64_roundup(9)DIV_U64_ROUND_UP(9)DIV64_U64_ROUND_CLOSEST(9)DIV_U64_ROUND_CLOSEST(9)DIV_S64_ROUND_CLOSEST(9)roundup_u64(9)
go follow all of them, they're iconic π§
π lowkey a warning but honestly just a fact: this is all unsigned 64bit math, so keep your types right or the vibe check will fail and that's on periodt.
and that's the whole page, bestie π sign-off time: this came from the ./include/linux section of the Kernel API Manual, dated October 2026 β slay, go round some numbers up ππ₯
π¦ 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