Tezos_stdlib.Bits

val numbits : int -> int

Assuming x >= 0, numbits x is the number of bits needed to represent x. This is also the unique k such that 2^{k - 1} <= x < 2^k if x > 0 and 0 otherwise.

x >= 0

numbits x

x

k

2^{k - 1} <= x < 2^k

x > 0

0

The behaviour is unspecified if x < 0.

x < 0