4 static int little_endian(void) {
6 ((char *) (&i))[0] = 1;
11 printf("#ifndef __ENDIAN_H\n");
12 printf("#define __ENDIAN_H\n");
14 printf("#define __LITTLE_ENDIAN 1234\n");
15 printf("#define __BIG_ENDIAN 4321\n");
16 printf("#define __BYTE_ORDER __%s_ENDIAN\n",
17 little_endian() ? "LITTLE" : "BIG");
19 printf("#endif /* __ENDIAN_H */\n");