mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #6775 from dearblue/array-combination.2
This commit is contained in:
@@ -1619,13 +1619,9 @@ ary_combination_next(mrb_state *mrb, mrb_value self)
|
||||
}
|
||||
else {
|
||||
/* Reset dependent indices */
|
||||
for (mrb_int i = pos + 1; i < state->n; i++) {
|
||||
if (state->permutation) {
|
||||
state->indices[i] = 0;
|
||||
}
|
||||
else {
|
||||
state->indices[i] = state->indices[i - 1];
|
||||
}
|
||||
mrb_int reset = state->permutation ? 0 : state->indices[pos];
|
||||
for (pos++; pos < state->n; pos++) {
|
||||
state->indices[pos] = reset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user