Remove branching logic to improve performance.

Remove branching logic from the looping code. Allowing loop unrolling and pipelining of code to increase performance.