reciprocal_scale(9)
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
- 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