1RECIPROCAL_SCALE(9) Driver Basics RECIPROCAL_SCALE(9)
2
3
4
6 reciprocal_scale - "scale" a value into range [0, ep_ro)
7
9 u32 reciprocal_scale(u32 val, u32 ep_ro);
10
12 val
13 value
14
15 ep_ro
16 right open interval endpoint
17
19 Perform a “reciprocal multiplication” in order to “scale” a value into
20 range [0, ep_ro), where the upper interval endpoint is right-open. This
21 is useful, e.g. for accessing a index of an array containing ep_ro
22 elements, for example. Think of it as sort of modulus, only that the
23 result isn't that of modulo. ;) Note that if initial input is a small
24 value, then result will return 0.
25
27 a result based on val in interval [0, ep_ro).
28
30Kernel Hackers Manual 3.10 June 2019 RECIPROCAL_SCALE(9)