commit | 9b987f8c98763ee569bde90b5268b43474ca106c | [log] [tgz] |
---|---|---|
author | Christopher Swenson <chris@caswenson.com> | Fri Feb 27 14:55:49 2015 +0800 |
committer | Daniel Veillard <veillard@redhat.com> | Fri Feb 27 14:55:49 2015 +0800 |
tree | b36ed38b87a33b0749f0b5d48cc5c29a9a81a670 | |
parent | 9b8512337d14c8ddf662fcb98b0135f225a1c489 [diff] |
Fix timsort invariant loop re: Envisage article See http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/ We use a "runLen" array of size 128, so it should be nearly impossible to have our implementation overflow. But in any case, the fix is relatively simple -- checking two extra conditions in the invariant calculation. I also took this opportunity to remove some redundancy in the left/right merge logic in the invariant loop.