Fix overflows in shift primitives.