1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>intlog2</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Device Drivers"><link rel="up" href="ch06s02.html" title="Digital TV (DVB) devices"><link rel="prev" href="API-struct-dvb-frontend.html" title="struct dvb_frontend"><link rel="next" href="API-intlog10.html" title="intlog10"></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">intlog2</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-struct-dvb-frontend.html">Prev</a> </td><th width="60%" align="center">Digital TV (DVB) devices</th><td width="20%" align="right"> <a accesskey="n" href="API-intlog10.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-intlog2"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>intlog2 — 
2  computes log2 of a value; the result is shifted left by 24 bits
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">unsigned int <b class="fsfunc">intlog2 </b>(</code></td><td>u32 <var class="pdparam">value</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="id-1.8.3.19.5"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>value</code></em></span></dt><dd><p>
4     The value (must be != 0)
5    </p></dd></dl></div></div><div class="refsect1"><a name="id-1.8.3.19.6"></a><h2>to use rational values you can use the following method</h2><p>
6   intlog2(value) = intlog2(value * 2^x) - x * 2^24
7</p></div><div class="refsect1"><a name="id-1.8.3.19.7"></a><h2>Some usecase examples</h2><div class="informalexample"><pre class="programlisting">
8   	intlog2(8) will give 3 &lt;&lt; 24 = 3 * 2^24
9   	intlog2(9) will give 3 &lt;&lt; 24 + ... = 3.16... * 2^24
10   	intlog2(1.5) = intlog2(3) - 2^24 = 0.584... * 2^24
11</pre></div></div><div class="refsect1"><a name="id-1.8.3.19.8"></a><h2>return</h2><p>
12   log2(value) * 2^24
13</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-struct-dvb-frontend.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch06s02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-intlog10.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">struct dvb_frontend</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">intlog10</span></td></tr></table></div></body></html>
14