private void RemovePair(WorkBuffer <Int2> list, int j, int k) { var n = list.UsedSize; var data = list.Data; for (var i = 0; i < n; ++i) { var s = data[i]; if (s.x == j && s.y == k) { data[i] = data[n - 1]; list.RemoveLast(1); return; } } }
private void FilterCells(WorkBuffer <Int3> cells, WorkBuffer <int> flags) { var ptr = 0; var n = cells.UsedSize; var cellsData = cells.Data; var flagsData = flags.Data; for (var i = 0; i < n; ++i) { if (flagsData[i] == Target) { cellsData[ptr++] = cellsData[i]; } } cells.RemoveLast(n - ptr); }