I'm independently studying bit-shifting by porting some C++ functions to .NET's BigInteger. I noticed that when I shifted BigInteger the void was filled in with ones.
I believe this has to do with the negative number being stored in twos compliment form.
BigInteger num = -126;
compactBitsRepresentation = (uint)(int)(num << 16);
Here is what happened after the shift (most significant bit first)
10000010 will be shifted 16
11111111100000100000000000000000 was shifted 16
Should I always expect a similar bit-shift operation to act this way? Is this consistent with different languages and implementations of "bigNumber" such as OpenSSL?