How can I obtain the value of INT_MAX using only the bitwise operators, in C? I expected ~0 to be 1111111111 (complement of 1, so decimal -1) and ~0 >> 1 to be 0111111111, which would be max, but it's still -1.
Why is that and how can I obtain the value of INT_MAX by using bit operations?