Avoid branches in the loop and solve a gcc warning