-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix file sorting for more than 11 elements
V8's Array.prototype.sort uses combination of quick sort and insertion sort. The compare function should return integer (-1, 0, 1), but we were returning a boolean, which is incorrect. Boolean true equals to 1, but boolean false equals to 0, not -1. The way the condition was written, it worked for small arrays (where only insertion sort, which is stable, was used), but not for larger arrays, when unstable quick sort screwed it up.
- Loading branch information
Showing
2 changed files
with
14 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters