lib/third_party/tracing/base/range.js
function binSearch(test) {
        var i0 = 0;
        var i1 = array.length;
        while (i0 < i1 - 1) {
          var i = Math.trunc((i0 + i1) / 2);
          if (test(i))
            i1 = i;  // Explore the left branch.
          else
            i0 = i;  // Explore the right branch.
        }
        return i1;
      }
function binSearch(test) {
        var i0 = 0;
        var i1 = array.length;
        while (i0 < i1 - 1) {
          var i = Math.trunc((i0 + i1) / 2);
          if (test(i))
            i1 = i;  // Explore the left branch.
          else
            i0 = i;  // Explore the right branch.
        }
        return i1;
      }
function binSearch ( test ) { var i0 = 0 ; var i1 = array . length ; while ( i0 < i1 - 1 ) { var i = Math . trunc ( ( i0 + i1 ) / 2 ) ; if ( test ( i ) ) i1 = i ; // Explore the left branch. else i0 = i ; // Explore the right branch. } return i1 ; }
Binary search. |test| is a function that should return true when we need to explore the left branch and false to explore the right branch.
Binary search . |test| is a function that should return true when we need to explore the left branch and false to explore the right branch .