Problem regarding bit manipulation

Why in this problem log2(n)+1 doesn’t work ??

it should work though : (

I have seen your solutions and I feel that there is a case when log(n)/log(2) comes out to be say 60.999999
and our long long int converts it to 60 while it should be converted to 61 .

that’s only possible explanation I can give

hope it may help you XD

//