div64_s64_rem(9)
π div64_s64_rem(9) β the kernel API manual, bestie edition
okay so welcome to div64_s64_rem(9), a genuinely iconic little function from the Kernel API Manual. it does signed 64-bit division with a 64-bit divisor AND hands you back the remainder, which is honestly the most thoughtful thing anyone's done for me all week π
β¨ NAME β¨
div64_s64_rem β signed 64bit divide with 64bit divisor and remainder π
like, it divides. it's signed. it's 64-bit. it gives you the leftover. what more do you want from her, she's doing everything πΈ
β¨ SYNOPSIS β¨
s64 div64_s64_rem (s64 dividend , s64 divisor , s64 *remainder );
that's the whole vibe. three args, one s64 coming back at you β¨
β¨ ARGUMENTS β¨
dividendβ the signed 64bit dividend, aka the number getting chopped up π she's the main character of this operation honestlydivisorβ the signed 64bit divisor, aka the number doing the chopping π₯remainderβ a pointer to a signed 64bit remainder π«Ά yes it's a pointer, yes she writes through it, that's her whole thing
β¨ RETURN β¨
so here's the order of operations bestie, pay attention π
it sets *remainder first, THEN it returns dividend / divisor.
that's the actual documented sequence, don't come for me β set the remainder, then hand back the quotient. both, always. no cap π
β¨ SEE ALSO β¨
if you liked this one, the whole family is right there in the kernel file ./include/linux/math64.h and honestly they all ate:
div_u64_rem(9)div_s64_rem(9)div64_u64_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)
like okayyy roundup queen, we see you π and yeah β go read them too, they're all in ./include/linux/math64.h, iykyk π
and that's the page!! source is ./include/linux, dated October 2026, filed under div64_s64_rem(9) β mwah, love u, go divide something signed πβ¨π§
π¦ 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