introduce bitloops
This commit is contained in:
@@ -250,7 +250,7 @@ public final class Masker {
|
||||
}
|
||||
if ((bitCount(rLo) + bitCount(rHi)) < MIN_LEN) penalty += 8000;
|
||||
int wordLen = bitCount(rLo) + bitCount(rHi);
|
||||
if (wordLen > 5) penalty += (wordLen - 5) * 2000;
|
||||
if (wordLen > 5) penalty += (wordLen - 5) * 1000L;
|
||||
} else penalty += 25000;
|
||||
}
|
||||
for (long bits = hi_cl; bits != X; bits &= bits - 1) {
|
||||
@@ -294,7 +294,7 @@ public final class Masker {
|
||||
}
|
||||
if ((bitCount(rLo) + bitCount(rHi)) < MIN_LEN) penalty += 8000;
|
||||
int wordLen = bitCount(rLo) + bitCount(rHi);
|
||||
if (wordLen > 5) penalty += (wordLen - 5) * 2000;
|
||||
if (wordLen > 5) penalty += (wordLen - 5) * 1000L;
|
||||
} else penalty += 25000;
|
||||
}
|
||||
|
||||
@@ -307,8 +307,8 @@ public final class Masker {
|
||||
rCount[idx & 7]++;
|
||||
cCount[idx >> 3]++;
|
||||
}
|
||||
for (int rc : rCount) if (rc < 2) penalty += (2 - rc) * 4000;
|
||||
for (int cc : cCount) if (cc < 2) penalty += (2 - cc) * 4000;
|
||||
for (int rc : rCount) if (rc < 2) penalty += (2 - rc) * 4000L;
|
||||
for (int cc : cCount) if (cc < 2) penalty += (2 - cc) * 4000L;
|
||||
|
||||
// Connectiviteitscheck
|
||||
for (int i = 0; i < numClues; i++) {
|
||||
@@ -368,7 +368,7 @@ public final class Masker {
|
||||
totalReachedHi |= currentReachedHi;
|
||||
}
|
||||
if (maxReached < numClues) {
|
||||
penalty += (numClues - maxReached) * 4000;
|
||||
penalty += (numClues - maxReached) * 4000L;
|
||||
penalty += 20000;
|
||||
}
|
||||
}
|
||||
@@ -416,7 +416,7 @@ public final class Masker {
|
||||
compHi |= expandedHi & hi_cl;
|
||||
} while (compLo != lastLo || compHi != lastHi);
|
||||
int s = bitCount(compLo) + bitCount(compHi);
|
||||
if (s >= 2) penalty += (long) (s - 1) * 120;
|
||||
if (s >= 2) penalty += (long) (s - 1) * 520;
|
||||
remLo &= ~compLo;
|
||||
remHi &= ~compHi;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user