Bit Flipper 2: A new hope oder so ⭐🐬
This commit is contained in:
parent
d631848d83
commit
c24b5ee75e
Binary file not shown.
@ -62,13 +62,22 @@ public class SPN {
|
||||
}
|
||||
|
||||
public int swapBits(int x, int a, int b) {
|
||||
int tmpA = (x & (0x1 << 15 - a)) == 0 ? 0 : 1;
|
||||
int tmpB = (x & (0x1 << 15 - b)) == 0 ? 0 : 1;
|
||||
int tmpA = (x & (0x1 << (15 - a)));
|
||||
int tmpB = (x & (0x1 << (15 - b)));
|
||||
|
||||
tmpA = tmpA == 0 ? 0 : 1;
|
||||
tmpB = tmpB == 0 ? 0 : 1;
|
||||
|
||||
x = tmpA == 0 ? (x & 0x1 << 15 - b) & 0b0 : (x & 0x1 << 15 - b) & ~0b0;
|
||||
tmpA = tmpA << (15 -b);
|
||||
tmpB = tmpB << (15 - a);
|
||||
|
||||
x = x | tmpA;
|
||||
x = x | tmpB;
|
||||
|
||||
return 0;
|
||||
// x = tmpA == 0 ? (x & 0x1 << 15 - b) | 0b0 : (x & 0x1 << 15 - b) | ~0b0;
|
||||
// x = tmpB == 0 ? (x & 0x1 << 15 - a) | 0b0 : (x & 0x1 << 15 - a) | ~0b0;
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user