OpenRaider  0.1.4-dev
Open Source Tomb Raider Game Engine implementation
Macros | Functions | Variables
binary.cpp File Reference

Binary file reading utilities. More...

#include "global.h"
#include "utils/binary.h"
Include dependency graph for binary.cpp:

Go to the source code of this file.

Macros

#define ISBIGENDIAN()   ((*reinterpret_cast<const char *>(&bigendiandetection)) == 0)
 

Functions

static void swapByteOrder (char *d, unsigned int n)
 

Variables

static const int bigendiandetection = 1
 

Detailed Description

Binary file reading utilities.

Author
xythobuz

Definition in file binary.cpp.

Macro Definition Documentation

#define ISBIGENDIAN ( )    ((*reinterpret_cast<const char *>(&bigendiandetection)) == 0)

Definition at line 58 of file binary.cpp.

Function Documentation

static void swapByteOrder ( char *  d,
unsigned int  n 
)
static

Definition at line 60 of file binary.cpp.

Variable Documentation

const int bigendiandetection = 1
static
FIXME:
Left-Shift with signed integer is undefined! So we can't use the same method as for unsigned integers. Is there a portable way to read multi-byte signed integers, without having to detect the endianness at run-time?

Definition at line 57 of file binary.cpp.