bool GeneralBenesNetwork::testNetwork(const Permut& perm) const { long sz = getSize(); long nlev = getNumLevels(); for (long j = 0; j < sz; j++) { // find correct position for j long j1 = j; for (long i = 0; i < nlev; i++) { const Vec<short>& lev = getLevel(i); j1 += shamt(i)*lev[j1]; } if (perm[j1] != j) return false; } return true; }
std::string Instruction::getShamtName() { std::string result = std::to_string( shamt().to_ulong() ); return result; }