Left shifting a negative left-hand operand is undefined behavior per section 5.8.2 of the C++11 standard.