Yesterday, nobody contributed anything. :-(
The official answer is:
floor(log2(x + 2))