Skip to content

Commit

Permalink
continuous second guessing and validation
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Dec 28, 2024
1 parent f07029b commit 209b88a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Etterna/Models/Misc/TimingData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1451,11 +1451,15 @@ TimingData::BuildAndGetEtar(int lastrow)
return ElapsedTimesAtAllRows;
}

ElapsedTimesAtAllRows.resize(lastrow);
const auto maxIndex = lastrow + 1;

// there is 1 extra because this would
// mean that etar[lastrow] = the time at the last row
ElapsedTimesAtAllRows.resize(maxIndex);

// just dont parallelize at all if it probably wont help anyways
if (lastrow < 50000) {
for (auto r = 0; r <= lastrow; ++r) {
if (maxIndex < 50000) {
for (auto r = 0; r < maxIndex; ++r) {
ElapsedTimesAtAllRows[r] =
GetElapsedTimeFromBeatNoOffset(NoteRowToBeat(r));
}
Expand Down Expand Up @@ -1484,6 +1488,9 @@ TimingData::BuildAndGetEtar(int lastrow)

auto exec = [this, &threadRanges](int threadIndex) {
auto& range = threadRanges[threadIndex];
// the exclusive upper bound
// means that the final index etar.size() is skipped
// (because if it wasnt, that is out of bounds)
for (auto i = range.first; i < range.second; i++) {
ElapsedTimesAtAllRows[i] =
GetElapsedTimeFromBeatNoOffset(NoteRowToBeat(i));
Expand Down

0 comments on commit 209b88a

Please sign in to comment.