-
Notifications
You must be signed in to change notification settings - Fork 4
/
bswap.h
39 lines (34 loc) · 930 Bytes
/
bswap.h
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
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef __BSWAP_H__
#define __BSWAP_H__
#include "bconfig.h"
#include "libbeye/sysdep/__config.h"
// be2me ... BigEndian to MachineEndian
// le2me ... LittleEndian to MachineEndian
#if __BYTE_ORDER != __LITTLE_ENDIAN
#define be2me_16(x) (x)
#define be2me_32(x) (x)
#define be2me_64(x) (x)
#define me2be_16(x) (x)
#define me2be_32(x) (x)
#define me2be_64(x) (x)
#define le2me_16(x) ByteSwapS(x)
#define le2me_32(x) ByteSwapL(x)
#define le2me_64(x) ByteSwapLL(x)
#define me2le_16(x) ByteSwapS(x)
#define me2le_32(x) ByteSwapL(x)
#define me2le_64(x) ByteSwapLL(x)
#else
#define be2me_16(x) ByteSwapS(x)
#define be2me_32(x) ByteSwapL(x)
#define be2me_64(x) ByteSwapLL(x)
#define me2be_16(x) ByteSwapS(x)
#define me2be_32(x) ByteSwapL(x)
#define me2be_64(x) ByteSwapLL(x)
#define le2me_16(x) (x)
#define le2me_32(x) (x)
#define le2me_64(x) (x)
#define me2le_16(x) (x)
#define me2le_32(x) (x)
#define me2le_64(x) (x)
#endif
#endif