Skip to content

Instantly share code, notes, and snippets.

@leofun01
Last active January 12, 2019 16:02
Show Gist options
  • Select an option

  • Save leofun01/bff30e2015f939fb683a52e6305a5002 to your computer and use it in GitHub Desktop.

Select an option

Save leofun01/bff30e2015f939fb683a52e6305a5002 to your computer and use it in GitHub Desktop.
Unordered output of 32 values (from 0 to 31) using magic number.
#include <stdio.h>
int main(void) {
unsigned int v3 = 2359778272; // bin(10001100101001110101101111100000) == dec(2359778272) == hex(8CA75BE0)
do
printf(" %i", v3 & 31);
while(v3 >>= 1);
return 0;
}
// Output: 0 16 24 28 30 31 15 23 27 13 22 11 21 26 29 14 7 19 9 20 10 5 18 25 12 6 3 17 8 4 2 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment