abs_diff(9)
π abs_diff(9) β Kernel API Manual π
okay so bestie, welcome to the abs_diff page β¨ it's short, it's sweet, it's literally just math but make it kernel. let's get into it π
πΈ NAME πΈ
abs_diff β return the absolute value of the difference between the arguments π
β¨ SYNOPSIS β¨
abs_diff (a , b );
yes that's the whole thing. no cap, it's giving minimalism π
π«Ά ARGUMENTS π«Ά
aβ the first argument πbβ the second argument π¦
π DESCRIPTION π
okay so here's the vibe check: a and b have to be of the same type. like, that's not optional, that's the rule π with that restriction in place, we compare signed to signed and unsigned to unsigned β fr fr, no mixing, it's not that kind of function π
the result is the subtraction of the smaller of the two from the bigger, hence the result is always a positive value β¨ so like, whichever one is smaller just gets yeeted out of the bigger one, and you always come out with something positive. iconic behavior honestly π
β RETURN β
an absolute value of the difference between a and b π
π¦ SEE ALSO π¦
kernel file ./include/linux/math.h β and bestie, please go say hi to the whole math.h friend group, they're all so sweet:
and that's the page!! π mwah π
little sign-off from your girl: this one lives in ./include/linux, dated October 2026 β that's the source and the version-date situation, and yes i remembered it for you π«Άπ
π¦ 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