Created
November 5, 2016 04:39
-
-
Save KentaYamada/2ce240f105cea37b815f2753119649e4 to your computer and use it in GitHub Desktop.
バイトデータからビットデータ取り出し
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
| #include <iostream> | |
| int main() | |
| { | |
| char c = 0x05; //Binary: 00000101 | |
| for(int i = 0; i <= 2; i++) { | |
| std::cout << (unsigned int)((c >> i) & 0x01) << std::endl; | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment