'\" t .\" Title: bitmap_bitremap .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: January 2017 .\" Manual: Basic Kernel Library Functions .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "BITMAP_BITREMAP" "9" "January 2017" "Kernel Hackers Manual 4\&.8\&." "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_bitremap \- Apply map defined by a pair of bitmaps to a single bit .SH "SYNOPSIS" .HP \w'int\ bitmap_bitremap('u .BI "int bitmap_bitremap(int\ " "oldbit" ", const\ unsigned\ long\ *\ " "old" ", const\ unsigned\ long\ *\ " "new" ", int\ " "bits" ");" .SH "ARGUMENTS" .PP \fIoldbit\fR .RS 4 bit position to be mapped .RE .PP \fIold\fR .RS 4 defines domain of map .RE .PP \fInew\fR .RS 4 defines range of map .RE .PP \fIbits\fR .RS 4 number of bits in each of these bitmaps .RE .SH "DESCRIPTION" .PP Let \fIold\fR and \fInew\fR define a mapping of bit positions, such that whatever position is held by the n\-th set bit in \fIold\fR is mapped to the n\-th set bit in \fInew\fR\&. In the more general case, allowing for the possibility that the weight \*(Aqw\*(Aq of \fInew\fR is less than the weight of \fIold\fR, map the position of the n\-th set bit in \fIold\fR to the position of the m\-th set bit in \fInew\fR, where m == n % w\&. .PP The positions of unset bits in \fIold\fR are mapped to themselves (the identify map)\&. .PP Apply the above specified mapping to bit position \fIoldbit\fR, returning the new bit position\&. .PP For example, lets say that \fIold\fR has bits 4 through 7 set, and \fInew\fR has bits 12 through 15 set\&. This defines the mapping of bit position 4 to 12, 5 to 13, 6 to 14 and 7 to 15, and of all other bit positions unchanged\&. So if say \fIoldbit\fR is 5, then this routine returns 13\&. .SH "COPYRIGHT" .br