div_u64_rem(9)
π div_u64_rem(9) β the kernel API manual, bestie edition π
okay so this is div_u64_rem from the Kernel API Manual, and honestly she's that girl: unsigned 64bit divide with a 32bit divisor, and she hands you the remainder. no cap. math girls stay winning β¨
β¨ NAME β¨
div_u64_rem β unsigned 64bit divide with 32bit divisor with remainder π
π¦ SYNOPSIS π¦
u64 div_u64_rem (u64 dividend , u32 divisor , u32 *remainder );
like literally that's the whole signature. three args, zero drama, one quotient, one remainder. we love a clean API. π«Ά
πΈ ARGUMENTS πΈ
dividendβ your unsigned 64bit dividend, aka the big number that's about to get split up πdivisorβ your unsigned 32bit divisor, aka the smaller number doing the splitting. she's 32bit and she knows it πremainderβ pointer to an unsigned 32bit remainder. yes bestie, it's a pointer, she writes back into your variable π
β RETURN β
okay so the order of operations here actually matters: it sets *remainder, then returns dividend / divisor. so you get the quotient back as the return value and the leftover goes home in your pointer. iconic, honestly. π
π DESCRIPTION π
This is commonly provided by 32bit archs to provide an optimized 64bit divide. so on those arches she's the main character β the whole reason the helper exists is so a 32bit machine doesn't have to do 64bit division the painful way. ate and left no crumbs π₯
ngl, the "commonly provided by 32bit archs" part is the whole vibe check here β it's an optimization helper, not just a wrapper for the fun of it.
π§ SEE ALSO π§
she does not roll alone, the whole math64 girlie squad is in ./include/linux/math64.h:
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)DIV64_U64_ROUND_UP(9)DIV_U64_ROUND_UP(9)DIV64_U64_ROUND_CLOSEST(9)DIV_U64_ROUND_CLOSEST(9)DIV_S64_ROUND_CLOSEST(9)roundup_u64(9)
all of them live in Kernel file ./include/linux/math64.h, so go say hi π
sign-off time π«Ά this lil page ships from ./include/linux, dated October 2026, and it's div_u64_rem(9) through and through. stay dividing, bestie β quotient in the return, remainder in the pointer, no cap π
β¨
π¦ 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