Files
amethyst/poc/c3d_permutation/source/main.cpp
tobid7 a9eed546b9 - Start work on drawlist
- Fix issue in texloader
- add ivec2 to tecloader / screen
- add draw func for iron
- add bufCfg in 3 variants to c3d
- add poc for c3d_permutation
2025-11-24 14:25:35 +01:00

30 lines
713 B
C++

#include <format>
#include <iostream>
#include <stdexcept>
using u64 = unsigned long long;
constexpr u64 permutation(int ac) {
u64 ret = 0;
if (ac < 1 || ac > 15) {
throw std::runtime_error("[amy] " + std::to_string(ac) +
" is out of range (1...15)!");
}
for (int i = 0; i < ac; i++) {
ret = (ret << 4) | (ac - 1 - i);
}
return ret;
}
int main(int argc, char** argv) {
int v = 3;
if (argc == 2) {
v = std::stoi(argv[1]);
} else {
std::cout << "No input provided! using example..." << std::endl;
}
std::cout << std::format("{} -> {:#x} ({})", v, permutation(v),
permutation(v))
<< std::endl;
return 0;
}