Ejemplo n.º 1
0
void MasksTableGenerator::generateCombinationsForK(
  const std::bitset<8> & combination,
  unsigned char offset,
  unsigned char k,
  std::vector<mask_t> & combinationMasks)
{
    if (k == 0)
    {
        combinationMasks.push_back(combination.to_ulong());
        return;
    }
    
    for (auto i = offset; i < m_numSamples - (k - 1); ++i)
    {
        auto newCombination = combination;
        newCombination.set(i, true);
        generateCombinationsForK(newCombination, i + 1, k - 1, combinationMasks);
    }
}