| 841 | }; |
| 842 | |
| 843 | bool next_permutation(const std::vector<uint32_t>& option_lengths, std::vector<uint32_t>& current) { |
| 844 | current[current.size() - 1] += 1; |
| 845 | |
| 846 | size_t i = current.size() - 1; |
| 847 | while (current[i] == option_lengths[i]) { |
| 848 | current[i] = 0; |
| 849 | if (i == 0) { |
| 850 | return false; |
| 851 | } |
| 852 | |
| 853 | current[i - 1] += 1; |
| 854 | i--; |
| 855 | } |
| 856 | |
| 857 | return true; |
| 858 | } |
| 859 | |
| 860 | void permute(const std::vector<uint32_t>& base_words, const std::vector<OverlaySlot>& overlay_slots, std::vector<Permutation>& permutations) { |
| 861 | auto current = std::vector<uint32_t>(overlay_slots.size(), 0); |