MCPcopy Create free account
hub / github.com/N64Recomp/N64Recomp / next_permutation

Function next_permutation

RSPRecomp/src/rsp_recomp.cpp:843–858  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

841};
842
843bool 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
860void 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);

Callers 1

permuteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected