src/core/endian_func.hpp
author rubidium
Fri, 21 Dec 2007 19:21:21 +0000
changeset 8113 31b7784db761
child 8132 f4c7a8e4f25a
permissions -rw-r--r--
(svn r11674) -Codechange: refactor some functions out of macros.h into more logical locations.
/* $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 */