To perform a logical bitwise operation on a variable and assign the result back to the original variable, you can use the following shortcut.
Instead of writing :
1
| x = x & 0x0020; |
You can write :
1
| x &= 0x0020; |
You can do the same thing with the other bitwise logical operators and the shift operators:
1
2
3
4
| x |= 0x2200; // Logical OR x ^= 0x1A1A; // Logical XOR x <<= 4; // Left-shift x by 4 bits x >>= 3; // Right-shift x by 3 bits |