'\" t .\" Title: reciprocal_scale .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: May 2018 .\" Manual: Driver Basics .\" Source: Kernel Hackers Manual 3.16.56 .\" Language: English .\" .TH "RECIPROCAL_SCALE" "9" "May 2018" "Kernel Hackers Manual 3\&.16\&" "Driver Basics" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" reciprocal_scale \- "scale" a value into range [0, ep_ro) .SH "SYNOPSIS" .HP \w'u32\ reciprocal_scale('u .BI "u32 reciprocal_scale(u32\ " "val" ", u32\ " "ep_ro" ");" .SH "ARGUMENTS" .PP \fIval\fR .RS 4 value .RE .PP \fIep_ro\fR .RS 4 right open interval endpoint .RE .SH "DESCRIPTION" .PP Perform a \(lqreciprocal multiplication\(rq in order to \(lqscale\(rq 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\*(Aqt that of modulo\&. ;) Note that if initial input is a small value, then result will return 0\&. .SH "RETURN" .PP a result based on val in interval [0, ep_ro)\&. .SH "COPYRIGHT" .br