lang.cpp | To Bigedian

#include <stdio.h>
#include <stdlib.h>
#define toBig(v) \
  ((v & 0xff000000) >> 24)| \
  ((v & 0xff0000) >> 8)| \
  ((v & 0xff00) << 8)| \
  ((v & 0xff) << 24)

int main()
{
  printf("%#X\n", toBig(0x12345678));
}

Comments