introduce bitloops

This commit is contained in:
mike
2026-01-12 03:52:52 +01:00
parent 678add4cb9
commit 123cdbdc01
3 changed files with 47 additions and 37 deletions

View File

@@ -58,11 +58,11 @@ public record Export() {
static long pack(int r, int c) { return (((long) r) << 32) ^ (c & 0xFFFFFFFFL); }
long l1, l2;
public boolean get(int bitIndex) {
if (bitIndex < 64) return (l1 & (1L << bitIndex)) != 0L;
if ((bitIndex & 64) == 0) return (l1 & (1L << bitIndex)) != 0L;
return (l2 & (1L << (bitIndex & 63))) != 0L;
}
public void set(int bitIndex) {
if (bitIndex < 64) this.l1 |= 1L << bitIndex;
if ((bitIndex & 64) == 0) this.l1 |= 1L << bitIndex;
else this.l2 |= 1L << (bitIndex & 63);
}
public void clear() {