unittest/sudokucelltest.cpp
// It is better to use a population count instruction or combination
// of bit manipulation to calculate faster. I write this in a simple way
// to avoid test testing itself.
It is better to use a population count instruction or combination
of bit manipulation to calculate faster. I write this in a simple way
to avoid test testing itself.
It is better to use a population count instruction or combination of bit manipulation to calculate faster . I write this in a simple way to avoid test testing itself .
SudokuIndex SudokuCellTest::countCandidates(SudokuCellCandidates candidates) {
    SudokuIndex result = 0;
    auto restCandidates = candidates;
    for(size_t i=0; i < bitsOf(restCandidates); ++i) {
        if ((restCandidates & 1) == 1) {
            ++result;
        }
        restCandidates >>= 1;
    }
    return result;
}
SudokuIndex SudokuCellTest :: countCandidates ( SudokuCellCandidates candidates ) { SudokuIndex result = 0 ; auto restCandidates = candidates ; for ( size_t i = 0 ; i < bitsOf ( restCandidates ) ; ++ i ) { if ( ( restCandidates & 1 ) == 1 ) { ++ result ; } restCandidates >>= 1 ; } return result ; }
It is better to use a population count instruction or combination
of bit manipulation to calculate faster.
It is better to use a population count instruction or combination of bit manipulation to calculate faster .