﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="thpdoc.xsl"?>
<page id="log2" suffix=" Function" compiletime="1">
  <subsection>Returns ceiling(log2(x)), where x is the function argument</subsection>
  <code>int log2(int x);</code>
  <section name="Remarks">
	The most typical case for <kw>log2</kw> function is determining vector sizes for signals based on the maximum assigned value.
  </section>
  <section name="Examples">
  <table>
	<tr><td>x</td><td>log2(x)</td></tr>
	<tr><td>1</td><td>0</td></tr>
	<tr><td>32</td><td>5</td></tr>
	<tr><td>33</td><td>6</td></tr>
  </table>
  </section>
  <seealso id="pow2"/>
  <seealso id="sizeof"/>
</page>