fork(1) download
  1. #include <cstdio>
  2. #include <cstdlib>
  3. using namespace std;
  4.  
  5. unsigned int reverse(unsigned int x)
  6. {
  7. x = (x&0x00FF00FF)<< 8 | (x&0xFF00FF00) >> 8;
  8. x = (x&0x0000FFFF)<< 16 | (x&0xFFFF0000) >> 16;
  9. return x;
  10. }
  11.  
  12. int main() {
  13. for(int i = 0; i < 20; ++i)
  14. {
  15. unsigned int x = rand() << 16 + rand();
  16. printf("%08X -- %08X\n",x,reverse(x));
  17. }
  18. return 0;
  19. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
59C00000 -- 0000C059
21E4C348 -- 48C3E421
6E288000 -- 0080286E
A0000000 -- 000000A0
20000000 -- 00000020
D0000000 -- 000000D0
8A0F9000 -- 00900F8A
78C00000 -- 0000C078
01F00000 -- 0000F001
20085400 -- 00540820
1B000000 -- 0000001B
E0000000 -- 000000E0
383DD800 -- 00D83D38
C9700000 -- 000070C9
61198000 -- 00801961
9F132400 -- 0024139F
39ABED98 -- 98EDAB39
CDA80680 -- 8006A8CD
2DBA3100 -- 0031BA2D
C4C28C00 -- 008CC2C4