RECIPROCAL_SCALE(9) | Driver Basics | RECIPROCAL_SCALE(9) |
NAME¶
reciprocal_scale - "scale" a value into range [0, ep_ro)
SYNOPSIS¶
u32 reciprocal_scale(u32 val, u32 ep_ro);
ARGUMENTS¶
val
value
ep_ro
right open interval endpoint
DESCRIPTION¶
Perform a “reciprocal multiplication” in order to “scale” a value into range [0, ep_ro), where the upper interval endpoint is right-open. This is useful, e.g. for accessing a index of an array containing ep_ro elements, for example. Think of it as sort of modulus, only that the result isn't that of modulo. ;) Note that if initial input is a small value, then result will return 0.
RETURN¶
a result based on val in interval [0, ep_ro).
COPYRIGHT¶
June 2024 | Kernel Hackers Manual 3.10 |