introduce bitloops

This commit is contained in:
mike
2026-01-17 14:21:50 +01:00
parent 9102dcb922
commit bd25f65194
43 changed files with 150342 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
package puzzle;
public final class DictDataL2 {
private DictDataL2() {}
static final int LEN = 2;
static final int ROWS = 52;
static final int COLS = 4;
static final int WORDS_LEN = 211;
static final int POS_LEN = 208;
private static long[] words() {
long[] out = new long[WORDS_LEN];
int k = 0;
k = copy(out, k, DictDataL2W0.DATA);
return out;
}
private static long[] posFlat() {
long[] out = new long[POS_LEN];
int k = 0;
k = copy(out, k, DictDataL2P0.DATA);
return out;
}
public static SwedishGenerator.DictEntry entry() {
long[] wds = words();
long[] flat = posFlat();
long[][] pos = reshape(flat, ROWS, COLS);
return new SwedishGenerator.DictEntry(wds, pos, wds.length, (wds.length + 63) >>> 6);
}
private static int copy(long[] dst, int at, long[] src) {
System.arraycopy(src, 0, dst, at, src.length);
return at + src.length;
}
private static long[][] reshape(long[] flat, int rows, int cols) {
long[][] out = new long[rows][cols];
int k = 0;
for (int r = 0; r < rows; r++) {
System.arraycopy(flat, k, out[r], 0, cols);
k += cols;
}
return out;
}
}