introduce bitloops

This commit is contained in:
mike
2026-01-21 05:40:14 +01:00
parent f203f2106e
commit 386777e576

View File

@@ -26,10 +26,28 @@ public class Meta {
static record ShardRec(String word, long w, int simpel, String[] clues) { } static record ShardRec(String word, long w, int simpel, String[] clues) { }
static final Path projectRoot = Path.of("").toAbsolutePath().normalize(); // current working dir static final Path projectRoot = Path.of("").toAbsolutePath().normalize(); // current working dir
static final Path dir = projectRoot.resolve("src/main/resources/shards"); //static final Path dir = projectRoot.resolve("src/main/resources/shards");
static final Path shardData = dir.resolve("shard0.data"); //static final Path shardData = dir.resolve("shard0.data");
static final Path shardMap = dir.resolve("shard0.map"); //static final Path shardMap = dir.resolve("shard0.map");
static final Path dir = detectShardDir();
static final Path shardData = dir.resolve("shard0.data");
static final Path shardMap = dir.resolve("shard0.map");
private static Path detectShardDir() {
// 1) optioneel override
String p = System.getProperty("puzzle.shards.dir");
if (p != null && !p.isBlank()) return Path.of(p).toAbsolutePath().normalize();
// 2) default: naast classes output (CLASS_OUTPUT/shards)
try {
var url = Meta.class.getProtectionDomain().getCodeSource().getLocation(); // classes dir (niet jar)
Path classes = Path.of(url.toURI());
return classes.resolve("shards");
} catch (Exception e) {
// 3) fallback: oude dev-locatie
return Path.of("").toAbsolutePath().normalize().resolve("src/main/resources/shards");
}
}
// --- Lookup: w -> i using mmap --- // --- Lookup: w -> i using mmap ---
static int findIndexInMapMmap(long target) throws IOException { static int findIndexInMapMmap(long target) throws IOException {
try (var ch = FileChannel.open(Meta.shardMap, StandardOpenOption.READ)) { try (var ch = FileChannel.open(Meta.shardMap, StandardOpenOption.READ)) {