fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.  
  5. unsigned short v = 44;
  6.  
  7. v = ((v >> 1) & 0x5555) | ((v & 0x5555) << 1);
  8. v = ((v >> 2) & 0x3333) | ((v & 0x3333) << 2);
  9. v = ((v >> 4) & 0x0F0F) | ((v & 0x0F0F) << 4);
  10. v = ((v >> 8) & 0x00FF) | ((v & 0x00FF) << 8);
  11. printf("%hx\n", v);
  12.  
  13.  
  14. return 0;
  15. }
Success #stdin #stdout 0.02s 1720KB
stdin
Standard input is empty
stdout
3400