introduce bitloops
This commit is contained in:
@@ -76,45 +76,13 @@ public record SwedishGenerator() {
|
||||
public int count;
|
||||
}
|
||||
|
||||
public static final long[] OFFSETS_D_IDX;
|
||||
public static final long[] OFFSETS_D_IDX=Neighbors9x8.OFFSETS_D_IDX;
|
||||
public static final rci[] IT = Neighbors9x8.IT;
|
||||
public static final long[] NBR8_PACKED_LO = Neighbors9x8.NBR8_PACKED_LO;
|
||||
public static final long[] NBR8_PACKED_HI = Neighbors9x8.NBR8_PACKED_HI;
|
||||
public static final long[] PATH_LO;
|
||||
public static final long[] PATH_HI;
|
||||
public static final long[] PATH_LO= Neighbors9x8.PATH_LO;
|
||||
public static final long[] PATH_HI= Neighbors9x8.PATH_HI;
|
||||
|
||||
static {
|
||||
final int NEW_SIZE = SIZE << Masker.Slot.BIT_FOR_DIR;
|
||||
PATH_LO = new long[NEW_SIZE];
|
||||
PATH_HI = new long[NEW_SIZE];
|
||||
OFFSETS_D_IDX = new long[NEW_SIZE];
|
||||
for (int i = 0; i < SIZE; i++) {
|
||||
for (int d = 0; d < 4; d++) {
|
||||
int oldKey = (i << 2) | d;
|
||||
int newKey = (i << Masker.Slot.BIT_FOR_DIR) | d;
|
||||
PATH_LO[newKey] = Neighbors9x8.PATH_LO[oldKey];
|
||||
PATH_HI[newKey] = Neighbors9x8.PATH_HI[oldKey];
|
||||
OFFSETS_D_IDX[newKey] = Neighbors9x8.OFFSET_D_IDX_0_BASE[oldKey];
|
||||
}
|
||||
// Richting 4: Corner Down (Clue op r,c -> Woord op r,c+1 naar beneden)
|
||||
int r = IT[i].r();
|
||||
int c = IT[i].c();
|
||||
int newKey4 = (i << Masker.Slot.BIT_FOR_DIR) | 4;
|
||||
if (c + 1 < C) {
|
||||
long mLo = 0, mHi = 0;
|
||||
for (int ri = r; ri < R; ri++) {
|
||||
int target = Grid.offset(ri, c + 1);
|
||||
if (isLo(target)) mLo |= (1L << target);
|
||||
else mHi |= (1L << (target & 63));
|
||||
}
|
||||
PATH_LO[newKey4] = mLo;
|
||||
PATH_HI[newKey4] = mHi;
|
||||
int first = Grid.offset(r, c + 1);
|
||||
int last = Grid.offset(R - 1, c + 1);
|
||||
OFFSETS_D_IDX[newKey4] = (long)first | ((long)last << 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static final Pick PICK_DONE = null;//new Pick(null, null, 0, true);
|
||||
public static final Pick PICK_NOT_DONE = new Pick(null, null, 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user