Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix loop condition in _allDistMargin #17

Merged
merged 1 commit into from
Nov 24, 2013
Merged

Fix loop condition in _allDistMargin #17

merged 1 commit into from
Nov 24, 2013

Conversation

twpayne
Copy link
Contributor

@twpayne twpayne commented Nov 24, 2013

I think this fixes a bug in _allDistMargin. In the existing code, compare the loop condition for leftBBox with the loop condition for rightBBox:

for (i = m; i < M - m; i++) { // leftBBox
    // ...
}
for (i = M - m - 1; i >= 0; i--) { // rightBBox
    // ...
}

The code for rightBBox completes more iterations. I think the code should be symmetrical with both loops completing the same number of iterations. I think the attached patch fixes this by making the rightBBox loop match the leftBBox loop.

@mourner
Copy link
Owner

mourner commented Nov 24, 2013

You're totally right.

mourner added a commit that referenced this pull request Nov 24, 2013
Fix loop condition in _allDistMargin
@mourner mourner merged commit aaebbf0 into mourner:master Nov 24, 2013
@twpayne twpayne deleted the fix-all-dist-margin branch November 24, 2013 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants