Skip to content

Commit

Permalink
Fix performance bug in FullRank.
Browse files Browse the repository at this point in the history
  • Loading branch information
sigh committed Aug 11, 2024
1 parent 2e3080e commit 46de836
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions js/solver/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3520,15 +3520,15 @@ SudokuConstraintHandler.FullRank = class FullRank extends SudokuConstraintHandle
equalValuesMask &= ~lowV;
continue;
}
const maxEntryV = LookupTables.maxValue(highV);
if (LookupTables.maxValue(lowV) < maxEntryV) {
const mask = (1 << maxEntryV) - 1;
const maxHighV = LookupTables.maxValue(highV);
if (LookupTables.maxValue(lowV) > maxHighV) {
const mask = (1 << maxHighV) - 1;
grid[lowEntry[i]] = (lowV &= mask & equalValuesMask);
handlerAccumulator.addForCell(lowEntry[i]);
}
const minV = LookupTables.minValue(lowV);
if (LookupTables.minValue(highV) < minV) {
const mask = -1 << (minV - 1);
const minLowV = LookupTables.minValue(lowV);
if (LookupTables.minValue(highV) < minLowV) {
const mask = -1 << (minLowV - 1);
grid[highEntry[i]] = (highV &= mask & equalValuesMask);
handlerAccumulator.addForCell(highEntry[i]);
}
Expand Down

0 comments on commit 46de836

Please sign in to comment.