(svn r11674) -Codechange: refactor some functions out of macros.h into more logical locations.

This commit is contained in:
rubidium
2007-12-21 19:21:21 +00:00
parent d5c4ba8246
commit 01e20c9140
50 changed files with 76 additions and 98 deletions

22
src/core/endian_func.hpp Normal file
View File

@@ -0,0 +1,22 @@
/* $Id$ */
/** @file endian_func.hpp */
#ifndef ENDIAN_FUNC_H
#define ENDIAN_FUNC_H
static inline uint16 ReadLE16Aligned(const void *x)
{
return FROM_LE16(*(const uint16*)x);
}
static inline uint16 ReadLE16Unaligned(const void *x)
{
#ifdef OTTD_ALIGNMENT
return ((const byte*)x)[0] | ((const byte*)x)[1] << 8;
#else
return FROM_LE16(*(const uint16*)x);
#endif
}
#endif /* ENDIAN_FUNC_H */