runBlock method

int runBlock(
  1. int index
)

The block that owns run index.

Implementation

int runBlock(int index) {
  // The last block whose first run is at or before [index]: blocks before
  // the owner that share its first run are containers with no runs.
  var lo = 0, hi = blockCount - 1;
  while (lo < hi) {
    final mid = (lo + hi + 1) >> 1;
    if (_block(mid, BlockField.firstRun) <= index) {
      lo = mid;
    } else {
      hi = mid - 1;
    }
  }
  return lo;
}