1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>bitmap_bitremap</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="The Linux Kernel API"><link rel="up" href="kernel-lib.html#idp1123213284" title="Bitmap Operations"><link rel="prev" href="API-bitmap-remap.html" title="bitmap_remap"><link rel="next" href="API-bitmap-onto.html" title="bitmap_onto"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">bitmap_bitremap</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-bitmap-remap.html">Prev</a> </td><th width="60%" align="center">Bitmap Operations</th><td width="20%" align="right"> <a accesskey="n" href="API-bitmap-onto.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-bitmap-bitremap"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>bitmap_bitremap — 2 Apply map defined by a pair of bitmaps to a single bit 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">bitmap_bitremap </b>(</code></td><td>int <var class="pdparam">oldbit</var>, </td></tr><tr><td> </td><td>const unsigned long * <var class="pdparam">old</var>, </td></tr><tr><td> </td><td>const unsigned long * <var class="pdparam">new</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">bits</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1123331076"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>oldbit</code></em></span></dt><dd><p> 4 bit position to be mapped 5 </p></dd><dt><span class="term"><em class="parameter"><code>old</code></em></span></dt><dd><p> 6 defines domain of map 7 </p></dd><dt><span class="term"><em class="parameter"><code>new</code></em></span></dt><dd><p> 8 defines range of map 9 </p></dd><dt><span class="term"><em class="parameter"><code>bits</code></em></span></dt><dd><p> 10 number of bits in each of these bitmaps 11 </p></dd></dl></div></div><div class="refsect1"><a name="idp1123335756"></a><h2>Description</h2><p> 12 Let <em class="parameter"><code>old</code></em> and <em class="parameter"><code>new</code></em> define a mapping of bit positions, such that 13 whatever position is held by the n-th set bit in <em class="parameter"><code>old</code></em> is mapped 14 to the n-th set bit in <em class="parameter"><code>new</code></em>. In the more general case, allowing 15 for the possibility that the weight 'w' of <em class="parameter"><code>new</code></em> is less than the 16 weight of <em class="parameter"><code>old</code></em>, map the position of the n-th set bit in <em class="parameter"><code>old</code></em> to 17 the position of the m-th set bit in <em class="parameter"><code>new</code></em>, where m == n % w. 18 </p><p> 19 20 The positions of unset bits in <em class="parameter"><code>old</code></em> are mapped to themselves 21 (the identify map). 22 </p><p> 23 24 Apply the above specified mapping to bit position <em class="parameter"><code>oldbit</code></em>, returning 25 the new bit position. 26 </p><p> 27 28 For example, lets say that <em class="parameter"><code>old</code></em> has bits 4 through 7 set, and 29 <em class="parameter"><code>new</code></em> has bits 12 through 15 set. This defines the mapping of bit 30 position 4 to 12, 5 to 13, 6 to 14 and 7 to 15, and of all other 31 bit positions unchanged. So if say <em class="parameter"><code>oldbit</code></em> is 5, then this routine 32 returns 13. 33</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-bitmap-remap.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="kernel-lib.html#idp1123213284">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-bitmap-onto.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">bitmap_remap</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">bitmap_onto</span></td></tr></table></div></body></html> 34