introduce bitloops
This commit is contained in:
@@ -134,6 +134,10 @@ public record SwedishGenerator() {
|
||||
public final byte[] g;
|
||||
public long lo, hi;
|
||||
public static int offset(int r, int c) { return r | (c << 3); }
|
||||
|
||||
public Grid copy() {
|
||||
return new Grid(g.clone(), lo, hi);
|
||||
}
|
||||
}
|
||||
|
||||
public static record DictEntry(long[] words, long[][] posBitsets, int length, int numlong) { }
|
||||
@@ -258,8 +262,7 @@ public record SwedishGenerator() {
|
||||
|
||||
public static FillResult fillMask(final Rng rng, final Slotinfo[] slots,
|
||||
final Grid grid,
|
||||
final boolean multiThreaded) {
|
||||
val NO_LOG = (!Main.VERBOSE || multiThreaded);
|
||||
final boolean NO_LOG) {
|
||||
val used = new long[2048];
|
||||
val bitset = new long[2500];
|
||||
val g = grid.g;
|
||||
@@ -388,12 +391,11 @@ public record SwedishGenerator() {
|
||||
var tries = Math.min(MAX_TRIES_PER_SLOT, L);
|
||||
|
||||
for (var t = 0; t < tries; t++) {
|
||||
var r = rng.nextFloat();
|
||||
//int idxInArray = rng.biasedIndexPow3(L - 1);
|
||||
var arrIndex = (int) (r * r * r * (L - 1));
|
||||
var shardIdx = idxs[arrIndex];
|
||||
var w = entry.words[shardIdx];
|
||||
var lemIdx = Lemma.unpackIndex(w);
|
||||
//var r = rng.nextFloat();
|
||||
//var idxInArray = (int) (r * r * r * (L - 1));
|
||||
int idxInArray = rng.biasedIndexPow3(L - 1);
|
||||
var w = entry.words[idxs[idxInArray/*(int) (r * r * r * (L - 1))*/]];
|
||||
var lemIdx = Lemma.unpackIndex(w);
|
||||
if (Bit1029.get(used, lemIdx)) continue;
|
||||
low = glo;
|
||||
top = ghi;
|
||||
@@ -419,10 +421,9 @@ public record SwedishGenerator() {
|
||||
|
||||
var tries = Math.min(MAX_TRIES_PER_SLOT, N);
|
||||
for (var t = 0; t < tries; t++) {
|
||||
double r = rng.nextFloat();
|
||||
var shardIdx = (int) (r * r * r * (N - 1));
|
||||
var w = entry.words[shardIdx];
|
||||
var lemIdx = Lemma.unpackIndex(w);
|
||||
// double r = rng.nextFloat();
|
||||
var w = entry.words[rng.biasedIndexPow3(N - 1)/*(int) (r * r * r * (N - 1))*/];
|
||||
var lemIdx = Lemma.unpackIndex(w);
|
||||
if (Bit1029.get(used, lemIdx)) continue;
|
||||
low = glo;
|
||||
top = ghi;
|
||||
|
||||
Reference in New Issue
Block a user