function binarySearch(arr, cmp) {
  var min = 0;
  var max = arr.length - 1;

  while (min <= max) {
    var mid = min + max >> 1;
    var res = cmp(arr[mid]);

    if (res < 0) {
      max = mid - 1;
    } else if (res > 0) {
      min = mid + 1;
    } else {
      return mid;
    }
  }

  return -1;
}
This class is used when GPOS does not define 'mark' or 'mkmk' features
for positioning marks relative to base glyphs. It uses the unicode
combining class property to position marks.

Based on code from Harfbuzz, thanks!
https://github.com/behdad/harfbuzz/blob/master/src/hb-ot-shape-fallback.cc