browser/devtools/debugger/test/code_binary_search.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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 */

mercurial