'\" t .\" Title: bitmap_remap .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: July 2017 .\" Manual: Basic Kernel Library Functions .\" Source: Kernel Hackers Manual 4.11.6 .\" Language: English .\" .TH "BITMAP_REMAP" "9" "July 2017" "Kernel Hackers Manual 4\&.11\&" "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_remap \- Apply map defined by a pair of bitmaps to another bitmap .SH "SYNOPSIS" .HP \w'void\ bitmap_remap('u .BI "void bitmap_remap(unsigned\ long\ *\ " "dst" ", const\ unsigned\ long\ *\ " "src" ", const\ unsigned\ long\ *\ " "old" ", const\ unsigned\ long\ *\ " "new" ", unsigned\ int\ " "nbits" ");" .SH "ARGUMENTS" .PP \fIunsigned long * dst\fR .RS 4 remapped result .RE .PP \fIconst unsigned long * src\fR .RS 4 subset to be remapped .RE .PP \fIconst unsigned long * old\fR .RS 4 defines domain of map .RE .PP \fIconst unsigned long * new\fR .RS 4 defines range of map .RE .PP \fIunsigned int nbits\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 If either of the \fIold\fR and \fInew\fR bitmaps are empty, or if \fIsrc\fR and \fIdst\fR point to the same location, then this routine copies \fIsrc\fR to \fIdst\fR\&. .PP The positions of unset bits in \fIold\fR are mapped to themselves (the identify map)\&. .PP Apply the above specified mapping to \fIsrc\fR, placing the result in \fIdst\fR, clearing any bits previously set in \fIdst\fR\&. .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 \fIsrc\fR comes into this routine with bits 1, 5 and 7 set, then \fIdst\fR should leave with bits 1, 13 and 15 set\&. .SH "COPYRIGHT" .br