endian_check.cpp File Reference

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.

Detailed Description

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.


Enumeration Type Documentation

enum Endian

Supported endian types.

Enumerator:
ENDIAN_LITTLE 

little endian

ENDIAN_BIG 

big endian

Definition at line 25 of file endian_check.cpp.


Function Documentation

int main ( int  argc,
char *  argv[] 
)

Main call of the endian_check program.

Parameters:
argc argument count
argv arguments themselves
Returns:
exit code

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").

Parameters:
endian endian type to define

Definition at line 34 of file endian_check.cpp.

References ENDIAN_LITTLE.

Referenced by main().


Generated on Fri Mar 4 21:37:11 2011 for OpenTTD by  doxygen 1.6.1