reciprocal_scale(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

NAME πŸ’–

okay so this is reciprocal_scale(9), and we’re hanging out in the Kernel API Manual. The name says it all: reciprocal_scale β€” "scale" a value into range [0, ep_ro). slay.

SYNOPSIS ✨

u32 reciprocal_scale (u32 val , u32 ep_ro );

ARGUMENTS πŸŽ€

  • val β€” value.
  • ep_ro β€” right open interval endpoint.

DESCRIPTION πŸ¦‹

okay so what this does: it performs a "reciprocal multiplication" in order to "scale" a value into range [0, ep_ro), where the upper interval endpoint is right-open. It’s useful, e.g. for accessing an index of an array containing ep_ro elements, for example. Think of it as a sort of modulus, only the result isn’t that of modulo. ;) iconic little math moment.

note that if the initial input is a small value, then the result will return 0. no cap.

RETURN 🌸

Returns a result based on val in interval [0, ep_ro). cute, consistent, done πŸ’….

SEE ALSO πŸ”₯

Peep the kernel file ./include/linux/math.h and these absolute icons: round_up(9), round_down(9), DIV_ROUND_UP_POW2(9), roundup(9), rounddown(9), abs(9), abs_diff(9). iykyk πŸ’œ.


Cute sign-off: source/version is ./include/linux, date is October 2026, and yep, it’s reciprocal_scale(9) β€” xoxo, your kernel bestie πŸ’–

πŸ“¦ where this page comes from