Right shift of a negative integer
suggest changeRight-shifting a negative signed value is implementation-defined. The shift count must be non-negative and strictly less than the width of the promoted left operand; any other count is undefined behavior.
int signed_integer = -1;
int result = signed_integer >> 1; /* implementation-defined */
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents