introduce bitloops
This commit is contained in:
@@ -18,6 +18,11 @@ public final class Masker {
|
||||
public static final long[] PATH_HI = Neighbors9x8.PATH_HI;
|
||||
public static final long MASK_LO = -1L;
|
||||
public static final long MASK_HI = Neighbors9x8.MASK_HI;//(1L << (SIZE - 64)) - 1;
|
||||
public static final int MIN_LEN = Neighbors9x8.MIN_LEN;//Config.MIN_LEN;
|
||||
public static final int STACK_SIZE = 128;
|
||||
public static final int C = Neighbors9x8.C;
|
||||
public static final int R = Neighbors9x8.R;
|
||||
public static final double SIZED = Neighbors9x8.SIZED;// ~18
|
||||
private final Rng rng;
|
||||
private final int[] stack;
|
||||
private final Clues cache;
|
||||
@@ -134,9 +139,9 @@ public final class Masker {
|
||||
var hitsLo = rayLo & lo;
|
||||
var hitsHi = rayHi & hi;
|
||||
|
||||
if (hitsHi != X) return (Long.bitCount(rayHi & -(1L << 63 - numberOfLeadingZeros(hitsHi) << 1)) >= SwedishGenerator.MIN_LEN);
|
||||
else if (hitsLo != X) return (Long.bitCount(rayLo & -(1L << 63 - numberOfLeadingZeros(hitsLo) << 1)) + Long.bitCount(rayHi) >= SwedishGenerator.MIN_LEN);
|
||||
else return (Long.bitCount(rayLo) + Long.bitCount(rayHi) >= SwedishGenerator.MIN_LEN);
|
||||
if (hitsHi != X) return (Long.bitCount(rayHi & -(1L << 63 - numberOfLeadingZeros(hitsHi) << 1)) >= MIN_LEN);
|
||||
else if (hitsLo != X) return (Long.bitCount(rayLo & -(1L << 63 - numberOfLeadingZeros(hitsLo) << 1)) + Long.bitCount(rayHi) >= MIN_LEN);
|
||||
else return (Long.bitCount(rayLo) + Long.bitCount(rayHi) >= MIN_LEN);
|
||||
}
|
||||
private static boolean validSlot(long lo, long hi, int key) {
|
||||
var rayLo = PATH_LO[key];
|
||||
@@ -144,9 +149,9 @@ public final class Masker {
|
||||
var hitsLo = rayLo & lo;
|
||||
var hitsHi = rayHi & hi;
|
||||
|
||||
if (hitsLo != X) return (Long.bitCount(rayLo & ((1L << numberOfTrailingZeros(hitsLo)) - 1)) >= SwedishGenerator.MIN_LEN);
|
||||
else if (hitsHi != X) return (Long.bitCount(rayLo) + Long.bitCount(rayHi & ((1L << numberOfTrailingZeros(hitsHi)) - 1)) >= SwedishGenerator.MIN_LEN);
|
||||
else return (Long.bitCount(rayLo) + Long.bitCount(rayHi) >= SwedishGenerator.MIN_LEN);
|
||||
if (hitsLo != X) return (Long.bitCount(rayLo & ((1L << numberOfTrailingZeros(hitsLo)) - 1)) >= MIN_LEN);
|
||||
else if (hitsHi != X) return (Long.bitCount(rayLo) + Long.bitCount(rayHi & ((1L << numberOfTrailingZeros(hitsHi)) - 1)) >= MIN_LEN);
|
||||
else return (Long.bitCount(rayLo) + Long.bitCount(rayHi) >= MIN_LEN);
|
||||
}
|
||||
private static void processSlot(Clues c, SlotVisitor visitor, int key) {
|
||||
var rayLo = PATH_LO[key];
|
||||
|
||||
Reference in New Issue
Block a user