Last active
December 29, 2021 14:42
-
-
Save alexandercerutti/b38dfc2e0a4b00597cee567bcb0ee53d to your computer and use it in GitHub Desktop.
bitwise-article
This file contains hidden or 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
/** | |
* In grid reading, it is important to have all the bits aligned. | |
* Unaligned bits can lead to misreading and therefore to bugs. | |
* | |
* Trust me, I've shipped in production a product that had a | |
* broken feature due to a wrong bit. | |
*/ | |
enum States { | |
LOADING /***/ = 0b0000, /* Set to 0 because it is the initial state */ | |
FAILED /****/ = 0b0001, | |
LOADED /****/ = 0b1110, | |
PLAYING /***/ = 0b0100, | |
STOPPED /***/ = 0b1000 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment