Created
February 20, 2021 14:16
-
-
Save parth-paradkar/a43add692bcdd3b869650f15a0633c35 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
| #define byte unsigned char | |
| void printBytes(byte *target, int size) { | |
| byte select = 128; | |
| byte *i = target; | |
| while(size--) { | |
| byte currentByte = *i; | |
| for(int k = 0; k < 8*sizeof(byte); k++) { | |
| printf("%d", (int)((currentByte & select) > 0)); | |
| currentByte <<= 1; | |
| } | |
| printf(" "); | |
| i++; | |
| } | |
| printf("\n"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment