fix build with Go 1.0 + branch optimization

inverted loop condition, so that in common case it matches the previous
branching result