README: fix a typo in the "make install_udev_rules" command line
[kinect-audio-setup.git] / kinect_upload_fw / endian.c
1 #include <stdio.h>
2 #include <stdlib.h>
3
4 static int little_endian(void) {
5         int i = 0;
6         ((char *) (&i))[0] = 1;
7         return (i == 1);
8 }
9
10 int main(void) {
11         printf("#ifndef __ENDIAN_H\n");
12         printf("#define __ENDIAN_H\n");
13         printf("\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");
18         printf("\n");
19         printf("#endif /* __ENDIAN_H */\n");
20         exit(0);
21 }