1
/* CpuArch.h -- CPU specific code
2
2010-10-26: Igor Pavlov : Public domain */
13
MY_CPU_LE means that CPU is LITTLE ENDIAN.
14
If MY_CPU_LE is not defined, we don't know about that property of platform (it can be LITTLE ENDIAN).
16
MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned memory accesses.
17
If MY_CPU_LE_UNALIGN is not defined, we don't know about these properties of platform.
20
#define GetUi16(p) (cli_readint16(p))
21
#define GetUi32(p) (cli_readint32(p))
23
#define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32))
25
#define SetUi16(p, d) { UInt32 _x_ = (d); \
26
((Byte *)(p))[0] = (Byte)_x_; \
27
((Byte *)(p))[1] = (Byte)(_x_ >> 8); }
29
#define SetUi32(p, d) (cli_writeint32(p, d))
31
#define SetUi64(p, d) { UInt64 _x64_ = (d); \
32
SetUi32(p, (UInt32)_x64_); \
33
SetUi32(((Byte *)(p)) + 4, (UInt32)(_x64_ >> 32)); }
35
#define GetBe16(p) (((UInt16)((const Byte *)(p))[0] << 8) | ((const Byte *)(p))[1])
1
/* CpuArch.h -- CPU specific code
2
2010-10-26: Igor Pavlov : Public domain */
13
MY_CPU_LE means that CPU is LITTLE ENDIAN.
14
If MY_CPU_LE is not defined, we don't know about that property of platform (it can be LITTLE ENDIAN).
16
MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned memory accesses.
17
If MY_CPU_LE_UNALIGN is not defined, we don't know about these properties of platform.
20
#define GetUi16(p) (cli_readint16(p))
21
#define GetUi32(p) (cli_readint32(p))
23
#define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32))
25
#define SetUi16(p, d) { UInt32 _x_ = (d); \
26
((Byte *)(p))[0] = (Byte)_x_; \
27
((Byte *)(p))[1] = (Byte)(_x_ >> 8); }
29
#define SetUi32(p, d) (cli_writeint32(p, d))
31
#define SetUi64(p, d) { UInt64 _x64_ = (d); \
32
SetUi32(p, (UInt32)_x64_); \
33
SetUi32(((Byte *)(p)) + 4, (UInt32)(_x64_ >> 32)); }
35
#define GetBe16(p) (((UInt16)((const Byte *)(p))[0] << 8) | ((const Byte *)(p))[1])