Bitwise shifts include left-shift operations of the form shift-expression <<
additive-expression and right-shift operations of the form shift-expression >>
additive-expression. The standard integer promotions are first performed on the operands, each of which has an integer type. The type of the result is that of the promoted left operand. If the value of the right operand is negative or is greater than or equal to the width of the promoted left operand, the behavior is undefined. See also (see undefined behavior 51 in Annex J of the C Standard.)
Do not shift a value by a negative number of bits or by a number greater than the precision of the promoted left operand. The precision of an integer type is the number of bits it uses to represent values, excluding any sign and padding bits. For unsigned integer types the width and the precision are the same, while for signed integer types the width is one greater than the precision. We use precision instead of width in this rule to prevent a bit change from escaping the value bits to enter the sign bit, which is a violation of INT32-C. Ensure that operations on signed integers do not result in overflow.
...