summaryrefslogtreecommitdiff
path: root/src/core/endian_func.hpp
blob: 545e6b9868819906e86438c6f093c5a094c2d304 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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 */