implement bit swapping
This commit is contained in:
parent
a399de663f
commit
115ed2efbf
2 changed files with 8 additions and 15 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue