modify loop condition.Eliminate some unnecessary computing.