Fixed signed integer overflow. Closes #1

This commit is contained in:
2024-01-21 17:00:40 -08:00
parent 16d46d3de6
commit b39979a471

View File

@@ -521,13 +521,9 @@ struct Iterator {
// Call Stepwise::step for each element of remaining until it returns true.
// Applies a permutation to `remaining` as a side effect.
template <class Stepwise>
void runInterleaved(std::span<Stepwise> remaining, int stepLimit = -1) {
template <class Stepwise> void runInterleaved(std::span<Stepwise> remaining) {
while (remaining.size() > 0) {
for (int i = 0; i < int(remaining.size());) {
if (stepLimit-- == 0) {
return;
}
bool done = remaining[i].step();
if (done) {
if (i != int(remaining.size()) - 1) {
@@ -542,16 +538,9 @@ void runInterleaved(std::span<Stepwise> remaining, int stepLimit = -1) {
}
};
template <class Stepwise>
void runSequential(std::span<Stepwise> remaining, int stepLimit = -1) {
template <class Stepwise> void runSequential(std::span<Stepwise> remaining) {
for (auto &r : remaining) {
if (stepLimit-- == 0) {
return;
}
while (!r.step()) {
if (stepLimit-- == 0) {
return;
}
}
}
}