tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

code_binary_search_absolute.js (629B)


      1 // Generated by CoffeeScript 1.6.1
      2 (function() {
      3 
      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  };
     24 
     25 }).call(this);
     26 
     27 /*
     28 //# sourceMappingURL=code_binary_search_absolute.map
     29 */