This pretty simple file checks if the system is LITTLE_ENDIAN or BIG_ENDIAN it does that by putting a 1 and a 0 in an array, and read it out as one number. More...
#include <stdio.h>#include <string.h>Go to the source code of this file.
Enumerations | |
| enum | Endian { ENDIAN_LITTLE, ENDIAN_BIG } |
Supported endian types. More... | |
Functions | |
| static void | printf_endian (Endian endian) |
| Shortcut to printf("#define TTD_ENDIAN TTD_*_ENDIAN"). | |
| int | main (int argc, char *argv[]) |
| Main call of the endian_check program. | |
This pretty simple file checks if the system is LITTLE_ENDIAN or BIG_ENDIAN it does that by putting a 1 and a 0 in an array, and read it out as one number.
If it is 1, it is LITTLE_ENDIAN, if it is 256, it is BIG_ENDIAN
After that it outputs the contents of an include files (endian.h) that says or TTD_LITTLE_ENDIAN, or TTD_BIG_ENDIAN. Makefile takes care of the real writing to the file.
Definition in file endian_check.cpp.
| enum Endian |
Supported endian types.
Definition at line 25 of file endian_check.cpp.
| int main | ( | int | argc, | |
| char * | argv[] | |||
| ) |
Main call of the endian_check program.
| argc | argument count | |
| argv | arguments themselves |
Definition at line 45 of file endian_check.cpp.
References ENDIAN_BIG, ENDIAN_LITTLE, and printf_endian().
| static void printf_endian | ( | Endian | endian | ) | [inline, static] |
Shortcut to printf("#define TTD_ENDIAN TTD_*_ENDIAN").
| endian | endian type to define |
Definition at line 34 of file endian_check.cpp.
References ENDIAN_LITTLE.
Referenced by main().
1.7.1