implement bit swapping

This commit is contained in:
Sebastian Hugentobler 2022-03-17 17:59:32 +01:00
parent a399de663f
commit 115ed2efbf
2 changed files with 8 additions and 15 deletions

View file

@ -43,11 +43,13 @@ class SPNTest {
int r = 0xC;
// when
int y = spn.swapBits(x, 1, 2);
int yy = spn.swapBits(x, 2, 1);
int y = spn.swapBits(x, 13, 14);
int yy = spn.swapBits(x, 14, 13);
int yyy = spn.swapBits(x, 14, 14);
// then
assertEquals(r, y);
assertEquals(r, yy);
assertEquals(x, yyy);
}
}