Created
November 19, 2019 23:32
-
-
Save cacharle/af891127545e3907057d277120511b58 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 PRINT_BYTE(x) (print_bits((x), 8)) | |
#define PRINT_WORD(x) (print_bits((x), 16)) | |
#define PRINT_DWORD(x) (print_bits((x), 32)) | |
#define PRINT_QWORD(x) (print_bits((x), 64)) | |
void print_bits(unsigned long long int n, int s) | |
{ | |
if (s == 0) | |
return; | |
print_bits(n >> 1, s - 1); | |
printf("%d", n & 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment