blob: 12f3c6580602985325823150f2d27a064cf13f15 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#ifndef TYPES_H
#define TYPES_H
#include "config.h"
typedef unsigned char u8;
typedef unsigned short u16;
typedef signed short i16;
typedef unsigned int u32;
#ifdef ALIGNMENT_WORKAROUND
# ifdef BIGENDIAN
# define WORD(x) (u16)((x)[1]+((x)[0]<<8))
# define DWORD(x) (u32)((x)[3]+((x)[2]<<8)+((x)[1]<<16)+((x)[0]<<24))
# define QWORD(x) (U64(DWORD(x+4), DWORD(x)))
# else /* BIGENDIAN */
# define WORD(x) (u16)((x)[0]+((x)[1]<<8))
# define DWORD(x) (u32)((x)[0]+((x)[1]<<8)+((x)[2]<<16)+((x)[3]<<24))
# define QWORD(x) (U64(DWORD(x), DWORD(x+4)))
# endif /* BIGENDIAN */
#else /* ALIGNMENT_WORKAROUND */
#define WORD(x) (u16)(*(const u16 *)(x))
#define DWORD(x) (u32)(*(const u32 *)(x))
#define QWORD(x) (*(const u64 *)(x))
#endif /* ALIGNMENT_WORKAROUND */
#endif
|