move the assignment to the end of the loop. This is more readable and isn't miscompiled w/ -O3 on a certain unnamed EBCDIC platforms compiler.