Loading...
Searching...
No Matches
Go to the documentation of this file.
22#ifndef PED_ENDIAN_H_INCLUDED
23#define PED_ENDIAN_H_INCLUDED
28#define _GET_BYTE(x, n) ( ((x) >> (8 * (n))) & 0xff )
30#define _PED_SWAP16(x) ( (_GET_BYTE(x, 0) << 8) \
31 + (_GET_BYTE(x, 1) << 0) )
33#define _PED_SWAP32(x) ( (_GET_BYTE(x, 0) << 24) \
34 + (_GET_BYTE(x, 1) << 16) \
35 + (_GET_BYTE(x, 2) << 8) \
36 + (_GET_BYTE(x, 3) << 0) )
38#define _PED_SWAP64(x) ( (_GET_BYTE(x, 0) << 56) \
39 + (_GET_BYTE(x, 1) << 48) \
40 + (_GET_BYTE(x, 2) << 40) \
41 + (_GET_BYTE(x, 3) << 32) \
42 + (_GET_BYTE(x, 4) << 24) \
43 + (_GET_BYTE(x, 5) << 16) \
44 + (_GET_BYTE(x, 6) << 8) \
45 + (_GET_BYTE(x, 7) << 0) )
47#define PED_SWAP16(x) ((uint16_t) _PED_SWAP16( (uint16_t) (x) ))
48#define PED_SWAP32(x) ((uint32_t) _PED_SWAP32( (uint32_t) (x) ))
49#define PED_SWAP64(x) ((uint64_t) _PED_SWAP64( (uint64_t) (x) ))
53#define PED_CPU_TO_LE16(x) PED_SWAP16(x)
54#define PED_CPU_TO_BE16(x) (x)
55#define PED_CPU_TO_LE32(x) PED_SWAP32(x)
56#define PED_CPU_TO_BE32(x) (x)
57#define PED_CPU_TO_LE64(x) PED_SWAP64(x)
58#define PED_CPU_TO_BE64(x) (x)
60#define PED_LE16_TO_CPU(x) PED_SWAP16(x)
61#define PED_BE16_TO_CPU(x) (x)
62#define PED_LE32_TO_CPU(x) PED_SWAP32(x)
63#define PED_BE32_TO_CPU(x) (x)
64#define PED_LE64_TO_CPU(x) PED_SWAP64(x)
65#define PED_BE64_TO_CPU(x) (x)
69#define PED_CPU_TO_LE16(x) (x)
70#define PED_CPU_TO_BE16(x) PED_SWAP16(x)
71#define PED_CPU_TO_LE32(x) (x)
72#define PED_CPU_TO_BE32(x) PED_SWAP32(x)
73#define PED_CPU_TO_LE64(x) (x)
74#define PED_CPU_TO_BE64(x) PED_SWAP64(x)
76#define PED_LE16_TO_CPU(x) (x)
77#define PED_BE16_TO_CPU(x) PED_SWAP16(x)
78#define PED_LE32_TO_CPU(x) (x)
79#define PED_BE32_TO_CPU(x) PED_SWAP32(x)
80#define PED_LE64_TO_CPU(x) (x)
81#define PED_BE64_TO_CPU(x) PED_SWAP64(x)