I am confused why does this produce 0xffffffff in C#, I was expecting it to produce 0x0. The type of the expression is uint.
Console.WriteLine(0xffffffff >> 32);
I am confused why does this produce 0xffffffff in C#, I was expecting it to produce 0x0. The type of the expression is uint.
Console.WriteLine(0xffffffff >> 32);
 
    
    As per the documentation:
If the first operand is an int or uint (32-bit quantity), the shift count is given by the low-order five bits of the second operand (second operand & 0x1f).
The second operand is 32. 32 & 0x1f is 0. Thus >> 32 is equivalent to 'shift this by 0 bits' therefore 'do nothing at all'.
