In how many bits do I fit For any positive 32-bit integer (1 ≤ n ≤ 0xFFFFFFFF) output the number of bits needed to represent that integer.
Test cases
| n    | n in binary | bits needed |
|----------------------------------|
| 1    | 1           | 1           |
| 2    | 10          | 2           |
| 3    | 11          | 2           |
| 4    | 100         | 3           |
| 7    | 111         | 3           |
| 8    | 1000        | 4           |
| 15   | 1111        | 4           |
| 16   | 10000       | 5           |
| 128  | 10000000    | 8           |
| 341  | 101010101   | 9           |

4294967295 =&gt; 11111111111111111111111111111111 =&gt; 32

So f(16) would print or return 5
This is code-golf. Shortest code in bytes wins
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;