Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 // Generated by CoffeeScript 1.6.1
2 (function() {
4 window.binary_search = function(items, value) {
5 var pivot, start, stop;
6 start = 0;
7 stop = items.length - 1;
8 pivot = Math.floor((start + stop) / 2);
9 while (items[pivot] !== value && start < stop) {
10 if (value < items[pivot]) {
11 stop = pivot - 1;
12 }
13 if (value > items[pivot]) {
14 start = pivot + 1;
15 }
16 pivot = Math.floor((stop + start) / 2);
17 }
18 if (items[pivot] === value) {
19 return pivot;
20 } else {
21 return -1;
22 }
23 };
25 }).call(this);
27 /*
28 //# sourceMappingURL=code_binary_search.map
29 */