3 ms·
Remarkable. He uses lots of bitwise operations in the application.
by kenrick95 11y ago
Remarkable. He uses lots of bitwise operations in the application.
- efaref 11y agoHe's using integers as sets of (small) integers, int Possibles = Block[BlockIndex] & Row[RowIndex] & Col[ColIndex]; while (Possibles) { int valbit = Possibles & (-Possibles); // Lowest 1 bit in Possibles Possibles &= ~valbit; Entry[Square] = valbit; Block[BlockIndex] &= ~valbit; Row[RowIndex] &= ~valbit; Col[ColIndex] &= ~valbit; is more generally: set<int> possibles = block[block_index].intersect(row[row_index]).intersect(col[col_index]); while (!possibles.is_empty()) { int value = possibles.pop(); entry[square] = value; block[block_index].remove(value); row[row_index].remove(value); col[col_index].remove(value);