Created
July 2, 2017 23:55
-
-
Save arms22/f3797f94632d8cbd4544503c5b6c6dc2 to your computer and use it in GitHub Desktop.
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
#include <stdio.h> | |
int main(void){ | |
unsigned long in = 0x00000003; | |
unsigned long out; | |
out = in; | |
out = ((out & 0x0000ff00) << 8) | (out & 0x000000ff); | |
out = ((out & 0x00f0f0f0) << 4) | (out & 0x000f0f0f); | |
out = ((out & 0x0ccccccc) << 2) | (out & 0x03333333); | |
out = ((out & 0xaaaaaaaa) << 1) | (out & 0x55555555); | |
printf("in %lx out %lx\n",in, out); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment