mul_u64_u64_div_u64_roundup(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– mul_u64_u64_div_u64_roundup(9) πŸ’–

okay bestie, welcome to the mul_u64_u64_div_u64_roundup(9) page from the Kernel API Manual β€” yes that's the whole title, no notes, she's a long one and she knows it πŸ’…


✨ NAME ✨

mul_u64_u64_div_u64_roundup β€” unsigned 64bit multiply and divide, but make it round UP πŸŽ€


🌸 SYNOPSIS 🌸

mul_u64_u64_div_u64_roundup (a , b , d );

like literally that's it, three args, go off πŸ‘‘


πŸ¦‹ ARGUMENTS πŸ¦‹

  • a β€” first unsigned 64bit multiplicand. she's the first one to the group chat 🫢
  • b β€” second unsigned 64bit multiplicand. the other half of the collab, we love a duo πŸ’œ
  • d β€” unsigned 64bit divisor. the one doing the dividing, main character energy fr fr πŸ”₯

⭐ DESCRIPTION ⭐

so what she does is: multiply two 64bit values together to generate a 128bit product β€” yes, 128 bits, she's expanding, she's thriving β€” and then divide and round up. iconic behaviour, no cap ✨

⚠️ okay important warning bestie, listen up: the Generic code divides by 0 if d is zero and returns ~0 on overflow. meanwhile architecture specific code may trap on zero or overflow. so like… don't be messy with your divisors, this is not a drill πŸ’€

🌈 RETURN 🌈

(a * b + d - 1) / d

that's the whole vibe. that's the formula. slay 🧚


πŸ’« SEE ALSO πŸ’«

the whole friend group, all linked up 🫢 (all from the Kernel file ./include/linux/math64.h):


anyway that's the page bestie πŸ’– she lives in ./include/linux, dated October 2026, and this whole little deep-dive came straight from the Kernel API Manual. mwah, go multiply something responsibly πŸŒΈπŸŽ€πŸ¦‹

πŸ“¦ where this page comes from