In how many bits do I fit
JavaScript (ES6), 18 bytes



f=n=&gt;n&amp;&amp;1+f(n&gt;&gt;&gt;1)
&lt;input type=number min=0 step=1 value=8 oninput="O.value=f(this.value)"&gt;
&lt;input id=O value=4 disabled&gt;