debian/copyright: update to Copyright-Format 1.0
[kinect-audio-setup.git] / kinect_upload_fw / endian.c
1 #include <stdio.h>
2 #include <stdlib.h>
3
4 static int litend(void) {
5         int i = 0;
6         ((char *) (&i))[0] = 1;
7         return (i == 1);
8 }
9
10 static int bigend(void) {
11         return !litend();
12 }
13
14 int main(void) {
15         printf("#ifndef __ENDIAN_H\n");
16         printf("#define __ENDIAN_H\n");
17         printf("\n");
18         printf("#define __LITTLE_ENDIAN 1234\n");
19         printf("#define __BIG_ENDIAN    4321\n");
20         printf("#define __BYTE_ORDER __%s_ENDIAN\n",
21                litend() ? "LITTLE" : "BIG");
22         printf("\n");
23         printf("#endif /* __ENDIAN_H */\n");
24         exit(0);
25 }