'\" t .\" Title: bitmap_ord_to_pos .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: May 2018 .\" Manual: Basic Kernel Library Functions .\" Source: Kernel Hackers Manual 3.16.56 .\" Language: English .\" .TH "BITMAP_ORD_TO_POS" "9" "May 2018" "Kernel Hackers Manual 3\&.16\&" "Basic Kernel Library Functions" .\" ----------------------------------------------------------------- .\" * 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" bitmap_ord_to_pos \- find position of n\-th set bit in bitmap .SH "SYNOPSIS" .HP \w'int\ bitmap_ord_to_pos('u .BI "int bitmap_ord_to_pos(const\ unsigned\ long\ *\ " "buf" ", int\ " "ord" ", int\ " "bits" ");" .SH "ARGUMENTS" .PP \fIbuf\fR .RS 4 pointer to bitmap .RE .PP \fIord\fR .RS 4 ordinal bit position (n\-th set bit, n >= 0) .RE .PP \fIbits\fR .RS 4 number of valid bit positions in \fIbuf\fR .RE .SH "DESCRIPTION" .PP Map the ordinal offset of bit \fIord\fR in \fIbuf\fR to its position in \fIbuf\fR\&. Value of \fIord\fR should be in range 0 <= \fIord\fR < weight(buf), else results are undefined\&. .PP If for example, just bits 4 through 7 are set in \fIbuf\fR, then \fIord\fR values 0 through 3 will get mapped to 4 through 7, respectively, and all other \fIord\fR values return undefined values\&. When \fIord\fR value 3 gets mapped to (returns) \fIpos\fR value 7 in this example, that means that the 3rd set bit (starting with 0th) is at position 7 in \fIbuf\fR\&. .PP The bit positions 0 through \fIbits\fR are valid positions in \fIbuf\fR\&. .SH "COPYRIGHT" .br