I am trying to understand why BigInteger is throwing an overflow exception. I tried to visualize this by converting the BigInteger to a byte[]
and iteratively incrementing the shift until I see where the exception occurs.
- Should I be able to bit-shift >> a byte[], or is C# simply not able to?
Code causing an exception
uint amountToShift2 = 12;
BigInteger num = new BigInteger(-126);
uint compactBitsRepresentation = (uint)(num >> (int)amountToShift2);