Fixed signed integer overflow. Closes #1
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user