Possible Duplicate:
Left shifting with a negative shift count
On a 16-bit compiler, why does 32<<-3
or 32>>-1
result in 0?
what is the major reason for such a behaviour
Possible Duplicate:
Left shifting with a negative shift count
On a 16-bit compiler, why does 32<<-3
or 32>>-1
result in 0?
what is the major reason for such a behaviour
From K&R:
The shift operators << and >> perform left and right shifts of their left operand by the number of bit positions given by the right operand, which must be non-negative