How does 1 left shift by 31 (1 << 31) work to get maximum int value? Here are my thoughts and some explanations I found online
问题 I'm fairly new to bit manipulation and I'm trying to figure out how (1 << 31) - 1 works. First I know that 1 << 31 is 1000000000000000000000000000 and I know it's actually complement of minimum int value, but when I tried to figure out (1 << 31) - 1, I found an explanation states that, it's just 10000000000000000000000000000000 - 1 = 01111111111111111111111111111111 I was almost tempted to believe it since it's really straightforward. But is this what really happening? If it's not, why it