introduce bitloops
This commit is contained in:
@@ -135,8 +135,12 @@ public class SwedishGeneratorTest {
|
||||
|
||||
@Test
|
||||
void testSlot() {
|
||||
System.out.println("[DEBUG_LOG] Slot.BIT_FOR_DIR = " + Slot.BIT_FOR_DIR);
|
||||
// key = (r << 8) | (c << 4) | d
|
||||
var key = (Grid.offset(2, 3) << 4) | 5;
|
||||
var offset = Grid.offset(2, 3);
|
||||
System.out.println("[DEBUG_LOG] Grid.offset(2, 3) = " + offset);
|
||||
var key = (offset << Slot.BIT_FOR_DIR) | 5;
|
||||
System.out.println("[DEBUG_LOG] key = " + key);
|
||||
long packedPos = 0;
|
||||
// pos 0: (2, 5)
|
||||
packedPos |= Grid.offset(2, 5);
|
||||
@@ -146,6 +150,7 @@ public class SwedishGeneratorTest {
|
||||
packedPos |= (long) Grid.offset(4, 5) << 14;
|
||||
|
||||
var s = Slot.from(key, packedPos, 3);
|
||||
System.out.println("[DEBUG_LOG] s.dir() = " + s.dir());
|
||||
assertEquals(2, s.clueR());
|
||||
assertEquals(3, s.clueC());
|
||||
assertEquals(5, s.dir());
|
||||
|
||||
Reference in New Issue
Block a user