// Computes the smallest S2Cell that covers the S2Cell range (first, last) and // adds this cell to "cell_ids". // // REQUIRES: "first" and "last" have a common ancestor. private static void CoverRange(S2CellId first, S2CellId last, List <S2CellId> cell_ids) { if (first == last) { // The range consists of a single index cell. cell_ids.Add(first); } else { // Add the lowest common ancestor of the given range. int level = first.CommonAncestorLevel(last); System.Diagnostics.Debug.Assert(level >= 0); cell_ids.Add(first.Parent(level)); } }