Previously, the 0th index was never being checked, and it would eagerly exit if a
one-directional check completed before the other. This diverged from the original
implementation (which in itself isn't a problem), but I think the behavior is likely not what
was intended. This refactors makes the function clearer, and removes both of the aforementioned behaviors.
It should maintain the same efficiency, but it's not clear since there are no benchmarks.
I was going to wait until the example was merged to use it to compare the before and after of this, and I can still do that if that's better.
Previously, the 0th index was never being checked, and it would eagerly exit if a one-directional check completed before the other. This diverged from the original implementation (which in itself isn't a problem), but I think the behavior is likely not what was intended. This refactors makes the function clearer, and removes both of the aforementioned behaviors. It should maintain the same efficiency, but it's not clear since there are no benchmarks.
I was going to wait until the example was merged to use it to compare the before and after of this, and I can still do that if that's better.