introduce bitloops
This commit is contained in:
@@ -131,9 +131,6 @@ public record Export() {
|
||||
}).limit(Long.bitCount(lo)));
|
||||
}
|
||||
}
|
||||
char NOT_CLUE_NOT_LETTER_TO(byte b) {
|
||||
return (char) (64 | b);
|
||||
}
|
||||
String gridToString(Clues clues) {
|
||||
var sb = new StringBuilder(INIT);
|
||||
clues.forEachSlot((s, l, a) -> {
|
||||
@@ -174,34 +171,17 @@ public record Export() {
|
||||
sb.setCharAt(r * (C + 1) + c, (char) (letter | 64));
|
||||
});
|
||||
return sb.toString().replaceAll(" ", "" + emptyFallback).split("\n");
|
||||
/*
|
||||
var out = new String[R];
|
||||
for (var r = 0; r < R; r++) {
|
||||
var sb = new StringBuilder(C);
|
||||
for (var c = 0; c < C; c++) {
|
||||
var offset = Grid.offset(r, c);
|
||||
if (clues.isClue(offset)) {
|
||||
sb.append(clueChar.replace(new Cell(grid, clues, offset, clues.digitAt(offset))));
|
||||
} else if (lisLetterAt(offset)) {
|
||||
sb.append(NOT_CLUE_NOT_LETTER_TO(grid.letter32At(offset)));
|
||||
} else {
|
||||
sb.append(emptyFallback);
|
||||
}
|
||||
}
|
||||
out[r] = sb.toString();
|
||||
}
|
||||
return out;*/
|
||||
}
|
||||
}
|
||||
|
||||
record Bit1029(long[] bits) {
|
||||
interface Bit1029 {
|
||||
|
||||
public Bit1029() { this(new long[2048]); }
|
||||
static int wordIndex(int bitIndex) { return bitIndex >> 6; }
|
||||
public boolean get(int bitIndex) { return (this.bits[wordIndex(bitIndex)] & 1L << bitIndex) != 0L; }
|
||||
public void set(int bitIndex) { bits[wordIndex(bitIndex)] |= 1L << bitIndex; }
|
||||
public void clear(int bitIndex) { this.bits[wordIndex(bitIndex)] &= ~(1L << bitIndex); }
|
||||
public void clear() { Arrays.fill(bits, 0L); }
|
||||
public static long[] bit1029() { return new long[2048]; }
|
||||
static int wordIndex(int bitIndex) { return bitIndex >> 6; }
|
||||
static public boolean get(long[] bits, int bitIndex) { return (bits[wordIndex(bitIndex)] & 1L << bitIndex) != 0L; }
|
||||
static public void set(long[] bits, int bitIndex) { bits[wordIndex(bitIndex)] |= 1L << bitIndex; }
|
||||
static public void clear(long[] bits, int bitIndex) { bits[wordIndex(bitIndex)] &= ~(1L << bitIndex); }
|
||||
static public void clear(long[] bits) { Arrays.fill(bits, 0L); }
|
||||
}
|
||||
|
||||
record Placed(long lemma, int slotKey, int[] cells) {
|
||||
|
||||
Reference in New Issue
Block a user