Fix compiler warning about possible undefined behavior.