Created
January 2, 2016 09:44
-
-
Save fahied/be0eb7d5ef1342c115e9 to your computer and use it in GitHub Desktop.
Typical Bit Mask Operations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Typical Bit Mask Operations | |
Set a flag or overlay multiple values | |
flags | flagbitN | |
Unset a flag (zero-out a bit or set a bit to zero) | |
flags & ~flagbitN | |
Check if a bit is set | |
(flags & flagbitN) == flagbitN | |
Invert a pattern of bits | |
~flags |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment